[Freeswitch-branches] [commit] r9223 - in freeswitch/branches/lukedashjr/syslibs: freeswitch freeswitch/build freeswitch/conf freeswitch/conf/autoload_configs freeswitch/conf/dialplan freeswitch/conf/dialplan/extensions freeswitch/conf/directory/default freeswitch/conf/lang/de/demo freeswitch/conf/lang/en freeswitch/conf/lang/en/demo freeswitch/conf/lang/fr/vm freeswitch/conf/sip_profiles freeswitch/conf/sip_profiles/external freeswitch/conf/yaml freeswitch/debian freeswitch/debian/default freeswitch/debian/monit freeswitch/docs freeswitch/docs/phrase freeswitch/scripts freeswitch/scripts/contrib/intralanman/PHP/fs_curl freeswitch/scripts/contrib/intralanman/PHP/fs_curl/configuration freeswitch/scripts/contrib/intralanman/perl freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents freeswitch/scripts/js_modules freeswitch/scripts/scenario freeswitch/scripts/socket/FreeSWITCH freeswitch/scripts/socket/FreeSWITCH/debian freeswitch/scripts/socket/freepy freeswitch/src freeswitch/src/include freeswitch/src/include/private freeswitch/src/mod/applications/mod_commands freeswitch/src/mod/applications/mod_conference freeswitch/src/mod/applications/mod_dptools freeswitch/src/mod/applications/mod_enum freeswitch/src/mod/applications/mod_esf freeswitch/src/mod/applications/mod_expr freeswitch/src/mod/applications/mod_fifo freeswitch/src/mod/applications/mod_fsv freeswitch/src/mod/applications/mod_limit freeswitch/src/mod/applications/mod_rss freeswitch/src/mod/applications/mod_snom freeswitch/src/mod/applications/mod_voicemail freeswitch/src/mod/asr_tts freeswitch/src/mod/asr_tts/mod_cepstral freeswitch/src/mod/asr_tts/mod_flite freeswitch/src/mod/asr_tts/mod_lumenvox freeswitch/src/mod/asr_tts/mod_openmrcp freeswitch/src/mod/asr_tts/mod_pocketsphinx freeswitch/src/mod/codecs/mod_amr freeswitch/src/mod/codecs/mod_g723_1 freeswitch/src/mod/codecs/mod_g729 freeswitch/src/mod/codecs/mod_h26x freeswitch/src/mod/codecs/mod_ilbc freeswitch/src/mod/codecs/mod_speex freeswitch/src/mod/codecs/mod_voipcodecs freeswitch/src/mod/dialplans/mod_dialplan_asterisk freeswitch/src/mod/dialplans/mod_dialplan_directory freeswitch/src/mod/dialplans/mod_dialplan_xml freeswitch/src/mod/directories/mod_ldap freeswitch/src/mod/endpoints/mod_dingaling freeswitch/src/mod/endpoints/mod_iax freeswitch/src/mod/endpoints/mod_portaudio freeswitch/src/mod/endpoints/mod_sofia freeswitch/src/mod/endpoints/mod_woomera freeswitch/src/mod/event_handlers/mod_cdr_csv freeswitch/src/mod/event_handlers/mod_event_multicast freeswitch/src/mod/event_handlers/mod_event_socket freeswitch/src/mod/event_handlers/mod_radius_cdr freeswitch/src/mod/event_handlers/mod_zeroconf freeswitch/src/mod/formats/mod_local_stream freeswitch/src/mod/formats/mod_native_file freeswitch/src/mod/formats/mod_shout freeswitch/src/mod/formats/mod_sndfile freeswitch/src/mod/formats/mod_tone_stream freeswitch/src/mod/languages/mod_java freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig freeswitch/src/mod/languages/mod_lua freeswitch/src/mod/languages/mod_lua/lua freeswitch/src/mod/languages/mod_mono freeswitch/src/mod/languages/mod_mono_managed freeswitch/src/mod/languages/mod_mono_managed/swig freeswitch/src/mod/languages/mod_perl freeswitch/src/mod/languages/mod_python freeswitch/src/mod/languages/mod_spidermonkey freeswitch/src/mod/languages/mod_spidermonkey_core_db freeswitch/src/mod/languages/mod_spidermonkey_curl freeswitch/src/mod/languages/mod_spidermonkey_odbc freeswitch/src/mod/languages/mod_spidermonkey_socket freeswitch/src/mod/languages/mod_spidermonkey_teletone freeswitch/src/mod/languages/mod_yaml freeswitch/src/mod/loggers/mod_console freeswitch/src/mod/loggers/mod_logfile freeswitch/src/mod/loggers/mod_syslog freeswitch/src/mod/say/mod_say_de freeswitch/src/mod/say/mod_say_en freeswitch/src/mod/say/mod_say_es freeswitch/src/mod/say/mod_say_fr freeswitch/src/mod/say/mod_say_it freeswitch/src/mod/say/mod_say_nl freeswitch/src/mod/say/mod_say_zh freeswitch/src/mod/xml_int/mod_xml_cdr freeswitch/src/mod/xml_int/mod_xml_curl freeswitch/src/mod/xml_int/mod_xml_ldap freeswitch/src/mod/xml_int/mod_xml_rpc freeswitch/w32/Library freeswitch/w32/Setup libs libs/apr/memory/unix libs/curl/lib libs/libdingaling/src libs/libedit libs/libsndfile libs/libteletone/src libs/pcre libs/portaudio libs/portaudio/bindings/cpp libs/portaudio/bindings/cpp/build/gnu libs/portaudio/build/msvc libs/portaudio/include libs/portaudio/src libs/portaudio/src/common libs/portaudio/src/hostapi/alsa libs/portaudio/src/hostapi/asihpi libs/portaudio/src/hostapi/asio libs/portaudio/src/hostapi/coreaudio libs/portaudio/src/hostapi/dsound libs/portaudio/src/hostapi/jack libs/portaudio/src/hostapi/oss libs/portaudio/src/hostapi/wasapi libs/portaudio/src/hostapi/wdmks libs/portaudio/src/hostapi/wmme libs/portaudio/src/os/unix libs/portaudio/src/os/win libs/portaudio/test libs/sofia-sip libs/sofia-sip/libsofia-sip-ua/nta libs/sofia-sip/libsofia-sip-ua/nth libs/sofia-sip/libsofia-sip-ua/nua libs/sofia-sip/libsofia-sip-ua/sresolv libs/sofia-sip/libsofia-sip-ua/stun libs/sofia-sip/libsofia-sip-ua/su libs/sofia-sip/libsofia-sip-ua/tport libs/sofia-sip/tests libs/sofia-sip/utils libs/sofia-sip/win32 libs/sofia-sip/win32/tests/test_nua libs/stfu libs/voipcodecs libs/win32 libs/win32/Sound_Files libs/win32/flite libs/win32/libmp3lame libs/win32/libogg libs/win32/libshout libs/win32/pocketsphinx libs/win32/sphinxbase libs/xmlrpc-c libs/xmlrpc-c/include/xmlrpc-c libs/xmlrpc-c/lib/abyss/src libs/xmlrpc-c/lib/util/include libs/yaml

Freeswitch SVN lukedashjr at freeswitch.org
Mon Aug 4 21:29:59 EDT 2008


Author: lukedashjr
Date: Mon Aug  4 21:29:58 2008
New Revision: 9223

Added:
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/pocketsphinx.conf.xml
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/conf/autoload_configs/pocketsphinx.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/python.conf.xml
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/conf/autoload_configs/python.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/dialplan/extensions/00_pizza_demo.xml
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/conf/dialplan/extensions/00_pizza_demo.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/dialplan/extensions/99999_enum.xml
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/conf/dialplan/extensions/99999_enum.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/notify-voicemail.tpl
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/conf/notify-voicemail.tpl
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/yaml/
      - copied from r9222, /freeswitch/tags/1.0.1/conf/yaml/
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch-lang-es.install
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/debian/freeswitch-lang-es.install
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch-lang-nl.install
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/debian/freeswitch-lang-nl.install
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch-sounds-en-us-callie-16000.install
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/debian/freeswitch-sounds-en-us-callie-16000.install
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch-sounds-en-us-callie-32000.install
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/debian/freeswitch-sounds-en-us-callie-32000.install
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch-sounds-en-us-callie-8000.install
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/debian/freeswitch-sounds-en-us-callie-8000.install
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch-sounds-music-8000.install
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/debian/freeswitch-sounds-music-8000.install
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.default
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/debian/freeswitch.default
   freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/phrase/phrase_zh_HK.xml
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/docs/phrase/phrase_zh_HK.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/Makefile.gram
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/Makefile.gram
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/api.lua
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/api.lua
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.Designer.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.Designer.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.resx
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/ChannelWatcher.resx
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelPark.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelPark.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventSessionCrash.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventSessionCrash.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/mklm
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/mklm
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/ps_pizza.js
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/ps_pizza.js
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/quick_lm.pl
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/quick_lm.pl
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/FreeSWITCH/ChangeLog
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/socket/FreeSWITCH/ChangeLog
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/FreeSWITCH/Makefile.PL
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/socket/FreeSWITCH/Makefile.PL
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/FreeSWITCH/README
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/scripts/socket/FreeSWITCH/README
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/FreeSWITCH/debian/
      - copied from r9222, /freeswitch/tags/1.0.1/scripts/socket/FreeSWITCH/debian/
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_snom/
      - copied from r9222, /freeswitch/tags/1.0.1/src/mod/applications/mod_snom/
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_flite/
      - copied from r9222, /freeswitch/tags/1.0.1/src/mod/asr_tts/mod_flite/
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_pocketsphinx/
      - copied from r9222, /freeswitch/tags/1.0.1/src/mod/asr_tts/mod_pocketsphinx/
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/Makefile
      - copied unchanged from r8702, /freeswitch/tags/1.0.0/src/mod/endpoints/mod_iax/Makefile
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.vcproj
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/formats/mod_shout/mod_shout.vcproj
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/DTMF.java
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_java/src/org/freeswitch/swig/DTMF.java
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/EventConsumer.java
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_java/src/org/freeswitch/swig/EventConsumer.java
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_event_node_t.java
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_event_node_t.java
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_event_types_t.java
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_event_types_t.java
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_queue_t.java
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_queue_t.java
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_uint32_t.java
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_uint32_t.java
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long__switch_call_cause_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long__switch_call_cause_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_application_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_application_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_asr_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_asr_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_bind_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_bind_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_caller_profile_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_caller_profile_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_channel_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_channel_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_codec_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_core_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_session_message_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_core_session_message_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_directory_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_directory_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_eavesdrop_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_eavesdrop_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_file_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_file_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_frame_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_frame_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_io_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_ivr_option_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_ivr_option_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_media_bug_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_media_bug_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_media_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_media_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_originate_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_originate_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_port_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_port_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_rtp_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_rtp_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_scheduler_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_scheduler_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_speech_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_speech_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_timer_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_timer_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_unicast_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_unicast_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_vad_flag_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_vad_flag_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_xml_section_enum_t.cs
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_mono_managed/swig/switch_xml_section_enum_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/hack.diff
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_python/hack.diff
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_extra.c
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_python/mod_python_extra.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_extra.h
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_python/mod_python_extra.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/python_example.py
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_python/python_example.py
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_yaml/
      - copied from r9222, /freeswitch/tags/1.0.1/src/mod/languages/mod_yaml/
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/lutil_ldap.h
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/mod/xml_int/mod_xml_ldap/lutil_ldap.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_xml.c
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/src/switch_xml.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Setup/freeswitch.aip
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/w32/Setup/freeswitch.aip
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/aclocal.m4
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/aclocal.m4
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/bindings/cpp/aclocal.m4
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/bindings/cpp/aclocal.m4
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/bindings/cpp/build/gnu/aclocal.m4
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/bindings/cpp/build/gnu/aclocal.m4
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_jack.h
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/include/pa_jack.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_win_ds.h
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/include/pa_win_ds.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_win_waveformat.h
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/include/pa_win_waveformat.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/win/pa_win_waveformat.c
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/src/os/win/pa_win_waveformat.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/win/pa_win_wdmks_utils.c
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/src/os/win/pa_win_wdmks_utils.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/win/pa_win_wdmks_utils.h
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/src/os/win/pa_win_wdmks_utils.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_dsound_surround.c
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/test/patest_dsound_surround.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_sine_channelmaps.c
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/test/patest_sine_channelmaps.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_wmme_surround.c
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/portaudio/test/patest_wmme_surround.c
   freeswitch/branches/lukedashjr/syslibs/libs/win32/Dowload 32khz Sounds.2008.vcproj
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/win32/Dowload 32khz Sounds.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/win32/Download 16khz Sounds.2008.vcproj
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/win32/Download 16khz Sounds.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/win32/Download 8khz Sounds.2008.vcproj
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/win32/Download 8khz Sounds.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/win32/Download FLITE.2008.vcproj
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/win32/Download FLITE.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/win32/Download LAME.2008.vcproj
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/win32/Download LAME.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/win32/Download LIBSHOUT.2008.vcproj
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/win32/Download LIBSHOUT.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/win32/Download OGG.2008.vcproj
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/win32/Download OGG.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/win32/Download pocketsphinx.2008.vcproj
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/win32/Download pocketsphinx.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/win32/Download sphinxbase.2008.vcproj
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/win32/Download sphinxbase.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/win32/Download sphinxmodel.2008.vcproj
      - copied unchanged from r9222, /freeswitch/tags/1.0.1/libs/win32/Download sphinxmodel.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/win32/Sound_Files/
      - copied from r9222, /freeswitch/tags/1.0.1/libs/win32/Sound_Files/
   freeswitch/branches/lukedashjr/syslibs/libs/win32/flite/
      - copied from r9222, /freeswitch/tags/1.0.1/libs/win32/flite/
   freeswitch/branches/lukedashjr/syslibs/libs/win32/libmp3lame/
      - copied from r9222, /freeswitch/tags/1.0.1/libs/win32/libmp3lame/
   freeswitch/branches/lukedashjr/syslibs/libs/win32/libogg/
      - copied from r9222, /freeswitch/tags/1.0.1/libs/win32/libogg/
   freeswitch/branches/lukedashjr/syslibs/libs/win32/libshout/
      - copied from r9222, /freeswitch/tags/1.0.1/libs/win32/libshout/
   freeswitch/branches/lukedashjr/syslibs/libs/win32/pocketsphinx/
      - copied from r9222, /freeswitch/tags/1.0.1/libs/win32/pocketsphinx/
   freeswitch/branches/lukedashjr/syslibs/libs/win32/sphinxbase/
      - copied from r9222, /freeswitch/tags/1.0.1/libs/win32/sphinxbase/
   freeswitch/branches/lukedashjr/syslibs/libs/yaml/
      - copied from r9222, /freeswitch/tags/1.0.1/libs/yaml/
Removed:
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/default/
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_enum_switch_asr_flag_t__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_enum_switch_asr_flag_t__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_enum_switch_asr_flag_t__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_flag_t_p_q_const__switch_codec_settings__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_enum_switch_originate_flag_t__switch_call_cause_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_enum_switch_speech_flag_t__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_enum_switch_speech_flag_t__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_enum_switch_speech_flag_t__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_enum_switch_speech_flag_t__switch_status_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_asr_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_frame_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_speech_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_application_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_asr_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_bind_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_caller_profile_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_channel_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_session_message_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_directory_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_eavesdrop_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_file_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_frame_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_ivr_option_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_media_bug_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_media_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_originate_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_port_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_rtp_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_scheduler_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_speech_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_timer_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_unicast_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_vad_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_xml_section_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/python.py
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/switch_swig_wrap.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/switch_swig_wrap.c.bkp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_xml.cpp
Modified:
   freeswitch/branches/lukedashjr/syslibs/freeswitch/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.2008.sln
   freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am
   freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modmake.rules.in
   freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modules.conf.in
   freeswitch/branches/lukedashjr/syslibs/freeswitch/build/swigall.sh
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/acl.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/cdr_csv.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/conference.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/console.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/enum.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/ivr.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/lua.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/openmrcp.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/perl.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/switch.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/syslog.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_cdr.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/dialplan/default.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/directory/default/brian.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/de/demo/demo.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo-ivr.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/en.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/fr/vm/sounds.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external/example.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/nat.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/vars.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/control
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/files
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.conffiles
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.init
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.install
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/monit/freeswitch.monitrc
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/rules
   freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog
   freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/phrase/phrase_en.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/freeswitch.spec
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/dialplan_importer.php
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/fs_curl.php
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/fs_dialplan.php
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/global_defines.php
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/perl/fspb
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PartyInfo.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PlainEventMsg.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresence.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceIn.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceOut.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventRoster.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaExpire.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaRegister.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/SipEvent.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/js_modules/SpeechTools.jm
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/scenario/phones.cfg
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/FreeSWITCH/Client.pm
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/README
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/__init__.py
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/apirequest.sm
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/apirequest_sm.py
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/bgapirequest.sm
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/bgapirequest_sm.py
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/globals.py
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/loginrequest.sm
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/loginrequest_sm.py
   freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/request.py
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/private/switch_core_pvt.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_apr.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_bitpack.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_buffer.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_caller.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_db.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_frame.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_loadable_module.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_odbc.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_platform.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_regex.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_resample.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_scheduler.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_enum/mod_enum.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/mod_expr.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fsv/mod_fsv.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_limit/mod_limit.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_rss/mod_rss.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/Makefile
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.vcproj
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_amr/mod_amr.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g723_1/mod_g723_1.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g729/mod_g729.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_h26x/mod_h26x.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_speex/mod_speex.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/directories/mod_ldap/mod_ldap.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_PortAudio.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_PortAudio.vcproj
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/pablio.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_native_file/mod_native_file.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/decode_i386.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/interface.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/layer3.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mpg123.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mpglib.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_tone_stream/mod_tone_stream.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/switch_swig_wrap.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/Makefile
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/hack.diff
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/lua/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch.i
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_wrap.cxx
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.vcproj
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/AppFunction.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Demo.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Loader.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/MonoSession.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/mod_mono_managed.csproj
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/CoreSession.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitch.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE_fixed.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/session_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_asr_interface.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_caller_profile.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec_implementation.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_session_message.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_frame.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_outgoing_channel.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_read_frame.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_read_frame.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_write_frame.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_write_frame.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_routines.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_speech_interface.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_xml_flag_t.cs
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/Makefile
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/hack.diff
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/Makefile.in
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch.py
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.i
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_console/mod_console.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_logfile/mod_logfile.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_syslog/mod_syslog.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_de/mod_say_de.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_en/mod_say_en.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_es/mod_say_es.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_fr/mod_say_fr.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_it/mod_say_it.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_nl/mod_say_nl.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_zh/mod_say_zh.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/Makefile
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_apr.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_buffer.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_caller.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_asr.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_codec.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_directory.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_event_hook.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_file.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_hash.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_media_bug.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_memory.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_port_allocator.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_rwlock.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_speech.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_timer.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_resample.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_scheduler.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_stun.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_time.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/libs/apr/memory/unix/apr_pools.c
   freeswitch/branches/lukedashjr/syslibs/libs/curl/lib/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/ldl_compat.h
   freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/libdingaling.c
   freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/libdingaling.h
   freeswitch/branches/lukedashjr/syslibs/libs/libedit/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/libs/libsndfile/configure.ac
   freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone.h
   freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_detect.c
   freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_detect.h
   freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_generate.c
   freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_generate.h
   freeswitch/branches/lukedashjr/syslibs/libs/pcre/Makefile.in
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/Makefile.in
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/SConstruct
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/bindings/cpp/configure
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.def
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.dsp
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.sln
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/readme.txt
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/config.guess
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/config.sub
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/configure
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/configure.in
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_linux_alsa.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_mac_core.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_win_wmme.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/portaudio.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/ltmain.sh
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/SConscript
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_debugprint.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_debugprint.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_endianness.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_front.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_ringbuffer.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_util.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/alsa/pa_linux_alsa.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/asihpi/pa_linux_asihpi.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/asio/pa_asio.cpp
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/notes.txt
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/jack/pa_jack.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/oss/pa_unix_oss.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wasapi/pa_win_wasapi.cpp
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wdmks/pa_win_wdmks.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wmme/pa_win_wmme.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/unix/pa_unix_util.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/unix/pa_unix_util.h
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/win/pa_win_util.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/win/pa_x86_plain_converters.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_callbackstop.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_read_write_wire.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_record.c
   freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_sine.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/stun/stunc.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/addrinfo.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/localinfo.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_addrinfo.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_proxy.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/test_su.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/test_su_osx.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root_osx.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_init.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nat.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua_params.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/utils/sip-dig.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/README.txt
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.dsp
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/stfu/stfu.c
   freeswitch/branches/lukedashjr/syslibs/libs/voipcodecs/INSTALL
   freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/   (props changed)
   freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/util_int.h
   freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/http.c
   freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/server.c
   freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket_unix.c
   freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/mallocvar.h

Log:
MERGE to: http://svn.freeswitch.org/svn/freeswitch/tags/1.0.1

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.2008.sln
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.2008.sln	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.2008.sln	Mon Aug  4 21:29:58 2008
@@ -863,6 +863,104 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmltok", "libs\xmlrpc-c\Windows\xmltok.2008.vcproj", "{B535402E-38D2-4D54-8360-423ACBD17192}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download sphinxbase", "libs\win32\Download sphinxbase.2008.vcproj", "{4F92B672-DADB-4047-8D6A-4BB3796733FD}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download sphinxmodel", "libs\win32\Download sphinxmodel.2008.vcproj", "{2DEE4895-1134-439C-B688-52203E57D878}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download pocketsphinx", "libs\win32\Download pocketsphinx.2008.vcproj", "{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sphinxbase", "libs\win32\sphinxbase\sphinxbase.2008.vcproj", "{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}"
+	ProjectSection(ProjectDependencies) = postProject
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD} = {4F92B672-DADB-4047-8D6A-4BB3796733FD}
+		{2DEE4895-1134-439C-B688-52203E57D878} = {2DEE4895-1134-439C-B688-52203E57D878}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pocketsphinx", "libs\win32\pocketsphinx\pocketsphinx.2008.vcproj", "{94001A0E-A837-445C-8004-F918F10D0226}"
+	ProjectSection(ProjectDependencies) = postProject
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D} = {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E} = {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_pocketsphinx", "src\mod\asr_tts\mod_pocketsphinx\mod_pocketsphinx.2008.vcproj", "{2286DA73-9FC5-45BC-A508-85994C3317AB}"
+	ProjectSection(ProjectDependencies) = postProject
+		{94001A0E-A837-445C-8004-F918F10D0226} = {94001A0E-A837-445C-8004-F918F10D0226}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD} = {4F92B672-DADB-4047-8D6A-4BB3796733FD}
+		{2DEE4895-1134-439C-B688-52203E57D878} = {2DEE4895-1134-439C-B688-52203E57D878}
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D} = {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E} = {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download 8khzsound", "libs\win32\Download 8khz Sounds.2008.vcproj", "{3CE1DC99-8246-4DB1-A709-74F19F08EC67}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sound Files", "Sound Files", "{4F227C26-768F-46A3-8684-1D08A46FB374}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download 16khzsound", "libs\win32\Download 16khz Sounds.2008.vcproj", "{87A1FE3D-F410-4C8E-9591-8C625985BC70}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "8khz", "libs\win32\Sound_Files\8khz.2008.vcproj", "{7A8D8174-B355-4114-AFC1-04777CB9DE0A}"
+	ProjectSection(ProjectDependencies) = postProject
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67} = {3CE1DC99-8246-4DB1-A709-74F19F08EC67}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16khz", "libs\win32\Sound_Files\16khz.2008.vcproj", "{7EB71250-F002-4ED8-92CA-CA218114537A}"
+	ProjectSection(ProjectDependencies) = postProject
+		{87A1FE3D-F410-4C8E-9591-8C625985BC70} = {87A1FE3D-F410-4C8E-9591-8C625985BC70}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download 32khzsound", "libs\win32\Dowload 32khz Sounds.2008.vcproj", "{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "32khz", "libs\win32\Sound_Files\32khz.2008.vcproj", "{464AAB78-5489-4916-BE51-BF8D61822311}"
+	ProjectSection(ProjectDependencies) = postProject
+		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F} = {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flite", "libs\win32\flite\flite.2008.vcproj", "{0AD1177E-1FD8-4643-9391-431467A11084}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_flite", "src\mod\asr_tts\mod_flite\mod_flite.2008.vcproj", "{66444AEE-554C-11DD-A9F0-8C5D56D89593}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B} = {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}
+		{0AD1177E-1FD8-4643-9391-431467A11084} = {0AD1177E-1FD8-4643-9391-431467A11084}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download FLITE", "libs\win32\Download FLITE.2008.vcproj", "{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download LAME", "libs\win32\Download LAME.2008.vcproj", "{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download LIBSHOUT", "libs\win32\Download LIBSHOUT.2008.vcproj", "{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download OGG", "libs\win32\Download OGG.2008.vcproj", "{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp3lame", "libs\win32\libmp3lame\libmp3lame_vc7.vcproj", "{E316772F-5D8F-4F2A-8F71-094C3E859D34}"
+	ProjectSection(ProjectDependencies) = postProject
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B} = {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libshout", "libs\win32\libshout\libshout.vcproj", "{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}"
+	ProjectSection(ProjectDependencies) = postProject
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B} = {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B} = {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B} = {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4} = {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_shout", "src\mod\formats\mod_shout\mod_shout.vcproj", "{38FE0559-9910-43A8-9E45-3E5004C27692}"
+	ProjectSection(ProjectDependencies) = postProject
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5} = {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34} = {E316772F-5D8F-4F2A-8F71-094C3E859D34}
+		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libogg", "libs\win32\libogg\libogg.2008.vcproj", "{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_snom", "src\mod\applications\mod_snom\mod_snom.2008.vcproj", "{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -974,6 +1072,7 @@
 		{692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|Win32.ActiveCfg = Debug|Win32
 		{692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x64.ActiveCfg = Debug|Win32
 		{692F6330-4D87-4C82-81DF-40DB5892636E}.Release|Win32.ActiveCfg = Release|Win32
+		{692F6330-4D87-4C82-81DF-40DB5892636E}.Release|Win32.Build.0 = Release|Win32
 		{692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64.ActiveCfg = Release|Win32
 		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.Build.0 = Debug|Win32
@@ -1449,6 +1548,120 @@
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.ActiveCfg = Release|Win32
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.Build.0 = Release|Win32
 		{B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.ActiveCfg = Release|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.Build.0 = Debug|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x64.ActiveCfg = Debug|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.ActiveCfg = Release|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.Build.0 = Release|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x64.ActiveCfg = Release|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.Debug|Win32.ActiveCfg = Debug|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.Debug|Win32.Build.0 = Debug|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.Debug|x64.ActiveCfg = Debug|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.Release|Win32.ActiveCfg = Release|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.Release|Win32.Build.0 = Release|Win32
+		{2DEE4895-1134-439C-B688-52203E57D878}.Release|x64.ActiveCfg = Release|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|Win32.ActiveCfg = Debug|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|Win32.Build.0 = Debug|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x64.ActiveCfg = Debug|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|Win32.ActiveCfg = Release|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|Win32.Build.0 = Release|Win32
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x64.ActiveCfg = Release|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|Win32.Build.0 = Debug|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x64.ActiveCfg = Debug|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|Win32.ActiveCfg = Release|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|Win32.Build.0 = Release|Win32
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64.ActiveCfg = Release|Win32
+		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|Win32.ActiveCfg = Debug|Win32
+		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|Win32.Build.0 = Debug|Win32
+		{94001A0E-A837-445C-8004-F918F10D0226}.Debug|x64.ActiveCfg = Debug|Win32
+		{94001A0E-A837-445C-8004-F918F10D0226}.Release|Win32.ActiveCfg = Release|Win32
+		{94001A0E-A837-445C-8004-F918F10D0226}.Release|Win32.Build.0 = Release|Win32
+		{94001A0E-A837-445C-8004-F918F10D0226}.Release|x64.ActiveCfg = Release|Win32
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|Win32.ActiveCfg = Debug|Win32
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|Win32.Build.0 = Debug|Win32
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x64.ActiveCfg = Debug|Win32
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|Win32.ActiveCfg = Release|Win32
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|Win32.Build.0 = Release|Win32
+		{2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64.ActiveCfg = Release|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|Win32.ActiveCfg = Debug|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|Win32.Build.0 = Debug|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x64.ActiveCfg = Debug|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|Win32.ActiveCfg = Release|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|Win32.Build.0 = Release|Win32
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x64.ActiveCfg = Release|Win32
+		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|Win32.ActiveCfg = Debug|Win32
+		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|x64.ActiveCfg = Debug|Win32
+		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|Win32.ActiveCfg = Release|Win32
+		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|Win32.Build.0 = Release|Win32
+		{87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|x64.ActiveCfg = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.Build.0 = Debug|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.ActiveCfg = Debug|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.ActiveCfg = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.Build.0 = Release|Win32
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.ActiveCfg = Release|Win32
+		{7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|x64.ActiveCfg = Debug|Win32
+		{7EB71250-F002-4ED8-92CA-CA218114537A}.Release|Win32.ActiveCfg = Release|Win32
+		{7EB71250-F002-4ED8-92CA-CA218114537A}.Release|Win32.Build.0 = Release|Win32
+		{7EB71250-F002-4ED8-92CA-CA218114537A}.Release|x64.ActiveCfg = Release|Win32
+		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|Win32.ActiveCfg = Debug|Win32
+		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|x64.ActiveCfg = Debug|Win32
+		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|Win32.ActiveCfg = Release|Win32
+		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|Win32.Build.0 = Release|Win32
+		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|x64.ActiveCfg = Release|Win32
+		{464AAB78-5489-4916-BE51-BF8D61822311}.Debug|Win32.ActiveCfg = Debug|Win32
+		{464AAB78-5489-4916-BE51-BF8D61822311}.Debug|x64.ActiveCfg = Debug|Win32
+		{464AAB78-5489-4916-BE51-BF8D61822311}.Release|Win32.ActiveCfg = Release|Win32
+		{464AAB78-5489-4916-BE51-BF8D61822311}.Release|Win32.Build.0 = Release|Win32
+		{464AAB78-5489-4916-BE51-BF8D61822311}.Release|x64.ActiveCfg = Release|Win32
+		{0AD1177E-1FD8-4643-9391-431467A11084}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x64.ActiveCfg = Debug|Win32
+		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|Win32.ActiveCfg = Release|Win32
+		{0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64.ActiveCfg = Release|Win32
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|Win32.ActiveCfg = Debug|Win32
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|x64.ActiveCfg = Debug|Win32
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|Win32.ActiveCfg = Release|Win32
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|Win32.ActiveCfg = Release|Win32
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x64.ActiveCfg = Release|Win32
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x64.ActiveCfg = Debug|Win32
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|Win32.ActiveCfg = Release|Win32
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64.ActiveCfg = Release|Win32
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x64.ActiveCfg = Debug|Win32
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|Win32.ActiveCfg = Release|Win32
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64.ActiveCfg = Release|Win32
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|Win32.ActiveCfg = Debug|Win32
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x64.ActiveCfg = Debug|Win32
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|Win32.ActiveCfg = Release|Win32
+		{38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64.ActiveCfg = Release|Win32
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x64.ActiveCfg = Debug|Win32
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.ActiveCfg = Release|Win32
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.ActiveCfg = Release|Win32
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.ActiveCfg = Debug|Win32
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.Build.0 = Debug|Win32
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.ActiveCfg = Debug|Win32
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.ActiveCfg = Release|Win32
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.Build.0 = Release|Win32
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.ActiveCfg = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -1477,6 +1690,7 @@
 		{F6A33240-8F29-48BD-98F0-826995911799} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{65A6273D-FCAB-4C55-B09E-65100141A5D4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{E3246D17-E29B-4AB5-962A-C69B0C5837BB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
 		{A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
 		{E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
@@ -1488,6 +1702,7 @@
 		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
 		{6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
+		{38FE0559-9910-43A8-9E45-3E5004C27692} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723} = {CBD81696-EFB4-4D2F-8451-1B8DAA86155A}
 		{EC3E5C7F-EE09-47E2-80FE-546363D14A98} = {B8F5B47B-8568-46EB-B320-64C17D2A98BC}
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000}
@@ -1499,6 +1714,8 @@
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC} = {0C808854-54D1-4230-BFF5-77B5FD905000}
 		{692F6330-4D87-4C82-81DF-40DB5892636E} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
 		{E7116F50-2B10-472F-92BD-C8667AA9C1AE} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
+		{2286DA73-9FC5-45BC-A508-85994C3317AB} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
+		{66444AEE-554C-11DD-A9F0-8C5D56D89593} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
 		{1C453396-D912-4213-89FD-9B489162B7B5} = {A7AB4405-FDB7-4853-9FBB-1516B1C3D80A}
 		{D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909} = {A7AB4405-FDB7-4853-9FBB-1516B1C3D80A}
 		{CBEC7225-0C21-4DA8-978E-1F158F8AD950} = {F69A4A6B-9360-4EBB-A280-22AA3C455AC5}
@@ -1532,8 +1749,22 @@
 		{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{0D108721-EAE8-4BAF-8102-D8960EC93647} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{B535402E-38D2-4D54-8360-423ACBD17192} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{94001A0E-A837-445C-8004-F918F10D0226} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{E316772F-5D8F-4F2A-8F71-094C3E859D34} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{D3D8B329-20BE-475E-9E83-653CEA0E0EF5} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{5927104D-C14C-4AC8-925C-4AB681762E75} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{2DEE4895-1134-439C-B688-52203E57D878} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{AF8163EE-FA76-4904-A11D-7D70A1B5BA2E} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{3CE1DC99-8246-4DB1-A709-74F19F08EC67} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{87A1FE3D-F410-4C8E-9591-8C625985BC70} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{D5D2BF72-29FE-4982-A9FA-82AB3086DB1B} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{D5D2BF72-29FE-4982-A9FA-82AB1086DB1B} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
@@ -1595,5 +1826,8 @@
 		{FC0DB2A2-B1A3-426E-9E37-BE28FE8FE01B} = {EB577858-8284-4DEA-ADDA-DD046BCA0126}
 		{91C6DEDE-CE4A-47D1-A84B-3E828F82E2B0} = {89A94241-1DA6-44E8-A685-AED1E665C2AD}
 		{8F5A511B-F716-4D07-9657-55B9E4F1D3E9} = {89A94241-1DA6-44E8-A685-AED1E665C2AD}
+		{7A8D8174-B355-4114-AFC1-04777CB9DE0A} = {4F227C26-768F-46A3-8684-1D08A46FB374}
+		{7EB71250-F002-4ED8-92CA-CA218114537A} = {4F227C26-768F-46A3-8684-1D08A46FB374}
+		{464AAB78-5489-4916-BE51-BF8D61822311} = {4F227C26-768F-46A3-8684-1D08A46FB374}
 	EndGlobalSection
 EndGlobal

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am	Mon Aug  4 21:29:58 2008
@@ -21,7 +21,7 @@
 	 soundfile=`echo freeswitch-sounds-$$full_sound_dir-$(SOUNDS_VERSION).tar.gz`; \
          if test "$$target" = "install"; then $(MAKE) $(AM_MAKEFLAGS) core_install; else $(MAKE) $(AM_MAKEFLAGS) core ; fi; \
          if test "$$target_prefix" = "sounds"; then \
-	   if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(PREFIX)/sounds/; else $(GETSOUNDS) $$soundfile ; fi; \
+	   if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(DESTDIR)$(PREFIX)/sounds/; else $(GETSOUNDS) $$soundfile ; fi; \
 	 else \
 	   cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\
 	 fi
@@ -85,7 +85,7 @@
 src/switch_ivr.c \
 src/switch_stun.c\
 src/switch_log.c\
-src/switch_xml.cpp\
+src/switch_xml.c\
 src/switch_config.c\
 src/switch_time.c\
 src/switch_cpp.cpp\
@@ -158,6 +158,11 @@
 $(switch_builddir)/quiet_libtool: $(switch_builddir)/libtool
 	@cat libtool | sed -e 's|$$show "$$command"|if test -z "$$suppress_output" ; then $$show "Compiling $$srcfile ..." ; fi|' > quiet_libtool
 
+
+yaml-files:
+	@echo `mkdir $(DESTDIR)$(prefix)/conf/yaml 2>/dev/null`
+	$(INSTALL) -m 644 conf/yaml/*.yaml $(DESTDIR)$(prefix)/conf/yaml
+
 vm-sync:
 	test -d $(DESTDIR)$(prefix)/conf || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf
 	test -d $(DESTDIR)$(prefix)/conf/lang || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/lang
@@ -275,6 +280,15 @@
 	$(MAKE) -j core
 	$(MAKE) -j modules
 
+python-reconf:
+	rm -f src/mod/languages/mod_python/Makefile
+	./config.status
+
+pa-reconf:
+	cd libs/portaudio && $(MAKE) clean
+	cd libs/portaudio && sh ./configure.gnu
+	$(MAKE) mod_portaudio-clean
+
 sofia-reconf:
 	cd libs/sofia-sip && sh ./autogen.sh
 	cd libs/sofia-sip && $(MAKE) clean

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modmake.rules.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modmake.rules.in	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modmake.rules.in	Mon Aug  4 21:29:58 2008
@@ -103,9 +103,9 @@
 	@test -d .libs || mkdir .libs
 	@error="";\
 	if test -f $(CSOURCEFILE); then \
-	$(LINK) $(SOLINK) $(MODNAME).o -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LINK_OUTPUT_REDIR) ;\
+	$(LINK) $(SOLINK) $(MODNAME).o $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LINK_OUTPUT_REDIR) ;\
 	else \
-	$(CXXLINK) $(SOLINK) $(MODNAME).o -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LINK_OUTPUT_REDIR) ;\
+	$(CXXLINK) $(SOLINK) $(MODNAME).o $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LINK_OUTPUT_REDIR) ;\
 	fi;
 
 mod_clean:

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modules.conf.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modules.conf.in	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modules.conf.in	Mon Aug  4 21:29:58 2008
@@ -13,6 +13,9 @@
 applications/mod_fsv
 #applications/mod_soundtouch
 #applications/mod_rss
+#applications/mod_snom
+#asr_tts/mod_flite
+#asr_tts/mod_pocketsphinx
 #asr_tts/mod_cepstral
 #asr_tts/mod_openmrcp
 codecs/mod_g723_1
@@ -49,8 +52,9 @@
 languages/mod_spidermonkey_core_db
 languages/mod_spidermonkey_socket
 #languages/mod_spidermonkey_odbc
-#languages/mod_lua
+languages/mod_lua
 #languages/mod_perl
+#languages/mod_yaml
 xml_int/mod_xml_rpc
 #xml_int/mod_xml_curl
 xml_int/mod_xml_cdr
@@ -61,3 +65,4 @@
 #say/mod_say_fr
 #say/mod_say_it
 #say/mod_say_nl
+#say/mod_say_zh

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/build/swigall.sh
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/build/swigall.sh	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/build/swigall.sh	Mon Aug  4 21:29:58 2008
@@ -9,7 +9,8 @@
 cd ../../../..
 
 cd src/mod/languages/mod_python
-make reswig
+make swigclean
+make mod_python_wrap.cpp
 cd ../../../..
 
 cd src/mod/languages/mod_java

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/acl.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/acl.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/acl.conf.xml	Mon Aug  4 21:29:58 2008
@@ -19,6 +19,11 @@
     <list name="strict" default="deny">
       <node type="allow" cidr="208.102.123.124/32"/>
     </list>
+
+    <list name="domains" default="deny">
+      <node type="allow" domain="$${domain}"/>
+    </list>
+
   </network-lists>
 </configuration>
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/cdr_csv.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/cdr_csv.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/cdr_csv.conf.xml	Mon Aug  4 21:29:58 2008
@@ -6,11 +6,14 @@
     <!-- This is like the info app but after the call is hung up -->
     <!--<param name="debug" value="true"/>-->
     <param name="rotate-on-hup" value="true"/>
+    <!-- may be a b or ab -->
+    <param name="legs" value="a"/>
   </settings>
   <templates>
     <template name="sql">INSERT INTO cdr VALUES ("${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}");</template>
     <template name="example">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}","${read_codec}","${write_codec}"</template>
     <template name="snom">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}","${read_codec}","${write_codec}","${sip_user_agent}","${call_clientcode}","${sip_rtp_rxstat}","${sip_rtp_txstat}","${sofia_record_file}"</template>
+    <template name="linksys">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}","${sip_user_agent}","${sip_p_rtp_stat}"</template>
     <template name="asterisk">"${accountcode}","${caller_id_number}","${destination_number}","${context}","${caller_id}","${channel_name}","${bridge_channel}","${last_app}","${last_arg}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${amaflags}","${uuid}","${userfield}"</template>
   </templates>
 </configuration>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/conference.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/conference.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/conference.conf.xml	Mon Aug  4 21:29:58 2008
@@ -94,6 +94,11 @@
       <!-- <param name="suppress-events" value="start-talking,stop-talking"/> -->
       <!-- enable comfort noise generation -->
       <param name="comfort-noise" value="true"/>
+      <!-- Uncomment auto-record to toggle recording every conference call. -->
+      <!-- Another valid value is   shout://user:pass@server.com/live.mp3   -->
+      <!--
+      <param name="auto-record" value="/usr/local/freeswitch/sounds/conference/${conference_name}_${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
+      -->
     </profile>
 
     <profile name="wideband">

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/console.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/console.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/console.conf.xml	Mon Aug  4 21:29:58 2008
@@ -30,7 +30,7 @@
         <map name="mod_local_stream.c" value="warning,debug"/>
         <map name="mod_sndfile.c" value="warning,info,debug"/>
      -->
-    <map name="all" value="debug,info,notice,warning,err,crit,alert"/>
+    <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/>
     
     <!--
       You can use or modify this sample set of mappings.  It turns on higher

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/enum.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/enum.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/enum.conf.xml	Mon Aug  4 21:29:58 2008
@@ -8,7 +8,7 @@
 
   <routes>
     <route service="E2U+SIP" regex="sip:(.*)" replace="sofia/${use_profile}/$1"/>
-    <route service="E2U+IAX2" regex="iax2:(.*)" replace="iax/$1"/>
-    <route service="E2U+XMPP" regex="XMPP:(.*)" replace="dingaling/$${xmpp_server_profile}/$1"/>
+    <!--<route service="E2U+IAX2" regex="iax2:(.*)" replace="iax/$1"/>-->
+    <!--<route service="E2U+XMPP" regex="XMPP:(.*)" replace="dingaling/$${xmpp_server_profile}/$1"/>-->
   </routes>
 </configuration>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/ivr.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/ivr.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/ivr.conf.xml	Mon Aug  4 21:29:58 2008
@@ -1,56 +1,57 @@
-<configuration name="ivr.conf" description="IVR menus">
-  <menus>
-    <!-- demo IVR setup -->
-    <!-- demo IVR, Main Menu -->
-    <menu name="demo_ivr"
-          greet-long="phrase:demo_ivr_main_menu"
-          greet-short="phrase:demo_ivr_main_menu_short"
-          invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
-          exit-sound="voicemail/vm-goodbye.wav"
-          timeout ="10000"
-	  inter-digit-timeout="2000"
-	  max-failures="3"
-	  digit-len="4">
-      <entry action="menu-exec-app" digits="1" param="bridge sofia/$${domain}/888 at conference.freeswitch.org"/>
-      <entry action="menu-exec-app" digits="2" param="transfer 9996 XML default"/>    <!-- FS echo -->
-      <entry action="menu-exec-app" digits="3" param="transfer 9999 XML default"/>    <!-- MOH -->
-      <entry action="menu-sub" digits="4" param="demo_ivr_submenu"/>  <!-- demo sub menu -->
-      <entry action="menu-exec-app" digits="5" param="transfer 1234*256 enum"/>    <!-- Screaming monkeys -->
-      <entry action="menu-exec-app" digits="/^(10[01][0-9])$/" param="transfer $1 XML default"/> 
-      <entry action="menu-top" digits="9" param="demo_ivr"/>          <!-- Repeat this menu -->
-    </menu>
-    <!-- Demo IVR, Sub Menu -->
-    <menu name="demo_ivr_submenu"
-        greet-long="phrase:demo_ivr_sub_menu"
-        greet-short="phrase:demo_ivr_sub_menu_short"
-        invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
-        exit-sound="voicemail/vm-goodbye.wav"
-        timeout="15000"
-        max-failures="3">
-      <entry action="menu-top" digits="*"/>
-     </menu>
-
-  </menus>
-
-
-</configuration>
-
-
-<!-- TTS sample; non-functional but it demonstrates say: and TTS -->
-<!--
-    <menu name="demo3"
-          greet-long="say:Press 1 to join the conference, Press 2 to join the other conference"
-          greet-short="say:Press 1 to join the conference, Press 2 to join the other conference"
-          invalid-sound="say:invalid extension"
-          exit-sound="say:exit sound"
-          timeout ="15000"
-          max-failures="3">
-      <entry action="menu-exit" digits="*"/>
-      <entry action="menu-playback" digits="1" param="say:You pressed 1"/>
-      <entry action="menu-call-transfer" digits="2" param=
-
-
-"1000"/>
-      <entry action="menu-call-transfer" digits="3" param="1001"/>
-    </menu>
--->
+<?xml version="1.0" encoding="Windows-1252"?>
+<configuration name="ivr.conf" description="IVR menus">
+  <menus>
+    <!-- demo IVR setup -->
+    <!-- demo IVR, Main Menu -->
+    <menu name="demo_ivr"
+          greet-long="phrase:demo_ivr_main_menu"
+          greet-short="phrase:demo_ivr_main_menu_short"
+          invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
+          exit-sound="voicemail/vm-goodbye.wav"
+          timeout ="10000"
+	  inter-digit-timeout="2000"
+	  max-failures="3"
+	  digit-len="4">
+      <entry action="menu-exec-app" digits="1" param="bridge sofia/$${domain}/888 at conference.freeswitch.org"/>
+      <entry action="menu-exec-app" digits="2" param="transfer 9996 XML default"/>    <!-- FS echo -->
+      <entry action="menu-exec-app" digits="3" param="transfer 9999 XML default"/>    <!-- MOH -->
+      <entry action="menu-sub" digits="4" param="demo_ivr_submenu"/>  <!-- demo sub menu -->
+      <entry action="menu-exec-app" digits="5" param="transfer 1234*256 enum"/>    <!-- Screaming monkeys -->
+      <entry action="menu-exec-app" digits="/^(10[01][0-9])$/" param="transfer $1 XML default"/> 
+      <entry action="menu-top" digits="9"/>          <!-- Repeat this menu -->
+    </menu>
+    <!-- Demo IVR, Sub Menu -->
+    <menu name="demo_ivr_submenu"
+        greet-long="phrase:demo_ivr_sub_menu"
+        greet-short="phrase:demo_ivr_sub_menu_short"
+        invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
+        exit-sound="voicemail/vm-goodbye.wav"
+        timeout="15000"
+        max-failures="3">
+      <entry action="menu-top" digits="*"/>
+     </menu>
+
+  </menus>
+
+
+</configuration>
+
+
+<!-- TTS sample; non-functional but it demonstrates say: and TTS -->
+<!--
+    <menu name="demo3"
+          greet-long="say:Press 1 to join the conference, Press 2 to join the other conference"
+          greet-short="say:Press 1 to join the conference, Press 2 to join the other conference"
+          invalid-sound="say:invalid extension"
+          exit-sound="say:exit sound"
+          timeout ="15000"
+          max-failures="3">
+      <entry action="menu-exit" digits="*"/>
+      <entry action="menu-playback" digits="1" param="say:You pressed 1"/>
+      <entry action="menu-call-transfer" digits="2" param=
+
+
+"1000"/>
+      <entry action="menu-call-transfer" digits="3" param="1001"/>
+    </menu>
+-->

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/lua.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/lua.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/lua.conf.xml	Mon Aug  4 21:29:58 2008
@@ -2,5 +2,14 @@
   <settings>
     <!--<param name="xml-handler-script" value="/dp.lua"/>-->
     <!--<param name="xml-handler-bindings" value="dialplan"/>-->
+
+    <!--
+	The following options identifies a lua script that is launched
+	at startup and may live forever in the background.
+	You can define multiple lines, one for each script you 
+	need to run.
+    -->
+    <!--<param name="startup-script" value="startup_script_1.lua"/>-->
+    <!--<param name="startup-script" value="startup_script_2.lua"/>-->
   </settings>
 </configuration>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml	Mon Aug  4 21:29:58 2008
@@ -6,6 +6,8 @@
     <load module="mod_logfile"/>
     <!-- <load module="mod_syslog"/> -->
 
+    <!--<load module="mod_yaml"/>-->
+
     <!-- Multi-Faceted -->
     <!-- mod_enum is a dialplan interface, an application interface and an api command interface -->
     <load module="mod_enum"/>
@@ -19,7 +21,6 @@
     <load module="mod_cdr_csv"/>
     <!-- <load module="mod_event_multicast"/> -->
     <load module="mod_event_socket"/>
-    <!-- <load module="mod_xmpp_event"/> -->
     <!-- <load module="mod_zeroconf"/> -->
 
     <!-- Directory Interfaces -->
@@ -46,6 +47,9 @@
     <load module="mod_esf"/>
     <load module="mod_fsv"/>
 
+    <!-- SNOM Module -->
+    <!--<load module="mod_snom"/>-->
+
     <!-- Dialplan Interfaces -->
     <!-- <load module="mod_dialplan_directory"/> -->
     <load module="mod_dialplan_xml"/>
@@ -76,14 +80,17 @@
     <!-- <load module="mod_perl"/> -->
     <!-- <load module="mod_python"/> -->
     <!-- <load module="mod_java"/> -->
-    <!-- <load module="mod_lua"/> -->
+    <load module="mod_lua"/>
 
     <!-- ASR /TTS -->
+    <!-- <load module="mod_flite"/> -->
+    <!-- <load module="mod_pocketsphinx"/> -->
     <!-- <load module="mod_cepstral"/> -->
     <!-- <load module="mod_openmrcp"/> -->
     <!-- <load module="mod_rss"/> -->
     
     <!-- Say -->
     <load module="mod_say_en"/>
+    <!-- <load module="mod_say_zh"/> -->
   </modules>
 </configuration>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/openmrcp.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/openmrcp.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/openmrcp.conf.xml	Mon Aug  4 21:29:58 2008
@@ -1,10 +1,11 @@
-<!-- http://wiki.freeswitch.org/wiki/Mod_openmrcp#Configuration -->
-<configuration name="openmrcp.conf" description="mod_openmrcp configuration">
-  <settings>
-    <param name="asr_default_profile" value="openmrcp-v2"/>
-    <param name="tts_default_profile" value="openmrcp-v2"/>
-  </settings>
-  <profiles>
-    <X-PRE-PROCESS cmd="include" data="../mrcp_profiles/*.xml"/>
-  </profiles>
-</configuration>
+<?xml version="1.0" encoding="Windows-1252"?>
+<!-- http://wiki.freeswitch.org/wiki/Mod_openmrcp#Configuration -->
+<configuration name="openmrcp.conf" description="mod_openmrcp configuration">
+  <settings>
+    <param name="asr_default_profile" value="openmrcp-v2"/>
+    <param name="tts_default_profile" value="openmrcp-v2"/>
+  </settings>
+  <profiles>
+    <X-PRE-PROCESS cmd="include" data="../mrcp_profiles/*.xml"/>
+  </profiles>
+</configuration>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/perl.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/perl.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/perl.conf.xml	Mon Aug  4 21:29:58 2008
@@ -2,5 +2,15 @@
   <settings>
     <!--<param name="xml-handler-script" value="/tmp/xml.pl"/>-->
     <!--<param name="xml-handler-bindings" value="dialplan"/>-->
+
+    <!--
+	The following options identifies a perl script that is launched	
+	at startup and may live forever in the background.
+	You can define multiple lines, one for each script you 
+	need to run.
+    -->
+    <!--param name="startup-script" value="startup_script_1.pl"/-->
+    <!--param name="startup-script" value="startup_script_2.pl"/-->
+
   </settings>
 </configuration>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/switch.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/switch.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/switch.conf.xml	Mon Aug  4 21:29:58 2008
@@ -16,6 +16,8 @@
   </cli-keybindings> 
   
   <settings>
+    <!--Colorize the Console -->
+    <param name="colorize-console" value="true"/>
     <!--Most channels to allow at once -->
     <param name="max-sessions" value="1000"/>
     <!--Most channels to create per second -->
@@ -26,6 +28,32 @@
     <param name="crash-protection" value="false"/>
     <!--<param name="max_dtmf_duration" value="192000"/>-->
     <!--<param name="default_dtmf_duration" value="8000"/>-->
+    <!--
+         If you want to send out voicemail notifications via Windows you'll need to change the mailer-app
+         variable to the setting below:
+     
+       <param name="mailer-app" value="msmtp"/>
+ 
+         Donot change mailer-app-args.
+         You will also need to download a sendmail clone for Windows (msmtp). This version works without issue:
+         http://msmtp.sourceforge.net/index.html. Download and copy the .exe to %winddir%\system32.
+         You'll need to create a small config file for smtp credentials (host name, authentication, tls, etc.) in
+         %USERPROFILE%\Application Data\ called "msmtprc.txt". Below is a sample copy of this file:
+ 
+         ###################################
+         # The SMTP server of the provider.
+         account provider
+         host smtp.myisp.com
+         from john at myisp.com
+         auth login
+         user johndoe
+         password mypassword
+ 
+         # Set a default account
+         account default : provider
+       ###################################
+         
+ -->    
     <param name="mailer-app" value="sendmail"/>
     <param name="mailer-app-args" value="-t"/>
     <param name="dump-cores" value="yes"/>
@@ -33,12 +61,6 @@
     <!--<param name="rtp-start-port" value="16384"/>-->
     <!--<param name="rtp-end-port" value="32768"/>-->
   </settings>
-  <!--Any variables defined here will be available in every channel, in the dialplan etc -->
-  <variables>
-    <variable name="uk-ring" value="%(400,200,400,450);%(400,2200,400,450)"/>
-    <variable name="us-ring" value="%(2000, 4000, 440.0, 480.0)"/>
-    <variable name="fr-ring" value="%(1500, 3500, 440.0, 0.0)"/>
-    <variable name="bong-ring" value="v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
-  </variables>
+
 </configuration>
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/syslog.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/syslog.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/syslog.conf.xml	Mon Aug  4 21:29:58 2008
@@ -10,6 +10,6 @@
   <!-- debug   - debug-level message -->
   <settings>
     <param name="ident" value="freeswitch"/>
-    <param name="format" value="${time} - ${message}"/>
+    <param name="loglevel" value="warning"/>
   </settings>
 </configuration>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml	Mon Aug  4 21:29:58 2008
@@ -43,6 +43,7 @@
       <param name="vmain-key" value="*"/>
       <email>
 	<param name="template-file" value="voicemail.tpl"/>
+	<param name="notify-template-file" value="notify-voicemail.tpl"/>
 	<!-- this is the format voicemail_time will have -->
         <param name="date-fmt" value="%A, %B %d %Y, %I %M %p"/>
         <param name="email-from" value="${voicemail_account}@${voicemail_domain}"/>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_cdr.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_cdr.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_cdr.conf.xml	Mon Aug  4 21:29:58 2008
@@ -1,39 +1,40 @@
-<configuration name="xml_cdr.conf" description="XML CDR CURL logger">
-  <settings>
-    <!-- the url to post to if blank web posting is disabled  -->
-    <!-- <param name="url" value="http://localhost/cdr_curl/post.php"/> -->
-
-    <!-- optional: credentials to send to web server -->
-    <!--    <param name="cred" value="user:pass"/> -->
-
-    <!-- the total number of retries (not counting the first 'try') to post to webserver incase of failure -->
-    <!-- <param name="retries" value="2"/> -->
-
-    <!-- delay between retries in seconds, default is 5 seconds -->
-    <!-- <param name="delay" value="1"/> -->
-
-    <!-- optional: if not present we do not log every record to disk -->
-    <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank value will default to ${prefix}/logs/xml_cdr -->
-    <param name="log-dir" value=""/>
-
-    <!-- optional: if not present we do log the b leg -->
-    <!-- true or false if we should create a cdr for the b leg of a call-->
-    <param name="log-b-leg" value="false"/>
-    
-
-    <!-- encode the post data may be 'true' for url encoding, 'false' for no encoding or 'base64' for base64 encoding -->
-    <param name="encode" value="true"/>
-
-    <!-- optional: set to true to disable Expect: 100-continue lighttpd requires this setting --> 
-    <!--<param name="disable-100-continue" value="true"/>--> 
-    
-    <!-- optional: full path to the error log dir for failed web posts if not specified its the same as log-dir -->
-    <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr -->
-    <!-- <param name="err-log-dir" value="/tmp"/> -->
-
-    <!-- optional: if enabled this will disable CA root certificate checks by libcurl -->
-    <!-- note: default value is disabled. only enable if you want this! -->
-    <!-- <param name="ignore-cacert-check" value="true" /> -->
-
-  </settings>
-</configuration>
+<?xml version="1.0" encoding="Windows-1252"?>
+<configuration name="xml_cdr.conf" description="XML CDR CURL logger">
+  <settings>
+    <!-- the url to post to if blank web posting is disabled  -->
+    <!-- <param name="url" value="http://localhost/cdr_curl/post.php"/> -->
+
+    <!-- optional: credentials to send to web server -->
+    <!--    <param name="cred" value="user:pass"/> -->
+
+    <!-- the total number of retries (not counting the first 'try') to post to webserver incase of failure -->
+    <!-- <param name="retries" value="2"/> -->
+
+    <!-- delay between retries in seconds, default is 5 seconds -->
+    <!-- <param name="delay" value="1"/> -->
+
+    <!-- optional: if not present we do not log every record to disk -->
+    <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank value will default to ${prefix}/logs/xml_cdr -->
+    <param name="log-dir" value=""/>
+
+    <!-- optional: if not present we do log the b leg -->
+    <!-- true or false if we should create a cdr for the b leg of a call-->
+    <param name="log-b-leg" value="false"/>
+    
+
+    <!-- encode the post data may be 'true' for url encoding, 'false' for no encoding or 'base64' for base64 encoding -->
+    <param name="encode" value="true"/>
+
+    <!-- optional: set to true to disable Expect: 100-continue lighttpd requires this setting --> 
+    <!--<param name="disable-100-continue" value="true"/>--> 
+    
+    <!-- optional: full path to the error log dir for failed web posts if not specified its the same as log-dir -->
+    <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr -->
+    <!-- <param name="err-log-dir" value="/tmp"/> -->
+
+    <!-- optional: if enabled this will disable CA root certificate checks by libcurl -->
+    <!-- note: default value is disabled. only enable if you want this! -->
+    <!-- <param name="ignore-cacert-check" value="true" /> -->
+
+  </settings>
+</configuration>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/dialplan/default.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/dialplan/default.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/dialplan/default.xml	Mon Aug  4 21:29:58 2008
@@ -64,6 +64,29 @@
       </condition>
     </extension>
 
+
+    <!--
+	snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
+    -->
+
+    <extension name="snom-demo-2">
+      <condition field="destination_number" expression="^9001$">
+	<action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
+	<action application="transfer" data="3000"/>
+      </condition>
+    </extension>
+    
+    <extension name="snom-demo-1">
+      <condition field="destination_number" expression="^9000$">
+	<!--<key> <light> <label> <user> <host> <profile> <action_name> <action>-->
+	<action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
+	<action application="playback" data="$${hold_music}"/>
+      </condition>
+    </extension>
+
+
+
+
     <extension name="eavesdrop">
       <condition field="destination_number" expression="^88(.*)$|^\*0(.*)$">
 	<action application="answer"/>
@@ -105,14 +128,14 @@
 
     <extension name="call-group-simo">
       <condition field="destination_number" expression="^82(\d{2})$">
-	<action application="bridge" data="${group(call:$1)}"/>
+	<action application="bridge" data="{ignore_early_media=true}${group(call:$1)}"/>
       </condition>
     </extension>
 
     <extension name="call-group-order">
       <condition field="destination_number" expression="^83(\d{2})$">
 	<action application="set" data="call_timeout=10"/>
-	<action application="bridge" data="${group(call:$1:order)}"/>
+	<action application="bridge" data="{ignore_early_media=true}${group(call:$1:order)}"/>
       </condition>
     </extension>
 
@@ -270,6 +293,15 @@
       </condition>
     </extension>
 
+    <extension name="show_info">
+      <condition field="destination_number" expression="^9992$">
+	<action application="answer"/>
+	<action application="info"/>
+	<action application="sleep" data="250"/>
+	<action application="hangup"/>
+      </condition>
+    </extension>
+
     <extension name="video_record">
       <condition field="destination_number" expression="^9993$">
 	<action application="answer"/>
@@ -361,11 +393,6 @@
       </condition>
     </extension>
     -->
-    <extension name="enum">
-      <condition field="destination_number" expression="^(.*)$">
-	<action application="transfer" data="$1 enum"/>
-      </condition>
-    </extension>
 
   </context>
 </include>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/directory/default/brian.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/directory/default/brian.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/directory/default/brian.xml	Mon Aug  4 21:29:58 2008
@@ -1,7 +1,7 @@
 <include>
   <!-- ipauth if you have an ip= in the user attributes ie ip="1.2.3.4"  -->
   <!-- <user id="brian" ip="1.2.3.4"> -->
-  <user id="brian" mailbox="9999"> 
+  <user id="brian" mailbox="9999" cidr="1.2.3.4/24"> 
     <!-- Outbound Registrations Related to this user -->
     <gateways>
       <!--<gateway name="asterlink.com">-->
@@ -50,6 +50,8 @@
       <!--<param name="vm-email-all-messages" value="true"/>-->
       <!-- optionally use this instead if you want to store the hash of user:domain:pass-->
       <!--<param name="a1-hash" value="c6440e5de50b403206989679159de89a"/>-->
+      <!-- What this user is allowed to acces --> 
+      <!--<param name="http-allowed-api" value="crap,jsapi,voicemail,status"/> -->
     </params>
     <variables>
       <!--all variables here will be set on all inbound calls that originate from this user -->
@@ -76,6 +78,8 @@
       <!--<variable name="sip-force-contact" value="NDLB-connectile-dysfunction"/>-->
       <!--<variable name="sip-force-expires" value="10"/>-->
       <!--<variable name="sip-register-gateway" value="cluecon.com"/>-->
+      <!-- Set the file format for a specific user -->
+      <!--<variable name="vm_message_ext" value=".mp3"/> -->
     </variables>
 
     <vcard>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/de/demo/demo.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/de/demo/demo.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/de/demo/demo.xml	Mon Aug  4 21:29:58 2008
@@ -3,9 +3,9 @@
       <input pattern="(.*)">
 	<match>
 	  <action function="execute" data="sleep(1000)"/>
-	  <action function="play-file" data="vm-youhave.wav"/>
+	  <action function="play-file" data="voicemail/vm-you_have.wav"/>
 	  <action function="say" data="$1" method="pronounced" type="items"/>
-	  <action function="play-file" data="vm-messages.wav"/>
+	  <action function="play-file" data="voicemail/vm-messages.wav"/>
 	  <!-- or -->
 	  <!--<action function="speak-text" data="Sie haben $1 Nachrichten"/>-->
 	</match>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo-ivr.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo-ivr.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo-ivr.xml	Mon Aug  4 21:29:58 2008
@@ -1,158 +1,159 @@
-<include><!--This line will be ignored it's here to validate the xml and is optional -->
-
-
-  <macro name="demo_ivr_count">
-    <input pattern="^(\d+)$">
-      <match>
-	<action function="play-file" data="voicemail/vm-you_have.wav"/>
-	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
-	<action function="play-file" data="voicemail/vm-messages.wav"/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="demo_ivr_main_menu"> <!-- See conf/autoload_config/ivr.conf.xml for an example on how to use this macro in an IVR -->
-    <input pattern="(.*)">
-      <match>
-        <!-- string together several existing sound files to create one long greeting -->
-        <action function="play-file" data="ivr/ivr-welcome_to_freeswitch.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-this_ivr_will_let_you_test_features.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-you_may_exit_by_hanging_up.wav"/>
-        <!-- note that you can do more than just play files, e.g. have pauses and do TTS -->
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 1: Call FreeSWITCH conference-->
-        <action function="play-file" data="ivr/ivr-to_call_the_freeswitch_conference.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/1.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 2: Do FreeSWITCH echo test -->
-        <action function="play-file" data="ivr/ivr-to_do_a_freeswitch_echo_test.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/2.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 3: Listen to Music on Hold -->
-        <action function="play-file" data="ivr/ivr-to_listen_to_moh.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/3.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 4: Hear a sample submenu -->
-        <action function="play-file" data="ivr/ivr-to_hear_sample_submenu.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/4.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 5: Listen to screaming monkeys -->
-        <action function="play-file" data="ivr/ivr-to_hear_screaming_monkeys.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/5.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 9: Repeat these options -->
-        <action function="play-file" data="ivr/ivr-to_repeat_these_options.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/9.wav"/>
-        <action function="execute" data="sleep(2000)"/>
-      </match>
-    </input>
-  </macro>
-
-  <!-- The following macro is the same as demo_ivr_main_menu except it is the "short" version -->
-  <!-- The short version has all the options but not the initial greeting -->
-  <macro name="demo_ivr_main_menu_short"> 
-    <input pattern="(.*)">
-      <match>
-        <!-- Menu option 1: Call FreeSWITCH conference-->
-        <action function="execute" data="sleep(1000)"/>
-        <action function="play-file" data="ivr/ivr-to_call_the_freeswitch_conference.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/1.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 2: Do FreeSWITCH echo test -->
-        <action function="play-file" data="ivr/ivr-to_do_a_freeswitch_echo_test.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/2.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 3: Listen to Music on Hold -->
-        <action function="play-file" data="ivr/ivr-to_listen_to_moh.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/3.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 4: Hear a sample submenu -->
-        <action function="play-file" data="ivr/ivr-to_hear_sample_submenu.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/4.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 5: Listen to screaming monkeys -->
-        <action function="play-file" data="ivr/ivr-to_hear_screaming_monkeys.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/5.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option 9: Repeat these options -->
-        <action function="play-file" data="ivr/ivr-to_repeat_these_options.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/9.wav"/>
-        <action function="execute" data="sleep(2000)"/>
-      </match>
-    </input>
-  </macro>
-
-  <!-- The following macro is the "long" greeting for the demo_ivr_sub_menu -->
-  <macro name="demo_ivr_sub_menu">
-    <input pattern="(.*)">
-      <match>
-        <action function="play-file" data="ivr/ivr-welcome_to_freeswitch.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-sample_submenu.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <!-- Menu option *: Return to top menu -->
-        <action function="play-file" data="ivr/ivr-to_return_to_previous_menu.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/star.wav"/>
-        <action function="execute" data="sleep(250)"/>
-      </match>
-    </input>
-  </macro>
-
-  <!-- The following macro is the same as demo_ivr_sub_menu except it is the "short" version -->
-  <!-- The short version has all the options but not the initial greeting -->
-  <macro name="demo_ivr_sub_menu_short"> 
-    <input pattern="(.*)">
-      <match>
-        <!-- Menu option *: Return to top menu -->
-        <action function="play-file" data="ivr/ivr-to_return_to_previous_menu.wav"/>
-        <action function="execute" data="sleep(250)"/>
-        <action function="play-file" data="ivr/ivr-please.wav"/>
-        <action function="play-file" data="voicemail/vm-press.wav"/>
-        <action function="play-file" data="digits/star.wav"/>
-        <action function="execute" data="sleep(250)"/>
-      </match>
-    </input>
-  </macro>
-
-</include><!--This line will be ignored it's here to validate the xml and is optional -->
+<?xml version="1.0" encoding="Windows-1252"?>
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+
+
+  <macro name="demo_ivr_count">
+    <input pattern="^(\d+)$">
+      <match>
+	<action function="play-file" data="voicemail/vm-you_have.wav"/>
+	<action function="say" data="$1" method="pronounced" type="name_spelled"/>
+	<action function="play-file" data="voicemail/vm-messages.wav"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="demo_ivr_main_menu"> <!-- See conf/autoload_config/ivr.conf.xml for an example on how to use this macro in an IVR -->
+    <input pattern="(.*)">
+      <match>
+        <!-- string together several existing sound files to create one long greeting -->
+        <action function="play-file" data="ivr/ivr-welcome_to_freeswitch.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-this_ivr_will_let_you_test_features.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-you_may_exit_by_hanging_up.wav"/>
+        <!-- note that you can do more than just play files, e.g. have pauses and do TTS -->
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option 1: Call FreeSWITCH conference-->
+        <action function="play-file" data="ivr/ivr-to_call_the_freeswitch_conference.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/1.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option 2: Do FreeSWITCH echo test -->
+        <action function="play-file" data="ivr/ivr-to_do_a_freeswitch_echo_test.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/2.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option 3: Listen to Music on Hold -->
+        <action function="play-file" data="ivr/ivr-to_listen_to_moh.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/3.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option 4: Hear a sample submenu -->
+        <action function="play-file" data="ivr/ivr-to_hear_sample_submenu.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/4.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option 5: Listen to screaming monkeys -->
+        <action function="play-file" data="ivr/ivr-to_hear_screaming_monkeys.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/5.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option 9: Repeat these options -->
+        <action function="play-file" data="ivr/ivr-to_repeat_these_options.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/9.wav"/>
+        <action function="execute" data="sleep(2000)"/>
+      </match>
+    </input>
+  </macro>
+
+  <!-- The following macro is the same as demo_ivr_main_menu except it is the "short" version -->
+  <!-- The short version has all the options but not the initial greeting -->
+  <macro name="demo_ivr_main_menu_short"> 
+    <input pattern="(.*)">
+      <match>
+        <!-- Menu option 1: Call FreeSWITCH conference-->
+        <action function="execute" data="sleep(1000)"/>
+        <action function="play-file" data="ivr/ivr-to_call_the_freeswitch_conference.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/1.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option 2: Do FreeSWITCH echo test -->
+        <action function="play-file" data="ivr/ivr-to_do_a_freeswitch_echo_test.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/2.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option 3: Listen to Music on Hold -->
+        <action function="play-file" data="ivr/ivr-to_listen_to_moh.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/3.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option 4: Hear a sample submenu -->
+        <action function="play-file" data="ivr/ivr-to_hear_sample_submenu.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/4.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option 5: Listen to screaming monkeys -->
+        <action function="play-file" data="ivr/ivr-to_hear_screaming_monkeys.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/5.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option 9: Repeat these options -->
+        <action function="play-file" data="ivr/ivr-to_repeat_these_options.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/9.wav"/>
+        <action function="execute" data="sleep(2000)"/>
+      </match>
+    </input>
+  </macro>
+
+  <!-- The following macro is the "long" greeting for the demo_ivr_sub_menu -->
+  <macro name="demo_ivr_sub_menu">
+    <input pattern="(.*)">
+      <match>
+        <action function="play-file" data="ivr/ivr-welcome_to_freeswitch.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-sample_submenu.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <!-- Menu option *: Return to top menu -->
+        <action function="play-file" data="ivr/ivr-to_return_to_previous_menu.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/star.wav"/>
+        <action function="execute" data="sleep(250)"/>
+      </match>
+    </input>
+  </macro>
+
+  <!-- The following macro is the same as demo_ivr_sub_menu except it is the "short" version -->
+  <!-- The short version has all the options but not the initial greeting -->
+  <macro name="demo_ivr_sub_menu_short"> 
+    <input pattern="(.*)">
+      <match>
+        <!-- Menu option *: Return to top menu -->
+        <action function="play-file" data="ivr/ivr-to_return_to_previous_menu.wav"/>
+        <action function="execute" data="sleep(250)"/>
+        <action function="play-file" data="ivr/ivr-please.wav"/>
+        <action function="play-file" data="voicemail/vm-press.wav"/>
+        <action function="play-file" data="digits/star.wav"/>
+        <action function="execute" data="sleep(250)"/>
+      </match>
+    </input>
+  </macro>
+
+</include><!--This line will be ignored it's here to validate the xml and is optional -->

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo.xml	Mon Aug  4 21:29:58 2008
@@ -3,9 +3,9 @@
       <input pattern="(.*)">
 	<match>
 	  <action function="execute" data="sleep(1000)"/>
-	  <action function="play-file" data="vm-youhave.wav"/>
+	  <action function="play-file" data="voicemail/vm-you_have.wav"/>
 	  <action function="say" data="$1" method="pronounced" type="items"/>
-	  <action function="play-file" data="vm-messages.wav"/>
+	  <action function="play-file" data="voicemail/vm-messages.wav"/>
 	  <!-- or -->
 	  <!--<action function="speak-text" data="you have $1 messages"/>-->
 	</match>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/en.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/en.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/en.xml	Mon Aug  4 21:29:58 2008
@@ -1,7 +1,8 @@
-<include>
-  <language name="en" sound-path="$${base_dir}/sounds/en/us/callie" tts-engine="cepstral" tts-voice="callie">
-    <X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
-    <!--voicemail_en_tts is purely implemented with tts, we need a files based implementation too -->
-    <X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>
-  </language>
-</include>
+<?xml version="1.0" encoding="Windows-1252"?>
+<include>
+  <language name="en" sound-path="$${base_dir}/sounds/en/us/callie" tts-engine="cepstral" tts-voice="callie">
+    <X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
+    <!--voicemail_en_tts is purely implemented with tts, we need a files based implementation too -->
+    <X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>
+  </language>
+</include>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/fr/vm/sounds.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/fr/vm/sounds.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/fr/vm/sounds.xml	Mon Aug  4 21:29:58 2008
@@ -1,210 +1,211 @@
-<include><!--This line will be ignored it's here to validate the xml and is optional -->
-  <macro name="voicemail_enter_id">
-    <input pattern="(.*)">
-      <match>
-	<action function="speak-text" data="Entrez votre Identification, suivi par $1."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_enter_pass">
-    <input pattern="(.*)">
-      <match>
-	<action function="speak-text" data="Entrez votre code, suivi par $1."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_fail_auth">
-    <input pattern="(.*)">
-      <match>
-	<action function="speak-text" data="Identification incorrect."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_hello">
-    <input pattern="(.*)">
-      <match>
-	<action function="speak-text" data="Bienvenu sur votre répondeur."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_goodbye">
-    <input pattern="(.*)">
-      <match>
-	<action function="speak-text" data="Aurevoir."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_abort">
-    <input pattern="(.*)">
-      <match>
-	<action function="speak-text" data="Trop de tentatives échouées."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_message_count">
-    <input pattern="^([^:]+):([^:]+):{0,1}(.*)">
-      <match>
-	<action function="speak-text" data="Vous avez $1 $2 message$3 dans le répertoir ${voicemail_current_folder}."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_menu">
-    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
-      <match>
-	<action function="speak-text" 
-		data="Pour écouter les nouveaux message, tappez $1, Pour écouter les messages enregistrés, tappez $2, Pour les options avancées, tappez $3, pour sortir, tappez $4."/>
-      </match>
-    </input>
-  </macro>
-
-
-  <macro name="voicemail_config_menu">
-    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
-      <match>
-	<action function="speak-text" 
-		data="pour enregistrer un message d'accueil, tappez $1, Pour choisir votre message d'accueil, tappez $2, Pour enregistrer votre nom, tappez $3, pour retourner au menu principale, tappez $4."/>
-      </match>
-    </input>
-  </macro>
-
-
-  <macro name="voicemail_record_name">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="enregistrez votre nom au bip, puis tappez une touche ou arretez de parler pour arreter l'enregistrement."/>
-
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_record_file_check">
-    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$">
-      <match>
-	<action function="speak-text" 
-		data="Pour écouter l'enregistrement, tappez $1, pour sauvegarder l'enregistrement, tappez $2, Pour réenregistrer, tappez $3."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_record_urgent_check">
-    <input pattern="^([0-9#*]):([0-9#*])$">
-      <match>
-	<action function="speak-text" 
-		data="Pour indiquer ce messange comme étant urgent, tappez $1, Pour continuer, tappez $2."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_listen_file_check">
-    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
-      <match>
-	<action function="speak-text" 
-		data="Pour réécouter l'enregistrement à nouveau, tappez $1, Pour sauvegarder l'enregistrement, tappez $2,  Pour supprimer l'enregistrement, tappez $3, pour transférer l'enregistrement à votre mail, tappez $4."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_choose_greeting">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="choisissez un message d'accueil entre 1 et 3."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_choose_greeting_fail">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="valeur incorrect."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_record_greeting">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="enregistrez votre message d'accueil au bip, puis tappez une touche ou arretez de parler pour arreter l'enregistrement."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_record_message">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="enregistrez votre message au bip, puis tappez une touche ou arretez de parler pour arreter l'enregistrement."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_greeting_selected">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="message d'accueil numero $1 selectionné."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_play_greeting">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="$1 n'est pas valide."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_say_number">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="$1"/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_say_message_number">
-    <input pattern="^([a-z]+):(.*)$">
-      <match>
-	<action function="speak-text" data="$1 message numero $2."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_say_phone_number">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="$1."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_say_name">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="$1."/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_ack">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="message $1"/>
-      </match>
-    </input>
-  </macro>
-
-  <macro name="voicemail_say_date">
-    <input pattern="^(.*)$">
-      <match>
-	<action function="speak-text" data="$strftime($1|%A, %B %d %Y, %I %M %p)"/>
-      </match>
-    </input>
-  </macro>
-
+<?xml version="1.0" encoding="Windows-1252"?>
+<include><!--This line will be ignored it's here to validate the xml and is optional -->
+  <macro name="voicemail_enter_id">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="Entrez votre Identification, suivi par $1."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_enter_pass">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="Entrez votre code, suivi par $1."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_fail_auth">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="Identification incorrect."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_hello">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="Bienvenu sur votre répondeur."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_goodbye">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="Aurevoir."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_abort">
+    <input pattern="(.*)">
+      <match>
+	<action function="speak-text" data="Trop de tentatives échouées."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_message_count">
+    <input pattern="^([^:]+):([^:]+):{0,1}(.*)">
+      <match>
+	<action function="speak-text" data="Vous avez $1 $2 message$3 dans le répertoir ${voicemail_current_folder}."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_menu">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="speak-text" 
+		data="Pour écouter les nouveaux message, tappez $1, Pour écouter les messages enregistrés, tappez $2, Pour les options avancées, tappez $3, pour sortir, tappez $4."/>
+      </match>
+    </input>
+  </macro>
+
+
+  <macro name="voicemail_config_menu">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="speak-text" 
+		data="pour enregistrer un message d'accueil, tappez $1, Pour choisir votre message d'accueil, tappez $2, Pour enregistrer votre nom, tappez $3, pour retourner au menu principale, tappez $4."/>
+      </match>
+    </input>
+  </macro>
+
+
+  <macro name="voicemail_record_name">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="enregistrez votre nom au bip, puis tappez une touche ou arretez de parler pour arreter l'enregistrement."/>
+
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_file_check">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="speak-text" 
+		data="Pour écouter l'enregistrement, tappez $1, pour sauvegarder l'enregistrement, tappez $2, Pour réenregistrer, tappez $3."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_urgent_check">
+    <input pattern="^([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="speak-text" 
+		data="Pour indiquer ce messange comme étant urgent, tappez $1, Pour continuer, tappez $2."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_listen_file_check">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+      <match>
+	<action function="speak-text" 
+		data="Pour réécouter l'enregistrement à nouveau, tappez $1, Pour sauvegarder l'enregistrement, tappez $2,  Pour supprimer l'enregistrement, tappez $3, pour transférer l'enregistrement à votre mail, tappez $4."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_choose_greeting">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="choisissez un message d'accueil entre 1 et 3."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_choose_greeting_fail">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="valeur incorrect."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_greeting">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="enregistrez votre message d'accueil au bip, puis tappez une touche ou arretez de parler pour arreter l'enregistrement."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_record_message">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="enregistrez votre message au bip, puis tappez une touche ou arretez de parler pour arreter l'enregistrement."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_greeting_selected">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="message d'accueil numero $1 selectionné."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_play_greeting">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="$1 n'est pas valide."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_number">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="$1"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_message_number">
+    <input pattern="^([a-z]+):(.*)$">
+      <match>
+	<action function="speak-text" data="$1 message numero $2."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_phone_number">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="$1."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_name">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="$1."/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_ack">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="message $1"/>
+      </match>
+    </input>
+  </macro>
+
+  <macro name="voicemail_say_date">
+    <input pattern="^(.*)$">
+      <match>
+	<action function="speak-text" data="$strftime($1|%A, %B %d %Y, %I %M %p)"/>
+      </match>
+    </input>
+  </macro>
+
 </include><!--This line will be ignored it's here to validate the xml and is optional -->
\ No newline at end of file

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external.xml	Mon Aug  4 21:29:58 2008
@@ -37,5 +37,6 @@
     <param name="ext-sip-ip" value="$${external_sip_ip}"/>
     <param name="rtp-timeout-sec" value="300"/>
     <param name="rtp-hold-timeout-sec" value="1800"/>
+    <!--<param name="enable-3pcc" value="true"/>-->
   </settings>
 </profile>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external/example.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external/example.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external/example.xml	Mon Aug  4 21:29:58 2008
@@ -28,5 +28,7 @@
   <!--<param name="caller-id-in-from" value="false"/>-->
   <!--extra sip params to send in the contact-->
   <!--<param name="contact-params" value="tport=tcp"/>-->
+  <!--/// ping gateway to see if it is alive: *optional* /// -->
+  <!--<param name="ping" value="15"/>-->
   <!--</gateway>-->
 </include>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml	Mon Aug  4 21:29:58 2008
@@ -39,8 +39,8 @@
     <param name="aggressive-nat-detection" value="true"/>
     <!--<param name="enable-timer" value="false"/>-->
     <!--<param name="enable-100rel" value="false"/>-->
-    <!--<param name="apply-inbound-acl" value="rfc1918"/>-->
-    <!--<param name="apply-register-acl" value="rfc1918"/>-->
+    <param name="apply-inbound-acl" value="domains"/>
+    <!--<param name="apply-register-acl" value="domains"/>-->
     <!--<param name="dtmf-type" value="info"/>-->
     <param name="record-template" value="$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
     <!--enable to use presense and mwi -->
@@ -76,7 +76,10 @@
     <!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
     
     <!--Uncomment to set all inbound calls to no media mode-->
-    <!--<param name="inbound-no-media" value="true"/>-->
+    <!--<param name="inbound-bypass-media" value="true"/>-->
+
+    <!--Uncomment to set all inbound calls to proxy media mode-->
+    <!--<param name="inbound-proxy-media" value="true"/>-->
     
     <!--Uncomment to let calls hit the dialplan *before* you decide if the codec is ok-->
     <!--<param name="inbound-late-negotiation" value="true"/>-->
@@ -118,6 +121,12 @@
     <!-- disable register and transfer which may be undesirable in a public switch -->
     <!--<param name="disable-transfer" value="true"/>-->
     <!--<param name="disable-register" value="true"/>-->
+    <!--<param name="enable-3pcc" value="true"/>-->
+    <!-- use stun when specified (default is true) -->
+    <!--<param name="stun-enabled" value="true"/>-->
+    <!-- use stun when specified (default is true) -->
+    <!-- set to true to have the profile determine stun is not useful and turn it off globally-->
+    <!--<param name="stun-auto-disable" value="true"/>-->
   </settings>
 </profile>
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/nat.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/nat.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/nat.xml	Mon Aug  4 21:29:58 2008
@@ -28,5 +28,6 @@
     <param name="ext-sip-ip" value="$${external_sip_ip}"/>
     <param name="rtp-timeout-sec" value="300"/>
     <param name="rtp-hold-timeout-sec" value="1800"/>
+    <!--<param name="enable-3pcc" value="true"/>-->
   </settings>
 </profile>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/vars.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/vars.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/vars.xml	Mon Aug  4 21:29:58 2008
@@ -93,3 +93,8 @@
   <X-PRE-PROCESS cmd="set" data="outbound_caller_name=FreeSWITCH"/>
   <X-PRE-PROCESS cmd="set" data="outbound_caller_id=0000000000"/>
   <X-PRE-PROCESS cmd="set" data="call_debug=false"/>
+
+  <X-PRE-PROCESS cmd="set" data="uk-ring=%(400,200,400,450);%(400,2200,400,450)"/>
+  <X-PRE-PROCESS cmd="set" data="us-ring=%(2000, 4000, 440.0, 480.0)"/>
+  <X-PRE-PROCESS cmd="set" data="fr-ring=%(1500, 3500, 440.0, 0.0)"/>
+  <X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in	Mon Aug  4 21:29:58 2008
@@ -3,11 +3,11 @@
 
 # Must change all of the below together
 # For a release, set revision for that tagged release as well and uncomment
-AC_INIT([freeswitch], [1.0.0], BUG-REPORT-ADDRESS)
+AC_INIT([freeswitch], [1.0.1], BUG-REPORT-ADDRESS)
 AC_SUBST(SWITCH_VERSION_MAJOR, [1])
 AC_SUBST(SWITCH_VERSION_MINOR, [0])
-AC_SUBST(SWITCH_VERSION_MICRO, [0])
-AC_SUBST(SWITCH_VERSION_REVISION, [8691])
+AC_SUBST(SWITCH_VERSION_MICRO, [1])
+AC_SUBST(SWITCH_VERSION_REVISION, [9171])
 AC_SUBST(SOUNDS_VERSION, [1.0.2])
 
 AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
@@ -99,6 +99,9 @@
         *darwin*)
             SOLINK="-dynamic -bundle -force-flat-namespace"
         ;;
+        *-solaris2*)
+            SOLINK="-shared -Xlinker"
+        ;;
         *)
             SOLINK="-shared -Xlinker -x"
         ;;
@@ -335,7 +338,7 @@
 # Checks for header files.
 AC_HEADER_DIRENT
 AC_HEADER_STDC
-AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h])
+AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h netdb.h execinfo.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog	Mon Aug  4 21:29:58 2008
@@ -1,3 +1,146 @@
+freeswitch (1.0.1-1) unstable; urgency=low
+
+   * FIX: prevent intercept race condition that can also be solved with continue_on_fail=originator_cancel
+   * FIX: NULL dereference detected by klockwork (www.klockwork.com)
+   * FIX: don't open failed local stream (MODFORM-9)
+   * FIX: instability in mod_local_stream in failure scenarios
+   * FIX: xmlrpc-c build on OS X 10.4 (FSBUILD-47)
+   * ENHANCEMENT: Added tab completion on many api commands in console
+   * ENHANCEMENT: polycom BLF support
+   * FIX: many sip NAT related fixes in mod_sofia
+   * FIX: support sip unregister with Contact: *
+   * FIX: multiple segfaults in xmlrpc-c
+   * FIX: sip unregister event being skipped
+   * FIX: hangup properly on malformed sip 3pcc calls being used as a way to ping
+   * ADD: enable-3pcc sofia profile param, it is now disabled by default.
+   * ADD: presence events to sip proxy mode
+   * ADD: legs param to cdr_csv 
+   * ADD: support for perl as an embedded lanugage
+   * ENHANCEMENT: many new api's and functions to the embedded languages including api support, xml interface support, auto start scripts,  and many new objects
+   * CHANGE: python embedded language api changed to match perl, lua, java
+   * FIX: many stability fixes in embedded langauges perl, lua, java, python
+   * ADD: failed_xml_cdr magic channel variable
+   * FIX: access free memory error in mod_sofia when using respond app
+   * ENHNACEMENT: make global_setvar only have 2 fields so you can set foo=bar=blah w/o quotes
+   * FIX: mod_spidermonkey keep hangup hook in the session thread
+   * ENHANCEMENT: mod_ldap added sasl support and search filters
+   * ADD: answered, waitForAnswer and mediaReady methods to embedded language Session object
+   * ENHANCEMENT: mod_voicemail param change to allow notification emails using templates
+   * ADD: per user acl in sofia
+   * FIX: deadlock in mod_portaudio
+   * ENHANCEMENT: blank username in sip will trigger a lookup for the user "nobody"
+   * ADD: import variable to import variables from a peer channel at time of originate
+   * FIX: api type fix for c++ modules when incorrectly using enums
+   * FIX: eliminate need for escaped , in [] on originate
+   * ADD: NDLB-force-rport option to force behavior as if rport was sent in the via
+   * ENHANCEMENT: honor execute_on_answer on outbound legs too
+   * ADD: execute_on_ring variable
+   * FIX: Seg fault in CoreSession() class destructor
+   * ADD: per channel caller id in originate
+   * ADD: sip_outgoing_call_id variable
+   * FIX: multiple memory leaks in mod_sofia
+   * FIX: find_local_ip IPv6 support
+   * ADD: variable expansion to on execute vars.(FSCORE-114)
+   * ADD: count optional arg to show calls and show channels (MODAPP-103)
+   * FIX: MODEVENT-25 (WSAWOULDBLOCK error on socket send in windows) in event socket
+   * FIX: multiple fixes to the logic in mod_say_zh
+   * ADD: inter digit timeout to swigged embedded languages getDigits method. (MODLANG-65)
+   * ADD: Linksys P-RTP-Stat SIP header values (SFSIP-66)
+   * FIX: small leak in core
+   * ADD: progress_timeout var to originate
+   * UPDATE: portaudio library
+   * FIX: added timeout to iax read
+   * ADD: 'pa rescan' to portaudio to look for new devices
+   * FIX: wait for broadcast to start when starting async hold to avoid race
+   * FIX: mod_rss, don't always play the first news feed
+   * FIX: mod_rss inverval to use the session inteval (audio problems on 30ms channels)
+   * ADD: Path: support in mod_sofia on register
+   * FIX: mod_shout record stream
+   * ENHANCEMENT: mod_voicemail support for effective_caller_id_name/number
+   * ADD: url encode/decode api calls
+   * FIX: "nua()" in debug information in sofia instead of the real function name
+   * FIX: better handling of sips: uris
+   * FIX: don't seg when using more than SWITCH_MAX_CODECS and bump SWITCH_MAX_CODECS to 50 (we have more than 30 in tree) (MODFORM-10)
+   * ADD: mod_yaml
+   * FIX: segfault on freeswitch startup if installed directories are removed
+   * FIX: segfault when intercept with inbound_late_negotiation=true set
+   * FIX: dont flood logs with eavesdrop messages (MODAPP-101)
+   * FIX: don't destroy a codec that has not been created (MODAPP-101)
+   * ENHANCEMENT: allows the "eavesdrop_group" variable to contain several groups, comma separated.  (MODAPP-101)
+   * FIX: cross compile (FSBUILD-53)
+   * FIX: add header that Nuaunce considers mandatory (MODASRTTS-5)
+   * ADD: write locks to the core and a function to unregister event bindings (adds better ability to unload modules)
+   * ENHANCEMENT: make modules unbind events and un-reserve subclasses on module unload
+   * ADD: removable xml hook bindings
+   * ADD: EventConsumer object to embedded languages so you can make event handlers
+   * FIX: sending CN with supress-cng true
+   * FIX: segfault in the event system when trying to remove NULL event
+   * ADD: flags to turn off srtp auth and rtp auto adj (FSCORE-149 && MODENDP-115)
+   * FIX: use lighter math and avoid infinite loop in port allocator  (FSCORE-148)
+   * ENHANCEMENT: let conference pin entry start during prompt (MODAPP-111)
+   * ADD: mod_pocketsphinx
+   * FIX: Misuse of SQLRowCount, issues with MSSQL (MODAPP-105)
+   * FIX: segfaults in mod_python with dtmf callback
+   * ENHANCEMENT: mod_conference auto-record parameter  (MODAPP-112)
+   * ENHANCEMENT: reload support to many modules
+   * FIX: mod_sofia add replaces to supported header
+   * ENHANCEMENT: add args callback to sleep so you can process dtmf and events while "sleeping"
+   * ADD: mod_flite
+   * ENHANCEMENT: switch_xml converted back to c code and support double globs on windows
+   * ENHANCEMENT: mod_sofia support for adding and removing gateways without restarting profiles
+   * ADD: extract contact header info into A channel when unhandled 3xx response is received (MODENDP-116)
+   * FIX: outbound event_socket + late negotiation
+   * ADD: copy_xml_cdr variable
+   * ADD: silence_stream (like tone_stream but silent)
+   * ADD: module_exists api call
+   * ADD: emailer implementation for windows
+   * ADD: wait_for_silence application
+   * FIX: no error message generated if OS is unable to load a module ( due to dependency/installation issues )
+   * FIX: segfault in media bugs
+   * FIX: acl lists not correctly matching all ip adresses
+   * FIX: mod_spidermonkey exit() does not stop script when called from the hangup callback (return "exit" from the callback)
+   * FIX: mod_syslog works again
+   * FIX: crash on terminal resize
+   * FIX: audio problems on big endian
+   * ENHANCEMENT: Disable multiple registrations on a per-device basis (MODENDP-117)
+   * ADD: fifo_consumer_exit_key variable (MODAPP-100)
+   * ADD: cidr based user auth in mod_sofia
+   * ADD: uuid_send_dtmf fsapi command (MODAPP-114)
+   * ADD: server registration fiels to sip_registration database (MODENDP-118)
+   * FIX: use a variable, realm or to host to find gateway when it's not obvious (handles challenged REFER)
+   * ADD: timeout to curl run in javascript
+   * ADD: voicemail_inject fsapi command
+   * ADD: reboot option for sip phones to flush_inboud_reg sofia profile api command
+   * FIX: add small padding to end of mp3 to avoid cut off mp3 recording
+   * FIX: patch multiple SDP connection lines in sdp for proxy media mode (MODENDP-109)
+   * FIX: don't parse ringback varable in proxy situations
+   * ADD: per call vm recording ext with vm_message_ext variable
+   * ADD: sip_bye_h prefix to add headers to bye
+   * ENHANCEMENT: more interfaces available in show fsapi command
+   * FIX: don't leak in buffers on realloc fail
+   * FIX: fail out of a conference call if write fails
+   * ADD: auto ip-change detection
+   * ADD: mod_snom
+   * FIX: mod_sofia don't send sipfrag on transfer to cisco so they don't hang up the call
+
+ -- Mike Jerris <mike at jerris.com>  Thu, 24 Jul 2008 07:00:00 -0500
+
+freeswitch (1.0.1~trunk) unstable; urgency=low
+
+   * Updated revision number
+   * Fixed init problem reported by Jay Binks (FSSCRIPTS-1)
+   * Added a patch to the debian build system add more features (thanks to Hadley Rich) (FSBUILD-45)
+     - Added en-us-callie sounds and music on hold packages
+     - Added recommends and suggests
+     - Added mod_say_es and mod_say_nl
+     - Updated descriptions
+     - Added mod_cdr_csv
+   * Fixed typos and some errors in the previus patch.
+   * Modified monit script. Now it should work.
+   * The debian build system now bootstrap automagically if it's necessary and all scripts are in place.
+
+ -- Massimo Cetra <devel at navynet.it>  Sun, 6 Jul 2008 16:30:00 +0100
+
 freeswitch (1.0.0-1) unstable; urgency=low
 
    * Enhanced sofia sip nat handling

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/control
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/control	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/control	Mon Aug  4 21:29:58 2008
@@ -2,14 +2,15 @@
 Maintainer: Michal Bielicki <michal.bielicki at voiceworks.pl>
 Section: net
 Priority: extra
-Build-Depends: debhelper (>= 5), automake1.9, autoconf, libtool, unixodbc-dev, libasound2-dev, libcurl3-dev|libcurl4-openssl-dev, libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, libdb4.4-dev, libgnutls-dev
-Standards-Version: 3.7.2
+Build-Depends: debhelper (>= 5), fakeroot, automake1.9, autoconf, libtool, unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, libdb-dev, libgnutls-dev
+Standards-Version: 3.7.3
 
 Package: freeswitch
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, unixodbc, libasound2, libcurl3, openssl, libncurses5
-Suggests: monit
-Description: A telephony platform that really kicks some ass...
+Recommends: freeswitch-lang-en
+Suggests: freeswitch-spidermonkey, freeswitch-lua, freeswitch-perl, freeswitch-sounds-music-8000, monit 
+Description: The FreeSWITCH open source telephony platform
  FreeSWITCH is an open source telephony platform designed to facilitate the
  creation of voice and chat driven products scaling from a soft-phone up to
  a soft-switch.  It can be used as a simple switching engine, a media gateway
@@ -19,22 +20,22 @@
 Package: freeswitch-dev
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: Development Package for the FreeSwitch open source telephony platform
+Description: Development Package for the FreeSWITCH open source telephony platform
 
 Package: freeswitch-spidermonkey
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: A Javascript engine for freeswitch
+Description: A Javascript engine for FreeSWITCH
 
 Package: freeswitch-perl
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: A perl engine for freeswitch
+Description: A perl engine for FreeSWITCH
 
 Package: freeswitch-lua
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: A lua engine for freeswitch
+Description: A lua engine for FreeSWITCH
 
 Package: freeswitch-codec-passthru-g7231
 Architecture: any
@@ -54,8 +55,30 @@
 Package: freeswitch-lang-en
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
+Recommends: freeswitch-sounds-en-us-callie-8000
+Suggests: freeswitch-sounds-en-us-callie-16000, freeswitch-sounds-en-us-callie-32000
 Description: English language files for the FreeSWITCH open source telephony platform
 
+Package: freeswitch-sounds-en-us-callie-8000
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
+Description: English language files for the FreeSWITCH open source telephony platform
+
+Package: freeswitch-sounds-en-us-callie-16000
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
+Description: English language files for the FreeSWITCH open source telephony platform (16000)
+
+Package: freeswitch-sounds-en-us-callie-32000
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
+Description: English language files for the FreeSWITCH open source telephony platform (32000)
+
+Package: freeswitch-sounds-music-8000
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
+Description: Music on hold files for the FreeSWITCH open source telephony platform
+
 Package: freeswitch-lang-de
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
@@ -70,3 +93,13 @@
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
 Description: Italian language files for the FreeSWITCH open source telephony platform
+
+Package: freeswitch-lang-es
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
+Description: Spanish language files for the FreeSWITCH open source telephony platform
+
+Package: freeswitch-lang-nl
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
+Description: Dutch language files for the FreeSWITCH open source telephony platform

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/files
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/files	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/files	Mon Aug  4 21:29:58 2008
@@ -1,12 +1,18 @@
-freeswitch_1.0~rc6-1_i386.deb net extra
-freeswitch-dev_1.0~rc6-1_i386.deb net extra
-freeswitch-spidermonkey_1.0~rc6-1_i386.deb net extra
-freeswitch-perl_1.0~rc6-1_i386.deb net extra
-freeswitch-lua_1.0~rc6-1_i386.deb net extra
-freeswitch-codec-passthru-g7231_1.0~rc6-1_i386.deb net extra
-freeswitch-codec-passthru-amr_1.0~rc6-1_i386.deb net extra
-freeswitch-codec-passthru-g729_1.0~rc6-1_i386.deb net extra
-freeswitch-lang-en_1.0~rc6-1_i386.deb net extra
-freeswitch-lang-de_1.0~rc6-1_i386.deb net extra
-freeswitch-lang-fr_1.0~rc6-1_i386.deb net extra
-freeswitch-lang-it_1.0~rc6-1_i386.deb net extra
+freeswitch_1.0.1~trunk_i386.deb net extra
+freeswitch-dev_1.0.1~trunk_i386.deb net extra
+freeswitch-spidermonkey_1.0.1~trunk_i386.deb net extra
+freeswitch-perl_1.0.1~trunk_i386.deb net extra
+freeswitch-lua_1.0.1~trunk_i386.deb net extra
+freeswitch-codec-passthru-g7231_1.0.1~trunk_i386.deb net extra
+freeswitch-codec-passthru-amr_1.0.1~trunk_i386.deb net extra
+freeswitch-codec-passthru-g729_1.0.1~trunk_i386.deb net extra
+freeswitch-lang-en_1.0.1~trunk_i386.deb net extra
+freeswitch-sounds-en-us-callie-8000_1.0.1~trunk_i386.deb net extra
+freeswitch-sounds-en-us-callie-16000_1.0.1~trunk_i386.deb net extra
+freeswitch-sounds-en-us-callie-32000_1.0.1~trunk_i386.deb net extra
+freeswitch-sounds-music-8000_1.0.1~trunk_i386.deb net extra
+freeswitch-lang-de_1.0.1~trunk_i386.deb net extra
+freeswitch-lang-fr_1.0.1~trunk_i386.deb net extra
+freeswitch-lang-it_1.0.1~trunk_i386.deb net extra
+freeswitch-lang-es_1.0.1~trunk_i386.deb net extra
+freeswitch-lang-nl_1.0.1~trunk_i386.deb net extra

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.conffiles
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.conffiles	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.conffiles	Mon Aug  4 21:29:58 2008
@@ -64,6 +64,7 @@
 /opt/freeswitch/conf/autoload_configs/iax.conf.xml
 /opt/freeswitch/conf/autoload_configs/woomera.conf.xml
 /opt/freeswitch/conf/autoload_configs/post_load_modules.conf.xml
+/opt/freeswitch/conf/autoload_configs/pocketsphinx.conf.xml
 /opt/freeswitch/conf/autoload_configs/xml_cdr.conf.xml
 /opt/freeswitch/conf/autoload_configs/cdr_csv.conf.xml
 /opt/freeswitch/conf/autoload_configs/dialplan_directory.conf.xml

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.init
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.init	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.init	Mon Aug  4 21:29:58 2008
@@ -19,26 +19,20 @@
 DESC="FreeSwitch Voice Switching System"
 NAME=freeswitch
 DAEMON=/opt/freeswitch/bin/$NAME
-DAEMON_ARGS="-nc"
 USER=freeswitch
 PIDFILE=/opt/freeswitch/log/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
 
 # Check if we are being executed by init
 
-. /etc/default/$NAME
 CALLEDSCRIPT=`basename $0`
-echo $CALLEDSCRIPT
-case "$CALLEDSCRIPT" in
-	freeswitch)
-	;;
-	*)
-	  if [ "USE_INIT" != "TRUE" ]; then 
-	    echo "FreeSwitch disabled" ; 
-	    exit 0 ;
-	  fi
-	;;
-esac
+
+if [ -r /etc/default/$NAME ]; then . /etc/default/$NAME; fi                                           
+
+if [ "$FREESWITCH_ENABLED" != "true" ]; then 
+    echo "$DESC not enabled yet. Edit /etc/default/$NAME first."
+    exit 0 ;
+fi
 
 # Exit if the package is not installed
 # [ -x "$DAEMON" ] || exit 0
@@ -65,7 +59,7 @@
 	start-stop-daemon -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
 		|| return 1
 	start-stop-daemon -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
-		$DAEMON_ARGS \
+		$FREESWITCH_PARAMS \
 		|| return 2
 	# Add code here, if necessary, that waits for the process to be ready
 	# to handle requests from services started subsequently which depend

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.install
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.install	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/freeswitch.install	Mon Aug  4 21:29:58 2008
@@ -3,6 +3,7 @@
 opt/freeswitch/bin/scripts/*
 opt/freeswitch/lib/libfreeswitch*.so*
 opt/freeswitch/mod/mod_shout*
+opt/freeswitch/mod/mod_cdr_csv.so*
 opt/freeswitch/mod/mod_console.so*
 opt/freeswitch/mod/mod_expr.so*
 opt/freeswitch/mod/mod_rss.so*
@@ -45,6 +46,7 @@
 opt/freeswitch/conf/dialplan/default.xml
 opt/freeswitch/conf/dialplan/features.xml
 opt/freeswitch/conf/dialplan/extensions
+opt/freeswitch/conf/dialplan/extensions/*.xml
 opt/freeswitch/conf/sip_profiles/external.xml
 opt/freeswitch/conf/sip_profiles/nat.xml
 opt/freeswitch/conf/sip_profiles/nat/example.xml
@@ -103,6 +105,7 @@
 opt/freeswitch/conf/autoload_configs/iax.conf.xml
 opt/freeswitch/conf/autoload_configs/woomera.conf.xml
 opt/freeswitch/conf/autoload_configs/post_load_modules.conf.xml
+opt/freeswitch/conf/autoload_configs/pocketsphinx.conf.xml
 opt/freeswitch/conf/autoload_configs/xml_cdr.conf.xml
 opt/freeswitch/conf/autoload_configs/cdr_csv.conf.xml
 opt/freeswitch/conf/autoload_configs/dialplan_directory.conf.xml

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/monit/freeswitch.monitrc
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/monit/freeswitch.monitrc	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/monit/freeswitch.monitrc	Mon Aug  4 21:29:58 2008
@@ -2,7 +2,10 @@
    group voice
    start program = "/etc/init.d/freeswitch start"
    stop  program = "/etc/init.d/freeswitch stop"
-   if failed port 5060 type UDP then restart
+# Checks sip port on localhost, not wlways suitable
+#   if failed port 5060 type UDP then restart
+# Checks mod_event_socket on localhost. Maybe more suitable
+   if failed port 8021 type TCP then restart
    if 5 restarts within 5 cycles then timeout
    depends on freeswitch_bin
    depends on freeswitch_rc
@@ -10,9 +13,9 @@
  check file freeswitch_bin with path /opt/freeswitch/bin/freeswitch
    group voice
    if failed checksum then unmonitor
-   if failed permission 755 then unmonitor
+   if failed permission 750 then unmonitor
    if failed uid freeswitch then unmonitor
-   if failed gid daemon then unmonitor
+#   if failed gid daemon then unmonitor
 
  check file freeswitch_rc with path /etc/init.d/freeswitch
    group voice

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/rules
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/rules	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/rules	Mon Aug  4 21:29:58 2008
@@ -16,13 +16,13 @@
 export DIRECTORIES_MODULES=
 export DOTNET_MODULES=
 export ENDPOINTS_MODULES=endpoints/mod_dingaling endpoints/mod_iax endpoints/mod_portaudio endpoints/mod_sofia endpoints/mod_woomera ../../libs/openzap/mod_openzap
-export EVENT_HANDLERS_MODULES=event_handlers/mod_event_multicast event_handlers/mod_event_socket
+export EVENT_HANDLERS_MODULES=event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv
 export FORMATS_MODULES=formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_tone_stream formats/mod_shout
 export LANGUAGES_MODULES=languages/mod_perl languages/mod_lua
 export LOGGERS_MODULES=loggers/mod_console loggers/mod_logfile loggers/mod_syslog
-export SAY_MODULES=say/mod_say_de say/mod_say_en say/mod_say_fr say/mod_say_it
+export SAY_MODULES=say/mod_say_en say/mod_say_it say/mod_say_de say/mod_say_fr say/mod_say_es say/mod_say_nl
 export TIMERS_MODULES=
-export DISABLED_MODULES=applications/mod_soundtouch directories/mod_ldap languages/mod_java languages/mod_python languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox endpoints/mod_wanpipe event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf say/mod_say_es say/mod_say_nl
+export DISABLED_MODULES=applications/mod_soundtouch directories/mod_ldap languages/mod_java languages/mod_python languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox endpoints/mod_wanpipe event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf
 export XML_INT_MODULES=xml_int/mod_xml_rpc  xml_int/mod_xml_curl xml_int/mod_xml_cdr
 export MYMODULES=$(PASSTHRU_CODEC_MODULES) $(SPIDERMONKEY_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(DIRECTORIES_MODULES) $(DOTNET_MODULES) $(ENDPOINTS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(TIMERS_MODULES) $(XML_INT_MODULES)
 export MODULES=$(MYMODULES)
@@ -49,14 +49,21 @@
 
 config.status: configure
 	dh_testdir
-	rm modules.conf
+	rm -f modules.conf
 	touch modules.conf
 	echo $(MODULES)
 	for i in $(MODULES); do echo $$i >> modules.conf; done
 	./configure --prefix=/opt/freeswitch --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) ${FEATURES}
 
-configure: bootstrap.sh
-	AUTOCONF=${AUTOCONF} ./bootstrap.sh
+configure:
+	if test ! -f Makefile.in ;  then \
+	    if test -f ./bootstrap.sh ; then \
+		AUTOCONF=${AUTOCONF} ./bootstrap.sh ; \
+	    else \
+		echo "No Makefile.in and no known way to bootstrap." ; \
+		exit 1; \
+	    fi; \
+	fi;
 
 build: build-stamp
 build-stamp:  config.status
@@ -89,7 +96,7 @@
 	dh_clean -k 
 	dh_installdirs -A --sourcedir=debian/tmp
 
-	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install uhd-sounds-install moh-install
 
 
 # Build architecture-independent files here.
@@ -116,8 +123,7 @@
 #	dh_installinfo
 #	dh_undocumented
 #	dh_installman
-	cp debian/monit/freeswitch.monitrc debian/freeswitch/etc/monit/freswitch.monitrc
-	cp debian/default/freeswitch debian/freeswitch/etc/default
+	cp debian/monit/freeswitch.monitrc debian/freeswitch/etc/monit/freeswitch.monitrc
 	dh_install --sourcedir=debian/tmp
 	dh_strip
 	dh_compress

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog	Mon Aug  4 21:29:58 2008
@@ -1,143 +1,270 @@
-freeswitch (1.0.0)
-
-	Enhanced sofia sip nat handling
-	Many fixes found by Klockwork (www.klocwork.com)
-	Added disable_app_log variable
-	Fixed mod_local_stream with rates on windows
-	Fixed finding of files in rate dirs on windows
-	Fixed memory corruption from sofia_contact function
-	Added sofia profile param NDLB-received-in-nat-reg-contact
-	Added sofia profile param aggressive-nat-detection
-	Fixed video sip calls in proxy media mode
-	Added bridge_terminate_key var
-	Update xmlrpc-c lib to trunk revision from upstream, fix windows xmlrpc
-	Enhanced nat handling in proxy media mode in sip
-	Add progress media to timetable so you can calculate pdd
-	Fixed seg when using unicast on socket when call has no read_codec
-	Fixed missed log events on busy box
-	Added -bleg to intercept
-	Enhance configure detection of python
-	Fixed build on solaris and freebsd for several modules
-	Added param "vm-email-only" to make voicemail sent by email only (previously default behavior)
-	Added param "vm-mailto-notify" to allow sending a notification email
-	Fixed mod_java build
-	Fixed mwi failures for some devices that don't subscribe
-	Removed fsapi functions (killchan, transfer, session_displace, reject)
-	Removed fsapi functions (session_record, broadcast, hold, media)
-	Many updates to sofia-sip library including over 100 fixes
-	
-freeswitch (1.0.rc6)
-
-	Changed to not allow pass_2833 on transcoded calls (it never worked, now it will tell you)
-	Enhanced sofia sip nat handling
-	Fix libedit build on solaris
-	Fix session timers in mod_sofia
-	Fix conference fire-call
-	Change: add var_event down into the endpoints so chans with no parents can still pass options
-	Added enable-post-var param to xml_rpc
-	Fix mod_lua build on solaris
-	Many fixes found by Klockwork (www.klocwork.com)
-	Add unregister event in mod_sofia
-	Enhance python configure detection
-	Add vm_boxcount api func
-	Fixed att_xfer issue
-	Fix sip now includes the Allow-Events header in more places
-
-freeswitch (1.0.rc5)
-
-	Changed internal state names to avoid confusion
-	Fixed video negotiation
-	Enhanced accuracy of windows timer
-	Fixed mod_ldap build
-	Added dialplan and context to sql table for channels
-	Multiple fixes to mod_lua and mod_perl
-	Fixed logic bug in fifo causing segfault
-	internal changes to sip stack so we can remove a hash redundant to the stack
-	Fixed multiple memory leaks in mod_sofia
-	Fixed event fetch segfault on sip subscribe
-	Fixed segfault on timer rollover in sofia on 64bit
-	Fixed audio timing issues in mod_portaudio
-	Changed names of sip profiles in default config to avoid confusion
-	Fixed memory usage leak-like behavior when playing files requiring resampling
-	Removed some unused api's
-	Fix rtp timeout when playing moh
-	Removed some un-needed libraries and files from tree
-	Fixed multiple issues in sip stack including multiple segfaults
-	Added support for sip transfers on bypass_media and proxy_media calls
-	Added say application
-	Fixed --disable-debug configure option
-	Enhanced switch_cpp wrapper (and perl, python, lua, java)
-	Fixed segfault on inavalid stun response
-	Fixed configure help output
-	Fixed segfault on mp3 playback
-	Fixed assert on invalid sdp (missing m= line)
-	Added configurable windows service name
-	Fixed proxy mode call transition to non proxy call
-	Fixed solaris build of voipcodecs
-	Fixed sofia seg when call failure edge case
-
-freeswitch (1.0.rc4)
-
-	Add tab completion in cli
-	Add "inline" dialplan
-	Fixed segfault in enum
-	Enhance enum to fork dial equal priority entries
-	Added auto-reload to enum
-	Fixed odbc bug is mod_sofia presence handling
-	Add presence for conference and dial an eavesdrop
-	Fix stack overflow segfault when recursively parking calls
-	Fixed race is sofia registration handling
-	Enhance sofia registration, unregister on keep-alive OPTIONS failure
-	Added internal routing loop detection/avoidance
-	Fixed race in bgapi in event socket
-	Fixed vars to execute apps before bridge "bridge_pre_execute_aleg_app" and "bridge_pre_execute_bleg_app"
-	Fixed re-setting sound prefix to no prefix after a pharse
-	Enhanced setting of bracket vars from originate so they show in the CHANNEL_ORIGINATE event
-	Add "enable-timer" and "enable-100rel" options to turn off default behaviors in sofia
-	Add originate_timeout to originate vars
-	Fixed hanging channels in mod_portaudio
-	Added auto time sync on vps migration to different hardware
-	Fixed seg on transfer when both legs are not sip
-	Added configurable dtmf duration defaults
-	Enhanced voicemail, allow interruption of hello message
-	Fixed voicemail to not light up light on saved messages
-	Enhance mod_amr honor disable dtx in fmtp (MODCODEC-3)
-	Fixed bootstrap to install automake dependencies so you can use tarball without same version of automake installed
-	Fixed MODLANG-56 (bad audio on originate and javascript streamFile)
-	Added hold/unhold dialplan apps
-	Enhanced sofia error checking to outlaw 0.0.0.0 in sofia ip params
-	Backport fixes from sofia-sip tree
-	Fixed MSVC build
-	Fixed segfault on sip SUBSCRIBE with Expires: 0
-	Added mod_say_zh
-	Added --with-pyton and --with-pyton-config configure options
-	Added mod_lua
-	Enhanced switch_cpp wrapper in core and normalized interfaces for perl, python, lua, and java
-	Fixed multiple issues in cpp wrapper and the languages perl, python, lua and java
-	Added back mod_perl
-	Added sofia gateway option ping to adjust options ping frequency
-	Added .net event socket lib to contrib
-	Fixed passing of exact response codes of sip across a bridge
-	Added mod_reference, reference endpoint module
-	Enhanced build so you can now make commented out modules using "make mod_name"
-	
-freeswitch (1.0.rc3)
-
-        Enhance xml menu system
-        Fixes upstream from sofia-sip library
-        Enhance mod_fifo
-        Added close method to ODBC spidermonkey class
-        Fix multiple bugs in the cpp wrapper used in mod_java and mod_python
-        Fix hung sip channel issue using respond app or on re-invite with bypass media after 1xx or 2xx responses
-
-freeswitch (1.0.rc2)
-
-	Fixed speex protocol negotiation issues (8k vs 16k)
-	Fixed mod_iax race conditions
-	Fixed ptime negotiation issues when re-packetizing
-	Added ip based acl lists
-
-freeswitch (1.0.rc1)
-
-
-	
+freeswitch (1.0.1)
+
+	FIX: prevent intercept race condition that can also be solved with continue_on_fail=originator_cancel
+	FIX: NULL dereference detected by klockwork (www.klockwork.com)
+	FIX: don't open failed local stream (MODFORM-9)
+	FIX: instability in mod_local_stream in failure scenarios
+	FIX: xmlrpc-c build on OS X 10.4 (FSBUILD-47)
+	ENHANCEMENT: Added tab completion on many api commands in console
+	ENHANCEMENT: polycom BLF support
+	FIX: many sip NAT related fixes in mod_sofia
+	FIX: support sip unregister with Contact: *
+	FIX: multiple segfaults in xmlrpc-c
+	FIX: sip unregister event being skipped
+	FIX: hangup properly on malformed sip 3pcc calls being used as a way to ping
+	ADD: enable-3pcc sofia profile param, it is now disabled by default.
+	ADD: presence events to sip proxy mode
+	ADD: legs param to cdr_csv 
+	ADD: support for perl as an embedded lanugage
+	ENHANCEMENT: many new api's and functions to the embedded languages including api support, xml interface support, auto start scripts,  and many new objects
+	CHANGE: python embedded language api changed to match perl, lua, java
+	FIX: many stability fixes in embedded langauges perl, lua, java, python
+	ADD: failed_xml_cdr magic channel variable
+	FIX: access free memory error in mod_sofia when using respond app
+	ENHNACEMENT: make global_setvar only have 2 fields so you can set foo=bar=blah w/o quotes
+	FIX: mod_spidermonkey keep hangup hook in the session thread
+	ENHANCEMENT: mod_ldap added sasl support and search filters
+	ADD: answered, waitForAnswer and mediaReady methods to embedded language Session object
+	ENHANCEMENT: mod_voicemail param change to allow notification emails using templates
+	ADD: per user acl in sofia
+	FIX: deadlock in mod_portaudio
+	ENHANCEMENT: blank username in sip will trigger a lookup for the user "nobody"
+	ADD: import variable to import variables from a peer channel at time of originate
+	FIX: api type fix for c++ modules when incorrectly using enums
+	FIX: eliminate need for escaped , in [] on originate
+	ADD: NDLB-force-rport option to force behavior as if rport was sent in the via
+	ENHANCEMENT: honor execute_on_answer on outbound legs too
+	ADD: execute_on_ring variable
+	FIX: Seg fault in CoreSession() class destructor
+	ADD: per channel caller id in originate
+	ADD: sip_outgoing_call_id variable
+	FIX: multiple memory leaks in mod_sofia
+	FIX: find_local_ip IPv6 support
+	ADD: variable expansion to on execute vars.(FSCORE-114)
+	ADD: count optional arg to show calls and show channels (MODAPP-103)
+	FIX: MODEVENT-25 (WSAWOULDBLOCK error on socket send in windows) in event socket
+	FIX: multiple fixes to the logic in mod_say_zh
+	ADD: inter digit timeout to swigged embedded languages getDigits method. (MODLANG-65)
+	ADD: Linksys P-RTP-Stat SIP header values (SFSIP-66)
+	FIX: small leak in core
+	ADD: progress_timeout var to originate
+	UPDATE: portaudio library
+	FIX: added timeout to iax read
+	ADD: 'pa rescan' to portaudio to look for new devices
+	FIX: wait for broadcast to start when starting async hold to avoid race
+	FIX: mod_rss, don't always play the first news feed
+	FIX: mod_rss inverval to use the session inteval (audio problems on 30ms channels)
+	ADD: Path: support in mod_sofia on register
+	FIX: mod_shout record stream
+	ENHANCEMENT: mod_voicemail support for effective_caller_id_name/number
+	ADD: url encode/decode api calls
+	FIX: "nua()" in debug information in sofia instead of the real function name
+	FIX: better handling of sips: uris
+	FIX: don't seg when using more than SWITCH_MAX_CODECS and bump SWITCH_MAX_CODECS to 50 (we have more than 30 in tree) (MODFORM-10)
+	ADD: mod_yaml
+	FIX: segfault on freeswitch startup if installed directories are removed
+	FIX: segfault when intercept with inbound_late_negotiation=true set
+	FIX: dont flood logs with eavesdrop messages (MODAPP-101)
+	FIX: don't destroy a codec that has not been created (MODAPP-101)
+	ENHANCEMENT: allows the "eavesdrop_group" variable to contain several groups, comma separated.  (MODAPP-101)
+	FIX: cross compile (FSBUILD-53)
+	FIX: add header that Nuaunce considers mandatory (MODASRTTS-5)
+	ADD: write locks to the core and a function to unregister event bindings (adds better ability to unload modules)
+	ENHANCEMENT: make modules unbind events and un-reserve subclasses on module unload
+	ADD: removable xml hook bindings
+	ADD: EventConsumer object to embedded languages so you can make event handlers
+	FIX: sending CN with supress-cng true
+	FIX: segfault in the event system when trying to remove NULL event
+	ADD: flags to turn off srtp auth and rtp auto adj (FSCORE-149 && MODENDP-115)
+	FIX: use lighter math and avoid infinite loop in port allocator  (FSCORE-148)
+	ENHANCEMENT: let conference pin entry start during prompt (MODAPP-111)
+	ADD: mod_pocketsphinx
+	FIX: Misuse of SQLRowCount, issues with MSSQL (MODAPP-105)
+	FIX: segfaults in mod_python with dtmf callback
+	ENHANCEMENT: mod_conference auto-record parameter  (MODAPP-112)
+	ENHANCEMENT: reload support to many modules
+	FIX: mod_sofia add replaces to supported header
+	ENHANCEMENT: add args callback to sleep so you can process dtmf and events while "sleeping"
+	ADD: mod_flite
+	ENHANCEMENT: switch_xml converted back to c code and support double globs on windows
+	ENHANCEMENT: mod_sofia support for adding and removing gateways without restarting profiles
+	ADD: extract contact header info into A channel when unhandled 3xx response is received (MODENDP-116)
+	FIX: outbound event_socket + late negotiation
+	ADD: copy_xml_cdr variable
+	ADD: silence_stream (like tone_stream but silent)
+	ADD: module_exists api call
+	ADD: emailer implementation for windows
+	ADD: wait_for_silence application
+	FIX: no error message generated if OS is unable to load a module ( due to dependency/installation issues )
+	FIX: segfault in media bugs
+	FIX: acl lists not correctly matching all ip adresses
+	FIX: mod_spidermonkey exit() does not stop script when called from the hangup callback (return "exit" from the callback)
+	FIX: mod_syslog works again
+	FIX: crash on terminal resize
+	FIX: audio problems on big endian
+	ENHANCEMENT: Disable multiple registrations on a per-device basis (MODENDP-117)
+	ADD: fifo_consumer_exit_key variable (MODAPP-100)
+	ADD: cidr based user auth in mod_sofia
+	ADD: uuid_send_dtmf fsapi command (MODAPP-114)
+	ADD: server registration fiels to sip_registration database (MODENDP-118)
+	FIX: use a variable, realm or to host to find gateway when it's not obvious (handles challenged REFER)
+	ADD: timeout to curl run in javascript
+	ADD: voicemail_inject fsapi command
+	ADD: reboot option for sip phones to flush_inboud_reg sofia profile api command
+	FIX: add small padding to end of mp3 to avoid cut off mp3 recording
+	FIX: patch multiple SDP connection lines in sdp for proxy media mode (MODENDP-109)
+	FIX: don't parse ringback varable in proxy situations
+	ADD: per call vm recording ext with vm_message_ext variable
+	ADD: sip_bye_h prefix to add headers to bye
+	ENHANCEMENT: more interfaces available in show fsapi command
+	FIX: don't leak in buffers on realloc fail
+	FIX: fail out of a conference call if write fails
+	ADD: auto ip-change detection
+	ADD: mod_snom
+	FIX: mod_sofia don't send sipfrag on transfer to cisco so they don't hang up the call
+
+
+
+freeswitch (1.0.0)
+
+	Enhanced sofia sip nat handling
+	Many fixes found by Klockwork (www.klocwork.com)
+	Added disable_app_log variable
+	Fixed mod_local_stream with rates on windows
+	Fixed finding of files in rate dirs on windows
+	Fixed memory corruption from sofia_contact function
+	Added sofia profile param NDLB-received-in-nat-reg-contact
+	Added sofia profile param aggressive-nat-detection
+	Fixed video sip calls in proxy media mode
+	Added bridge_terminate_key var
+	Update xmlrpc-c lib to trunk revision from upstream, fix windows xmlrpc
+	Enhanced nat handling in proxy media mode in sip
+	Add progress media to timetable so you can calculate pdd
+	Fixed seg when using unicast on socket when call has no read_codec
+	Fixed missed log events on busy box
+	Added -bleg to intercept
+	Enhance configure detection of python
+	Fixed build on solaris and freebsd for several modules
+	Added param "vm-email-only" to make voicemail sent by email only (previously default behavior)
+	Added param "vm-mailto-notify" to allow sending a notification email
+	Fixed mod_java build
+	Fixed mwi failures for some devices that don't subscribe
+	Removed fsapi functions (killchan, transfer, session_displace, reject)
+	Removed fsapi functions (session_record, broadcast, hold, media)
+	Many updates to sofia-sip library including over 100 fixes
+	
+freeswitch (1.0.rc6)
+
+	Changed to not allow pass_2833 on transcoded calls (it never worked, now it will tell you)
+	Enhanced sofia sip nat handling
+	Fix libedit build on solaris
+	Fix session timers in mod_sofia
+	Fix conference fire-call
+	Change: add var_event down into the endpoints so chans with no parents can still pass options
+	Added enable-post-var param to xml_rpc
+	Fix mod_lua build on solaris
+	Many fixes found by Klockwork (www.klocwork.com)
+	Add unregister event in mod_sofia
+	Enhance python configure detection
+	Add vm_boxcount api func
+	Fixed att_xfer issue
+	Fix sip now includes the Allow-Events header in more places
+
+freeswitch (1.0.rc5)
+
+	Changed internal state names to avoid confusion
+	Fixed video negotiation
+	Enhanced accuracy of windows timer
+	Fixed mod_ldap build
+	Added dialplan and context to sql table for channels
+	Multiple fixes to mod_lua and mod_perl
+	Fixed logic bug in fifo causing segfault
+	internal changes to sip stack so we can remove a hash redundant to the stack
+	Fixed multiple memory leaks in mod_sofia
+	Fixed event fetch segfault on sip subscribe
+	Fixed segfault on timer rollover in sofia on 64bit
+	Fixed audio timing issues in mod_portaudio
+	Changed names of sip profiles in default config to avoid confusion
+	Fixed memory usage leak-like behavior when playing files requiring resampling
+	Removed some unused api's
+	Fix rtp timeout when playing moh
+	Removed some un-needed libraries and files from tree
+	Fixed multiple issues in sip stack including multiple segfaults
+	Added support for sip transfers on bypass_media and proxy_media calls
+	Added say application
+	Fixed --disable-debug configure option
+	Enhanced switch_cpp wrapper (and perl, python, lua, java)
+	Fixed segfault on inavalid stun response
+	Fixed configure help output
+	Fixed segfault on mp3 playback
+	Fixed assert on invalid sdp (missing m= line)
+	Added configurable windows service name
+	Fixed proxy mode call transition to non proxy call
+	Fixed solaris build of voipcodecs
+	Fixed sofia seg when call failure edge case
+
+freeswitch (1.0.rc4)
+
+	Add tab completion in cli
+	Add "inline" dialplan
+	Fixed segfault in enum
+	Enhance enum to fork dial equal priority entries
+	Added auto-reload to enum
+	Fixed odbc bug is mod_sofia presence handling
+	Add presence for conference and dial an eavesdrop
+	Fix stack overflow segfault when recursively parking calls
+	Fixed race is sofia registration handling
+	Enhance sofia registration, unregister on keep-alive OPTIONS failure
+	Added internal routing loop detection/avoidance
+	Fixed race in bgapi in event socket
+	Fixed vars to execute apps before bridge "bridge_pre_execute_aleg_app" and "bridge_pre_execute_bleg_app"
+	Fixed re-setting sound prefix to no prefix after a pharse
+	Enhanced setting of bracket vars from originate so they show in the CHANNEL_ORIGINATE event
+	Add "enable-timer" and "enable-100rel" options to turn off default behaviors in sofia
+	Add originate_timeout to originate vars
+	Fixed hanging channels in mod_portaudio
+	Added auto time sync on vps migration to different hardware
+	Fixed seg on transfer when both legs are not sip
+	Added configurable dtmf duration defaults
+	Enhanced voicemail, allow interruption of hello message
+	Fixed voicemail to not light up light on saved messages
+	Enhance mod_amr honor disable dtx in fmtp (MODCODEC-3)
+	Fixed bootstrap to install automake dependencies so you can use tarball without same version of automake installed
+	Fixed MODLANG-56 (bad audio on originate and javascript streamFile)
+	Added hold/unhold dialplan apps
+	Enhanced sofia error checking to outlaw 0.0.0.0 in sofia ip params
+	Backport fixes from sofia-sip tree
+	Fixed MSVC build
+	Fixed segfault on sip SUBSCRIBE with Expires: 0
+	Added mod_say_zh
+	Added --with-pyton and --with-pyton-config configure options
+	Added mod_lua
+	Enhanced switch_cpp wrapper in core and normalized interfaces for perl, python, lua, and java
+	Fixed multiple issues in cpp wrapper and the languages perl, python, lua and java
+	Added back mod_perl
+	Added sofia gateway option ping to adjust options ping frequency
+	Added .net event socket lib to contrib
+	Fixed passing of exact response codes of sip across a bridge
+	Added mod_reference, reference endpoint module
+	Enhanced build so you can now make commented out modules using "make mod_name"
+	
+freeswitch (1.0.rc3)
+
+        Enhance xml menu system
+        Fixes upstream from sofia-sip library
+        Enhance mod_fifo
+        Added close method to ODBC spidermonkey class
+        Fix multiple bugs in the cpp wrapper used in mod_java and mod_python
+        Fix hung sip channel issue using respond app or on re-invite with bypass media after 1xx or 2xx responses
+
+freeswitch (1.0.rc2)
+
+	Fixed speex protocol negotiation issues (8k vs 16k)
+	Fixed mod_iax race conditions
+	Fixed ptime negotiation issues when re-packetizing
+	Added ip based acl lists
+
+freeswitch (1.0.rc1)
+
+
+	

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/phrase/phrase_en.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/phrase/phrase_en.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/phrase/phrase_en.xml	Mon Aug  4 21:29:58 2008
@@ -209,7 +209,7 @@
       <prompt phrase="to forward the recording to your email" filename="vm-forward_to_email.wav"/>
       <prompt phrase="greeting" filename="vm-greeting.wav"/>
       <prompt phrase="selected" filename="vm-selected.wav"/>
-      <prompt phrase="is not available" filename="vm-not_avaliable.wav"/>
+      <prompt phrase="is not available" filename="vm-not_available.wav"/>
       <prompt phrase="message number" filename="vm-message_number.wav"/>
       <prompt phrase="deleted" filename="vm-deleted.wav"/>
       <prompt phrase="in folder inbox" filename="vm-in_folder.wav"/>
@@ -232,5 +232,53 @@
       <prompt phrase="Please enter the conference pin number." filename="pin.wav"/>
       <prompt phrase="Invalid pin number, try again." filename="bad-pin.wav"/>
     </conference>
+    <ivr>
+      <prompt phrase="Account number" filename="ivr-account_number.wav"/>
+      <prompt phrase="Connect to caller" filename="ivr-connect_to_caller.wav"/>
+      <prompt phrase="If you know your party's extension, please enter it now" filename="ivr-enter_ext_pound.wav"/>
+      <prompt phrase="Please enter an extension followed by the pound sign" filename="ivr-enter_ext.wav"/>
+      <prompt phrase="For this person" filename="ivr-for_this_person.wav"/>
+      <prompt phrase="Please hold while I connect your call" filename="ivr-hold_connect_call.wav"/>
+      <prompt phrase="I'm sorry" filename="ivr-im_sorry.wav"/>
+      <prompt phrase="Please" filename="ivr-please.wav"/>
+      <prompt phrase="Please return our call at" filename="ivr-please_return_our_call_at.wav"/>
+      <prompt phrase="Regarding reference number" filename="ivr-regarding_reference_number.wav"/>
+      <prompt phrase="This is a sample IVR submenu..." filename="ivr-sample_submenu.wav"/>
+      <prompt phrase="Please say your name after the tone" filename="ivr-say_name.wav"/>
+      <prompt phrase="Send this caller to voicemail" filename="ivr-send_to_voicemail.wav"/>
+      <prompt phrase="To speak to a customer service representative" filename="ivr-speak_to_a_customer_service_representative.wav"/>
+      <prompt phrase="Take a message" filename="ivr-take_a_message.wav"/>
+      <prompt phrase="Thank you" filename="ivr-thank_you.wav"/>
+      <prompt phrase="That was an invalid entry" filename="ivr-that_was_an_invalid_entry.wav"/>
+      <prompt phrase="This is a call from" filename="ivr-this_is_a_call_from.wav"/>
+      <prompt phrase="This IVR will let you test some of the features..." filename="ivr-this_ivr_will_let_you_test_features.wav"/>
+      <prompt phrase="To call the FreeSWITCH conference" filename="ivr-to_call_the_freeswitch_conference.wav"/>
+      <prompt phrase="To do a FreeSWITCH echo test" filename="ivr-to_do_a_freeswitch_echo_test.wav"/>
+      <prompt phrase="To do a fwd echo test" filename="ivr-to_do_a_fwd_echo_test.wav"/>
+      <prompt phrase="To hear a sample IVR submenu" filename="ivr-to_hear_sample_submenu.wav"/>
+      <prompt phrase="To hear screaming monkeys" filename="ivr-to_hear_screaming_monkeys.wav"/>
+      <prompt phrase="To list to music on hold" filename="ivr-to_listen_to_moh.wav"/>
+      <prompt phrase="To repeat these options" filename="ivr-to_repeat_these_options.wav"/>
+      <prompt phrase="To return to the previous menu" filename="ivr-to_return_to_previous_menu.wav"/>
+      <prompt phrase="To speak with an operator" filename="ivr-to_speak_with_an_operator.wav"/>
+      <prompt phrase="Welcome to FreeSWITCH, the future of telephony" filename="ivr-welcome_to_freeswitch.wav"/>
+      <prompt phrase="You may exit at any time by simply hanging up" filename="ivr-you_may_exit_by_hanging_up.wav"/>
+      <!-- Suggested additions
+       <prompt phrase="or" filename ="ivr-or.wav"/>
+       <prompt phrase="not" filename ="ivr-not.wav"/>
+       <prompt phrase="call" filename ="ivr-call.wav"/>
+       <prompt phrase="You may" filename ="ivr-you_may.wav"/>
+       -->
+    </ivr>
+    <misc>
+      <prompt phrase="This call has been secured" filename="call_secured.wav"/>
+      <prompt phrase="Followed by pound" filename="followed.wav"/>
+      <prompt phrase="If you are this person" filename="if_you_are_this_person.wav"/>
+      <prompt phrase="If you would like to" filename="if_you_would_like_to.wav"/>
+      <prompt phrase="Provide reference number" filename="provide_reference_number.wav"/>
+      <prompt phrase="Please enter extension you want to transfer to" filename="transfer1.wav"/>
+      <prompt phrase="Transfer" filename="transfer2.wav"/>
+      <prompt phrase="We are trying to reach" filename="we_are_trying_to_reach.wav"/>
+    </misc>
   </en>
 </language>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/freeswitch.spec
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/freeswitch.spec	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/freeswitch.spec	Mon Aug  4 21:29:58 2008
@@ -5,7 +5,7 @@
 Summary:      FreeSWITCH open source telephony platform
 License:      MPL
 Group:        Productivity/Telephony/Servers
-Version:      1.0.rc6
+Version:      1.0
 Release:      1
 URL:          http://www.freeswitch.org/
 Packager:     Michal Bielicki
@@ -16,11 +16,9 @@
 #AutoReqProv:  no
 
 %if 0%{?suse_version} > 100
-BuildRequires: alsa-devel
 #BuildRequires: openldap2-devel
 BuildRequires: lzo-devel
 %else
-BuildRequires: alsa-lib-devel
 BuildRequires: openldap-devel
 %endif
 BuildRequires: autoconf
@@ -35,6 +33,8 @@
 BuildRequires: pkgconfig
 BuildRequires: termcap
 BuildRequires: unixODBC-devel
+BuildRequires: gdbm-devel
+BuildRequires: db4-devel
 
 %if %{?suse_version:1}0
 %if 0%{?suse_version} > 910
@@ -153,7 +153,7 @@
 PASSTHRU_CODEC_MODULES="codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr"
 SPIDERMONKEY_MODULES="languages/mod_spidermonkey languages/mod_spidermonkey_curl languages/mod_spidermonkey_core_db languages/mod_spidermonkey_odbc languages/mod_spidermonkey_socket languages/mod_spidermonkey_teletone"
 APPLICATIONS_MODULES="applications/mod_commands applications/mod_conference applications/mod_dptools applications/mod_enum applications/mod_esf applications/mod_expr applications/mod_fifo applications/mod_limit applications/mod_rss applications/mod_voicemail applications/mod_fsv"
-ASR_TTS_MODULES="asr_tts/mod_openmrcp"
+ASR_TTS_MODULES="asr_tts/mod_openmrcp asr_tts/mod_pocketsphinx asr_tts/mod_flite"
 CODECS_MODULES="codecs/mod_ilbc codecs/mod_h26x codecs/mod_voipcodecs codecs/mod_speex"
 DIALPLANS_MODULES="dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml"
 DIRECTORIES_MODULES=
@@ -165,12 +165,12 @@
 LOGGERS_MODULES="loggers/mod_console loggers/mod_logfile loggers/mod_syslog"
 SAY_MODULES="say/mod_say_en"
 TIMERS_MODULES=
-DISABLED_MODULES="applications/mod_sountouch directories/mod_ldap languages/mod_java languages/mod_python languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox endpoints/mod_wanpipe event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf formats/mod_shout say/mod_say_it say/mod_say_es say/mod_say_nl"
+DISABLED_MODULES="applications/mod_soundtouch directories/mod_ldap languages/mod_java languages/mod_python languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox endpoints/mod_wanpipe event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf formats/mod_shout say/mod_say_it say/mod_say_es say/mod_say_nl"
 XML_INT_MODULES="xml_int/mod_xml_rpc  xml_int/mod_xml_curl xml_int/mod_xml_cdr"
 MYMODULES="$PASSTHRU_CODEC_MODULES $SPIDERMONKEY_MODULES $APPLICATIONS_MODULES $ASR_TTS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES $DOTNET_MODULES $ENDPOINTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES $SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES"
 
 export MODULES=$MYMODULES
-rm modules.conf
+test ! -f  modules.conf || rm -f modules.conf
 touch modules.conf
 for i in $MODULES; do echo $i >> modules.conf; done
 export VERBOSE=yes
@@ -180,7 +180,7 @@
 
 if test ! -f Makefile.in 
 then 
-   bootstrap.sh
+   ./bootstrap.sh
 fi
 
 
@@ -279,7 +279,7 @@
 %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
 %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/dialplan
 %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/directory
-%dir %attr(0750, freeswitch. daemon) %{prefix}/conf/directory/default
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/directory/default
 %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang
 %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/mrcp_profiles
 %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles
@@ -288,6 +288,10 @@
 %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/internal
 %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/external
 %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/jingle_profiles
+%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar
+%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar/model
+%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar/model/communicator
+%dir %attr(0750, freeswitch, daemon) %{prefix}/grammar/model/wsj1
 %ifos linux
 %config(noreplace) %attr(0644, freeswitch, daemon) /etc/monit.d/freeswitch.monitrc
 %endif
@@ -296,6 +300,7 @@
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.ttml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/cmudict.0.6d
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/acl.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/alsa.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/conference.conf.xml
@@ -314,8 +319,10 @@
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/logfile.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/modules.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/openmrcp.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/pocketsphinx.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/portaudio.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/post_load_modules.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/python.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/rss.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/sofia.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/switch.conf.xml
@@ -328,6 +335,7 @@
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_rpc.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/zeroconf.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/extensions/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/default/*
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/mrcp_profiles/*.xml
@@ -336,6 +344,9 @@
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/external/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/nat/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/jingle_profiles/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/Makefile
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/model/communicator/*
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/model/wsj1/*
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/htdocs/*
 %ifos linux
 /etc/ld.so.conf.d/*
@@ -361,6 +372,8 @@
 %{prefix}/mod/mod_rss.so*
 %{prefix}/mod/mod_voicemail.so*
 %{prefix}/mod/mod_openmrcp.so*
+%{prefix}/mod/mod_pocketsphinx.so*
+%{prefix}/mod/mod_flite.so*
 %{prefix}/mod/mod_ilbc.so* 
 %{prefix}/mod/mod_h26x.so*
 %{prefix}/mod/mod_voipcodecs.so* 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php	Mon Aug  4 21:29:58 2008
@@ -30,21 +30,36 @@
         $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
         $this -> xmlw -> writeAttribute('description', 'Console configuration');
 
+        $this -> xmlw -> startElement('mappings');
+	
+	$this -> xmlw -> startElement('map');
+        $this -> xmlw -> writeAttribute('name', 'all');
+        $this -> xmlw -> writeAttribute('value', 'notice,warning,error,crit,alert,info,debug');
+	$this -> xmlw -> endElement();
+
+        $this -> xmlw -> endElement();
+
+
+
+
         $this -> xmlw -> startElement('settings');
-        $this -> xmlw -> startElement('param');
+
+	$this -> xmlw -> startElement('param');
         $this -> xmlw -> writeAttribute('name', 'colorize');
         $this -> xmlw -> writeAttribute('value', 'true');
-        $this -> xmlw -> endElement();
-        $this -> xmlw -> endElement();
+	$this -> xmlw -> endElement();
+
+	$this -> xmlw -> startElement('param');
+        $this -> xmlw -> writeAttribute('name', 'loglevel');
+        $this -> xmlw -> writeAttribute('value', 'debug');
+	$this -> xmlw -> endElement();
+
+	$this -> xmlw -> endElement();
+
+
 
-        $this -> xmlw -> startElement('mappings');
-        $this -> xmlw -> startElement('map');
-        $this -> xmlw -> writeAttribute('name', 'all');
-        $this -> xmlw -> writeAttribute('value', 'notice,warning,error,crit,alert');
-        $this -> xmlw -> endElement();
-        $this -> xmlw -> endElement();
 
         $this -> xmlw -> endElement();
     }
 }
-?>
\ No newline at end of file
+?>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/dialplan_importer.php
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/dialplan_importer.php	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/dialplan_importer.php	Mon Aug  4 21:29:58 2008
@@ -39,12 +39,13 @@
  * @return null
 */
 function run_query($db, $query) {
+    syslog(LOG_INFO, $query);
     $affected = $db -> exec($query);
     if (MDB2::isError($affected)) {
         if (!defined('UNSUCCESSFUL_QUERY')) {
             define('UNSUCCESSFUL_QUERY', true);
         }
-        echo "$query\n";
+        echo "$query<br>\n";
         echo $affected -> getMessage() . "\n";
     }
 }
@@ -96,7 +97,7 @@
     $xml_file = $_FILES['file']['tmp_name'];
     move_uploaded_file($tmp_file, $xml_file);
     //echo $xml_file . "\n<br>";
-    $xml_str = sprintf('<?xml version="1.0" encoding="UTF-8" standalone="no"?>%s', file_get_contents($xml_file));
+    $xml_str = sprintf('%s', file_get_contents($xml_file));
     //echo $xml_str;
 }
 
@@ -111,27 +112,29 @@
     $global_weight = 100;
     foreach ($context -> extension as $extension) {
         $en = $extension['name'];
-        $ec = is_numeric($extension['continue']) ? $extension['continue'] : '0';
+        //printf("<pre>%s</pre>", print_r($extension, true));
+        $ec = $extension['continue'];
         $global_weight+=100;
         foreach ($extension -> condition as $condition) {
             //print_r($condition);
             $cf = $condition['field'];
-            $ce = $condition['expression'];
-            $cc = $condition['continue'];
+            $ce = addslashes($condition['expression']);
+            //echo "<pre>Condidtion Expression for $en:\n    before: " . $condition['expression'] . "\n    after: $ce</pre>";
+            $cb = $condition['break'];
             $weight = 0;
             foreach ($condition as $type => $action) {
                 //echo "-------------------$type-----------------------------\n";
                 $app_name = $action['application'];
-                $app_data = $action['data'];
+                $app_data = addslashes($action['data']);
                 $weight++;
                 //echo "$cn\t$en\t$cf\t$ce\t$cc\t$app_name\t$app_data\t$ec\t$global_weight\t$weight\n";
                 $query = sprintf('%s %s %s %s %s %s;',
-                "INSERT INTO curl_dialplan SET",
+                "INSERT INTO dialplan SET",
                 "context='$cn', extension='$en', condition_field='$cf',",
                 "condition_expression='$ce', application_name='$app_name',",
                 "application_data='$app_data', weight='$weight', type='$type',",
                 "ext_continue='$ec', global_weight='$global_weight',",
-                "condition_continue='$cc'"
+                "cond_break='$cb'"
                 );
                 run_query($db, $query);
             }
@@ -144,4 +147,6 @@
     echo "<h2>File Successfully Imported</h2>";
 }
 upload_form();
-?>
\ No newline at end of file
+
+//printf("<pre>%s</pre>", print_r($xml_obj, true);
+?>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/fs_curl.php
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/fs_curl.php	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/fs_curl.php	Mon Aug  4 21:29:58 2008
@@ -51,6 +51,7 @@
      * @return void
     */
     public function fs_curl() {
+	openlog('fs_curl', LOG_NDELAY | LOG_PID, LOG_LOCAL0);
         header('Content-Type: text/xml');
         $this -> open_xml();
         $this -> generate_request_array();
@@ -187,7 +188,7 @@
         }
         $xml_out = $this -> xmlw -> outputMemory();
         $this -> debug('---- Start XML Output ----');
-        $this -> debug($xml_out);
+        $this -> debug(explode("\n", $xml_out));
         $this -> debug('---- End XML Output ----');
         echo $xml_out;
         exit();
@@ -320,4 +321,4 @@
         }
     }
 }
-?>
\ No newline at end of file
+?>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/fs_dialplan.php
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/fs_dialplan.php	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/fs_dialplan.php	Mon Aug  4 21:29:58 2008
@@ -26,7 +26,7 @@
 
     /**
      * This is the method that determines the XML output. Customized dialplans can
-     * be easily created by adding a record to the dialplan_special table with the 
+     * be easily created by adding a record to the dialplan_special table with the
      * appropriate values. The php class MUST contain a "main()" method. The method
      * should write directly to the xmlw obj that's pased or take care of writing
      * out the xml itself and exiting as to not return.
@@ -120,7 +120,7 @@
      * @see fs_dialplan::get_dialplan
      * @param array $dpArray Multi-dimentional array from which we write the XML
      * @todo this method should REALLY be broken down into several smaller methods
-     * 
+     *
      */
     private function writeDialplan($dpArray) {
         //print_r($dpArray);
@@ -140,7 +140,7 @@
                         $ex_split = split(';', $extension);
                         $this -> xmlw -> startElement('extension');
                         $this -> xmlw -> writeAttribute('name', $ex_split[0]);
-                        if ($ex_split[1] > 0) {
+                        if (strlen($ex_split[1]) > 0) {
                             $this -> xmlw -> writeAttribute('continue', $ex_split[1]);
                         }
                         $this -> debug($conditions);

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/global_defines.php
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/global_defines.php	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/PHP/fs_curl/global_defines.php	Mon Aug  4 21:29:58 2008
@@ -43,7 +43,7 @@
 /**
  * Define debug level... should not be used in production for performance reasons
  */
-define('FS_CURL_DEBUG', 0);
+define('FS_CURL_DEBUG', 9);
 
 /**
  * define how debugging should be done (depends on FS_CURL_DEBUG)
@@ -62,4 +62,4 @@
 
 
 //define('', '');
-?>
\ No newline at end of file
+?>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/perl/fspb
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/perl/fspb	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/intralanman/perl/fspb	Mon Aug  4 21:29:58 2008
@@ -14,6 +14,7 @@
 }
 
 my $ua = new LWP::UserAgent;
+$ua->env_proxy(); 
 my $url = 'http://pastebin.freeswitch.org/';
 my $line;
 my $text;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj	Mon Aug  4 21:29:58 2008
@@ -40,6 +40,12 @@
     <Compile Include="Call.cs" />
     <Compile Include="CallManager.cs" />
     <Compile Include="CallStateEvent.cs" />
+    <Compile Include="ChannelWatcher.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="ChannelWatcher.Designer.cs">
+      <DependentUpon>ChannelWatcher.cs</DependentUpon>
+    </Compile>
     <Compile Include="Extension.cs" />
     <Compile Include="Form1.cs">
       <SubType>Form</SubType>
@@ -52,6 +58,10 @@
     </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="ChannelWatcher.resx">
+      <SubType>Designer</SubType>
+      <DependentUpon>ChannelWatcher.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Form1.resx">
       <SubType>Designer</SubType>
       <DependentUpon>Form1.cs</DependentUpon>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/Program.cs	Mon Aug  4 21:29:58 2008
@@ -14,7 +14,7 @@
         {
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
-            Application.Run(new Form1());
+            Application.Run(new ChannelWatcher());
         }
     }
 }
\ No newline at end of file

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs	Mon Aug  4 21:29:58 2008
@@ -1,8 +1,7 @@
 using System;
-using System.Collections.Generic;
+using System.Collections.Specialized;
 using System.IO;
-using System.Reflection;
-using System.Text;
+using System.Threading;
 
 namespace FreeSwitch.EventSocket.Test
 {
@@ -10,18 +9,70 @@
     {
         static void Main(string[] args)
         {
-            EventManager mgr = new EventManager();
+            /*EventManager mgr = new EventManager();
             mgr.Subscribe(Events.GetChannelEvents());
             mgr.Start("localhost");
             Console.ReadLine();
+            */
+            Program p = new Program();
+            p.Test();
 
-            string buffer = File.ReadAllText("..\\..\\..\\watcherRaw.log");
-            int bufLen = buffer.Length;
+        }
+
+        private int _counter;
+        private EventParser _parser;
+        Random _rand = new Random((int)DateTime.Now.Ticks);
+
+        public void Test()
+        {
+            _parser = new EventParser();
+            string text = File.ReadAllText("C:\\mymsgs.txt");
+            Thread[] threads = new Thread[5];
+            for (int i = 0; i < 5; ++i)
+                threads[i] = new Thread(FeedStream);
+
+            while (StreamFeeder(ref text)) ;
+            //Parse(text);
+/*
+            Parse(File.ReadAllText("C:\\events1.txt"));
+            Parse(File.ReadAllText("C:\\events2.txt"));
+            Parse(File.ReadAllText("C:\\events3.txt"));
+*/
+        }
+
+        public void FeedStream()
+        {
+            
+        }
+        public bool StreamFeeder(ref string text)
+        {
+            int length;
+            if (text.Length < 5)
+                length = text.Length;
+            else
+                length = _rand.Next(text.Length / 2);
+
+            string myText = text.Substring(0, length);
+            Parse(myText);
+            text = text.Remove(0, length);
+            return text.Length > 0;
+        }
+
+        public void Parse(string text)
+        {
+            _parser.Append(text);
+            PlainEventMsg msg = _parser.ParseOne();
+            while (msg != null)
+            {
+                ++_counter;
+
+                NameValueCollection pars = msg.ParseBody(true);
+                Console.WriteLine(pars["event-name"]);
+
+                msg = _parser.ParseOne();
+            }
 
-            EventParser ep = new EventParser(buffer);
-            //int cnt = 0;
-            EventSocket es = new EventSocket();
-            es.Setup();
+            
         }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/ChannelEvent.cs	Mon Aug  4 21:29:58 2008
@@ -1,7 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace FreeSwitch.EventSocket
 {
     public class ChannelEvent : EventBase
@@ -62,5 +58,12 @@
 
             return true;
         }
+
+        public override string ToString()
+        {
+            return
+                "ChannelEvent(" + _uniqueId + " [" + _callDirection + "] " + _answerState +
+                ", channelInfo{" + _channelInfo + "})";
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelAnswer.cs	Mon Aug  4 21:29:58 2008
@@ -2,5 +2,9 @@
 {
     public class EventChannelAnswer : EventChannelState
     {
+        public override string ToString()
+        {
+            return "ChannelAnswer." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelApplication.cs	Mon Aug  4 21:29:58 2008
@@ -1,10 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace FreeSwitch.EventSocket
 {
     public class EventChannelApplication : EventChannelState
     {
+        public override string ToString()
+        {
+            return "ChannelApplication." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelBridge.cs	Mon Aug  4 21:29:58 2008
@@ -1,10 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace FreeSwitch.EventSocket
 {
     public class EventChannelBridge : EventChannelState
     {
+        public override string ToString()
+        {
+            return "ChannelBridge." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelCreate.cs	Mon Aug  4 21:29:58 2008
@@ -2,5 +2,9 @@
 {
     public class EventChannelCreate : ChannelEvent
     {
+        public override string ToString()
+        {
+            return "ChannelCreate." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelDestroy.cs	Mon Aug  4 21:29:58 2008
@@ -1,10 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace FreeSwitch.EventSocket
 {
     public class EventChannelDestroy : EventChannelState
     {
+        public override string ToString()
+        {
+            return "ChannelDestroy." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs	Mon Aug  4 21:29:58 2008
@@ -28,5 +28,10 @@
 
             return true;
         }
+
+        public override string ToString()
+        {
+            return "EventChannelExecute(" + _appName + ", '" + _arguments + "')." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs	Mon Aug  4 21:29:58 2008
@@ -28,6 +28,11 @@
 
             return true;
         }
+
+        public override string ToString()
+        {
+            return "ExecuteComplete(" + _appName + ", '" + _arguments + "')." + base.ToString();
+        }
     }
 }
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelHangup.cs	Mon Aug  4 21:29:58 2008
@@ -33,6 +33,10 @@
             return true;
         }
 
+        public override string ToString()
+        {
+            return "ChannelHangup(" + _hangupCause + ")." + base.ToString();
+        }
     }
 
     public enum HangupCause

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOriginate.cs	Mon Aug  4 21:29:58 2008
@@ -1,11 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace FreeSwitch.EventSocket
 {
     public class EventChannelOriginate : ChannelEvent
     {
-
+        public override string ToString()
+        {
+            return "ChannelOriginate." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelOutgoing.cs	Mon Aug  4 21:29:58 2008
@@ -1,11 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace FreeSwitch.EventSocket
 {
     public class EventChannelOutgoing : EventChannelState
     {
-
+        public override string ToString()
+        {
+            return "ChannelOutgoing." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelProgress.cs	Mon Aug  4 21:29:58 2008
@@ -1,10 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace FreeSwitch.EventSocket
 {
     public class EventChannelProgress : EventChannelState
     {
+        public override string ToString()
+        {
+            return "ChannelProgress" + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelState.cs	Mon Aug  4 21:29:58 2008
@@ -2,8 +2,15 @@
 {
     public class EventChannelState : ChannelEvent
     {
-        private PartyInfo _caller = new PartyInfo();
-        private PartyInfo _originator = new PartyInfo();
+        private const string Yes = "yes";
+        private const string CallerTag = "caller-";
+        private const string OriginatorTag = "originator-";
+        private const string OriginateeTag = "originatee-";
+        private const string OtherLegTag = "other-leg-";
+        private const string ScreenBitTag = "screen-bit";
+        private PartyInfo _caller = PartyInfo.Empty;
+        private PartyInfo _originator = PartyInfo.Empty;
+        private PartyInfo _otherLeg = PartyInfo.Empty;
         private bool _screenBit = false;
 
         /// <summary>
@@ -34,30 +41,58 @@
             set { _screenBit = value; }
         }
 
+        /// <summary>
+        /// Other leg of call.
+        /// </summary>
+        public PartyInfo OtherLeg
+        {
+            get { return _otherLeg; }
+            set { _otherLeg = value; }
+        }
+
         public override bool ParseCommand(string name, string value)
         {
-            if (name == "screen-bit")
+            if (name == ScreenBitTag)
             {
-                ScreenBit = value == "yes";
+                ScreenBit = value == Yes;
                 return true;
             }
-            else if (name.Length > 11 && name.Substring(0, 11) == "originator-"
-                     || name.Length > 11 && name.Substring(0, 11) == "originatee-")
+            else if (name.Length > 11 && name.Substring(0, 11) == OriginatorTag
+                     || name.Length > 11 && name.Substring(0, 11) == OriginateeTag)
             {
-                if (_originator == null)
+                if (_originator == PartyInfo.Empty)
                     _originator = new PartyInfo();
 
                 return _originator.Parse(name.Substring(11), value);
             }
-            else if (name.Length > 7 && name.Substring(0, 7) == "caller-")
+            else if (name.Length > 7 && name.Substring(0, 7) == CallerTag)
             {
-                if (_caller == null)
+                if (_caller == PartyInfo.Empty)
                     _caller = new PartyInfo();
 
                 return _caller.Parse(name.Substring(7), value);
             }
+            else if (name.Length > 10 && name.Substring(0, 10) == OtherLegTag)
+            {
+                if (_otherLeg == PartyInfo.Empty)
+                    _otherLeg = new PartyInfo();
+
+                return _otherLeg.Parse(name.Substring(10), value);
+            }
             else
                 return base.ParseCommand(name, value);
         }
+
+        public override string ToString()
+        {
+            string temp = "ChannelState(";
+            if (Caller != PartyInfo.Empty)
+                temp += " Caller{" + Caller + "}";
+            if (Originator != PartyInfo.Empty)
+                temp += " Originator{" + Originator + "}";
+            if (OtherLeg != PartyInfo.Empty)
+                temp += " OtherLeg{" + OtherLeg + "}";
+            return temp + ")." + base.ToString();
+        }
     }
 }
\ No newline at end of file

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnbridge.cs	Mon Aug  4 21:29:58 2008
@@ -1,10 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace FreeSwitch.EventSocket
 {
     public class EventChannelUnbridge : EventChannelState
     {
+        public override string ToString()
+        {
+            return "ChannelUnbridge." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelUnpark.cs	Mon Aug  4 21:29:58 2008
@@ -1,10 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace FreeSwitch.EventSocket
 {
     public class EventChannelUnpark : EventChannelState
     {
+        public override string ToString()
+        {
+            return "ChannelUnpark." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventCodec.cs	Mon Aug  4 21:29:58 2008
@@ -2,5 +2,9 @@
 {
     public class EventCodec : EventChannelState
     {
+        public override string ToString()
+        {
+            return "Codec." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmf.cs	Mon Aug  4 21:29:58 2008
@@ -31,5 +31,10 @@
 
             return base.ParseCommand(name, value);
         }
+
+        public override string ToString()
+        {
+            return "Dtmf(" + _digit + ")." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventDtmfStatus.cs	Mon Aug  4 21:29:58 2008
@@ -27,5 +27,10 @@
 
             return base.ParseCommand(name, value);
         }
+
+        public override string ToString()
+        {
+            return "DtmfStatus." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelInfo.cs	Mon Aug  4 21:29:58 2008
@@ -9,8 +9,10 @@
         SoftExecute,   // Channel is in a passive transmit state
         Execute,       // Channel is executing it's dialplan 
         ExchangeMedia, // Channel is exchanging media
+        Park,
         ConsumeMedia,  // Channel is consuming media
         Hibernate,     // Channel is in a sleep state
+        Reset,
         Hangup,        // Channel is flagged for hangup and ready to end
         Done,          // Channel is ready to be destroyed and out of the state machine
         Unknown
@@ -21,9 +23,9 @@
     {
         private ChannelState _state;
         private int _stateNumber;
-        private string _profile;
-        private string _address;
-        private string _hostName;
+        private string _profile = string.Empty;
+        private string _address = string.Empty;
+        private string _hostName = string.Empty;
         private string _protocol = string.Empty;
         private string _readCodecName;
         private int _readCodecRate;
@@ -209,10 +211,12 @@
                 case "CS_SOFT_EXECUTE": return ChannelState.SoftExecute;
                 case "CS_EXECUTE": return ChannelState.Execute;
                 case "CS_EXCHANGE_MEDIA": return ChannelState.ExchangeMedia;
+                case "CS_PARK": return ChannelState.Park;
                 case "CS_CONSUME_MEDIA": return ChannelState.ConsumeMedia;
                 case "CS_HIBERNATE": return ChannelState.Hibernate;
                 case "CS_HANGUP": return ChannelState.Hangup;
                 case "CS_DONE": return ChannelState.Done;
+                case "CS_RESET": return ChannelState.Reset;
                 default: return ChannelState.Unknown;
             }
         }
@@ -221,5 +225,10 @@
         {
             return "Unknown";
         }
+
+        public override string ToString()
+        {
+            return _address + "@" + _hostName + ": " + _state;
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs	Mon Aug  4 21:29:58 2008
@@ -25,6 +25,7 @@
         private readonly IList<ChannelVariable> _variables = new List<ChannelVariable>();
         private string _callerIdName = null;
         private string _callerIdNumber = null;
+        private bool _varsAdded = false;
 
         public Originate()
         {}
@@ -73,9 +74,13 @@
         {
             get
             {
-                _variables.Add(new ChannelVariable("origination_caller_id_name", CallerIdName ?? _caller.Extension));
-                if (!string.IsNullOrEmpty(_callerIdNumber))
-                    _variables.Add(new ChannelVariable("origination_caller_id_number", _callerIdNumber));
+                if (!_varsAdded)
+                {
+                    _variables.Add(new ChannelVariable("origination_caller_id_name", CallerIdName ?? _caller.Extension));
+                    if (!string.IsNullOrEmpty(_callerIdNumber))
+                        _variables.Add(new ChannelVariable("origination_caller_id_number", _callerIdNumber));
+                    _varsAdded = true;
+                }
 
                 string variables = string.Empty;
                 foreach (ChannelVariable var in _variables)

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs	Mon Aug  4 21:29:58 2008
@@ -13,8 +13,8 @@
     {
         private readonly EventSocket _socket = new EventSocket();
         public event EventHandler EventReceived;
-        private EventsWriter _writer;
-        private TextWriter _myWriter;
+        private readonly EventsWriter _writer;
+        private readonly TextWriter _rawLog;
         public string Password
         {
             set { _socket.Password = value; }
@@ -22,13 +22,14 @@
 
         public EventManager()
         {
-            _writer = MyWriter;
-            _myWriter = new StreamWriter(new FileStream("C:\\temp\\WatcherRow.log", FileMode.Create, FileAccess.Write, FileShare.ReadWrite));
+            _writer = RawWriter;
+            _rawLog = new StreamWriter(new FileStream("C:\\temp\\WatcherRaw.log", FileMode.Create, FileAccess.Write, FileShare.ReadWrite));
         }
 
-        private void MyWriter(string text)
+        private void RawWriter(string text)
         {
-            _myWriter.Write(text);
+            _rawLog.Write(text);
+            _rawLog.Flush();
         }
 
 
@@ -68,7 +69,7 @@
 
         protected void OnMessage(PlainEventMsg msg)
         {
-            NameValueCollection parameters = msg.BodyToNameValue(true);
+            NameValueCollection parameters = msg.ParseBody(true);
             string eventName = parameters["event-name"];
             if (eventName == null)
                 return;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs	Mon Aug  4 21:29:58 2008
@@ -1,99 +1,190 @@
-using EventSocketParser;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
 
 namespace FreeSwitch.EventSocket
 {
     public class EventParser
     {
-        private PlainEventMsg _msg;
-        private readonly StringParser _parser;
+        private static readonly char[] BugWorkaround = {'C', 'o', 'n', 't', 'e', 'n', 't', '-'};
+        private readonly StringBuilder _text = new StringBuilder();
+        private readonly Queue<string> _piecesToAppend = new Queue<string>();
 
-        public EventParser(string text)
+        public string Text
         {
-            _parser = new StringParser(text);
+            get { return _text.ToString(); }
         }
 
-        public PlainEventMsg ParseMessage()
+        internal static void ParseHeaders(PlainEventMsg msg, string header)
         {
-            _parser.ClearSavedPositions();
-            _msg = new PlainEventMsg();
-
-            // Save pos if we cant parse the whole message
-            _parser.SavePos();
-
-            ReadHeader();
-            if (!_msg.ValidateHeader())
-            {
-                _parser.RestorePos();
-                return null;
-            }
-
-            // skip empty line between body and header
-            _parser.ReadLine(true);
-
-            // we got no body.
-            if (_msg.ContentLength == -1)
-                return _msg;
-
-            // Unfortunately, \n\n doesnt appear after all content.
-            if (_msg.ContentLength != 0)
-                _msg.Body = _parser.Read(_msg.ContentLength);
-            else
-                _msg.Body = _parser.ReadToEmptyLine();
-
-            // assume that we have not got a complete packet yet.
-            if (!_msg.Validate())
-            {
-                _parser.RestorePos();
-                return null;
-            }
-
-            return _msg;
-        }
-
-        public bool ReadHeader()
-        {
-            // skip empty lines
-            while (!_parser.EOF && _parser.PeekWord(true, true) == string.Empty)
-                _parser.ReadLine(false);
-
-            if (_parser.EOF)
-                return false;
-
-            string name = _parser.Read(':', true);
+            StringParser parser = new StringParser(header);
+            string name = parser.Read(':', true);
             while (name != string.Empty)
             {
                 switch (name)
                 {
                     case "Content-Length":
-                        _msg.ContentLength = int.Parse(_parser.ReadLine(true));
+                        msg.ContentLength = int.Parse(parser.ReadLine(true));
                         break;
                     case "Content-Type":
-                        _msg.ContentType = _parser.ReadLine(true);
+                        msg.ContentType = parser.ReadLine(true);
                         break;
                     case "Reply-Text":
-                        _msg.Body = _parser.ReadLine();
+                        msg.Body = parser.ReadLine(true);
                         break;
                 }
 
                 // empty line == end of header
-                if (_parser.EOL)
+                if (parser.EOL)
                     break;
 
-                name = _parser.Read(':', true);
+                name = parser.Read(':', true);
             }
+        }
+        /*
+        private int IsLineBreaks(int pos)
+        {
+            if (pos > 0 && Text[pos] == '\n' && Text[pos - 1] == '\n')
+                return 1;
+            if (pos > 3 && Text[pos] == '\n' && Text[pos - 1] == '\r'
+                && Text[pos - 2] == '\n' && Text[pos - 3] == '\r')
+                return 3;
+            return 0;
+        }
+        */
+        public void Clear()
+        {
+            lock (Text)
+                _text.Length = 0;
+        }
 
-            return _msg.ContentType != string.Empty;
+        private void IgnoreLineBreaks(ref int i)
+        {
+            while (i < Text.Length && (Text[i] == '\n' || Text[i] == '\r'))
+                ++i;
         }
 
-        public void Append(string value)
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        /// <exception cref="InvalidDataException">If parsing failed due to invalid format.</exception>
+        public PlainEventMsg ParseOne()
         {
-            _parser.RemoveUsedContent();
-            _parser.Append(value);
+            // Move queue to text
+            lock (_piecesToAppend)
+            {
+                while (_piecesToAppend.Count > 0)
+                _text.Append(_piecesToAppend.Dequeue());
+            }
+
+            PlainEventMsg plainEvent;
+            lock (Text)
+            {
+                int i = 0;
+
+                // find complete header
+                bool found = false;
+                for (; i < Text.Length - 1; ++i)
+                {
+                    if (Text[i] == '\n' && Text[i+1] == '\n')
+                    {
+                        found = true;
+                        break;
+                    }
+                }
+                if (!found)
+                    return null;
+
+                // extract header
+                char[] chars = new char[i];
+                Text.CopyTo(0, chars, 0, i);
+                string headers = new string(chars);
+#if DEBUG
+                Console.WriteLine("====================================");
+                Console.WriteLine("Headers: ");
+                Console.WriteLine(headers);
+#endif
+                IgnoreLineBreaks(ref i);
+
+                plainEvent = new PlainEventMsg();
+                ParseHeaders(plainEvent, headers);
+
+                // we got a body?
+                if (plainEvent.ContentLength > 0)
+                {
+                    // Start of Empty header bugfix
+                    // FS seems to send a header with content-length without sending an actual body
+                    // this will eat that kind of header.
+                    if (Text.Length >= BugWorkaround.Length + i)
+                    {
+                        found = true;
+                        for (int index = 0; index < BugWorkaround.Length; ++index)
+                        {
+                            if (Text[index + i] != BugWorkaround[index])
+                            {
+                                found = false;
+                                break;
+                            }
+                        }
+                        if (found)
+                        {
+                            Text.Remove(0, i);
+                            Console.WriteLine("Removing empty content header.");
+                            return null;
+                        }
+                    }
+                    // end of bugfix.
+
+                    // not enough data for body.
+                    if (plainEvent.ContentLength + i > Text.Length)
+                        return null;
+
+                    // extract body
+                    chars = new char[plainEvent.ContentLength];
+                    Text.CopyTo(i, chars, 0, plainEvent.ContentLength);
+                    plainEvent.Body = new string(chars);
+
+                    // check for errors.
+                    int pos = plainEvent.Body.IndexOf("\n\n");
+                    if (pos < plainEvent.Body.Length - 2)
+                    {
+                        Console.WriteLine("Fucked up event");
+                        Console.WriteLine("Header");
+                        Console.WriteLine(headers);
+                        Console.WriteLine("Body");
+                        Console.WriteLine(plainEvent.Body);
+                        Console.WriteLine("=========================== EVERYTHING in _text ==============================");
+                        Console.WriteLine(Text);
+                        throw new InvalidDataException("Fucked up event: " + Text);
+                    }
+
+#if DEBUG
+                    Console.WriteLine("Body:");
+                    Console.WriteLine(plainEvent.Body);
+#endif
+                    if (plainEvent.Body.Length < plainEvent.ContentLength)
+                        throw new InvalidDataException("Body contents are too small!");
+
+                    // Move forward to next header
+                    i += plainEvent.ContentLength;
+                    IgnoreLineBreaks(ref i);
+                }
+
+
+                // remove header( + body) from buffer
+                Text.Remove(0, i);
+            }
+
+            return plainEvent;
         }
 
-        public void Clear()
+
+        public void Append(string text)
         {
-            _parser.Clear();
+            lock (_piecesToAppend)
+                _piecesToAppend.Enqueue(text);
         }
     }
 }
\ No newline at end of file

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs	Mon Aug  4 21:29:58 2008
@@ -24,18 +24,30 @@
         private bool _autoConnect = true;
         private Events _events;
         private string _hostName;
-        private readonly EventParser _parser = new EventParser(string.Empty);
+        private readonly EventParser _parser = new EventParser();
         public event DataHandler DataReceived;
         private string _password = "ClueCon";
         private int _port = 8021;
-        private object _lockobj = new object();
+        private readonly object _lockobj = new object();
         private readonly byte[] _readBuffer = new byte[8192];
-        private string _temp = string.Empty;
-        private Socket _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+        private Socket _socket;
         private NetworkStream _stream;
         private Timer _timer;
         private bool _authed = false;
         const int RetryTimeout = 5000;
+        private bool _parsing = false;
+
+        public EventSocket()
+        {
+            CreateSocket();
+        }
+
+        private void CreateSocket()
+        {
+            _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+            _socket.NoDelay = true;
+            _socket.ReceiveBufferSize = 65535;
+        }
 
         public string Password
         {
@@ -112,15 +124,18 @@
 
         private void OnReadCompleted(IAsyncResult ar)
         {
-            int bytesRead;
+            string inbuffer;
             try
             {
-                bytesRead = _stream.EndRead(ar);
+                int bytesRead = _stream.EndRead(ar);
                 if (bytesRead == 0)
                 {
                     HandleDisconnect();
                     return;
                 }
+                inbuffer = Encoding.ASCII.GetString(_readBuffer, 0, bytesRead);
+                _parser.Append(inbuffer);
+                BeginRead();
             }
             catch (IOException)
             {
@@ -129,14 +144,22 @@
                 return;
             }
 
-            string text = Encoding.ASCII.GetString(_readBuffer, 0, bytesRead);
             if (DataReceived != null)
-                DataReceived(text);
-            _temp += text;
-            _parser.Append(text);
-            ParseMessages();
+                DataReceived(inbuffer);
 
-            _stream.BeginRead(_readBuffer, 0, _readBuffer.Length, OnReadCompleted, null);
+            try
+            {
+                ParseMessages();
+            }
+            catch (InvalidDataException)
+            {
+                HandleDisconnect();
+            }
+            catch (ArgumentException)
+            {
+                Console.WriteLine(_parser.Text);
+                HandleDisconnect();
+            }
         }
 
         /// <summary>
@@ -176,39 +199,56 @@
             _stream.Write(bytes, 0, bytes.Length);
         }
 
+        static readonly object locker = new object();
         private void ParseMessages()
         {
-            PlainEventMsg msg = _parser.ParseMessage();
-            while (msg != null)
+            
+            lock (locker)
             {
-                if (msg.ContentType == "auth/request")
-                {
-                    AuthCommand cmd = new AuthCommand(_password);
-                    cmd.ReplyReceived += OnAuthed;
-                    _commands.Enqueue(cmd);
-                    Write(cmd + "\n\n");
-                }
-                else if (msg.ContentType == "command/reply"
-                         || msg.ContentType == "api/response")
+                if (_parsing)
+                    return;
+                _parsing = true;
+            }
+
+            try
+            {
+                PlainEventMsg msg = _parser.ParseOne();
+                while (msg != null)
                 {
-                    if (_commands.Count > 0)
+                    if (msg.ContentType == "auth/request")
                     {
-                        CmdBase cmd = _commands.Dequeue();
-                        cmd.HandleReply(cmd.CreateReply(msg.Body));
+                        AuthCommand cmd = new AuthCommand(_password);
+                        cmd.ReplyReceived += OnAuthed;
+                        _commands.Enqueue(cmd);
+                        Write(cmd + "\n\n");
+                    }
+                    else if (msg.ContentType == "command/reply"
+                             || msg.ContentType == "api/response")
+                    {
+                        if (_commands.Count > 0)
+                        {
+                            CmdBase cmd = _commands.Dequeue();
+                            cmd.HandleReply(cmd.CreateReply(msg.Body.Trim()));
+                        }
+                        else
+                        {
+                            Console.ForegroundColor = ConsoleColor.Red;
+                            Console.WriteLine("Got command reply or api response, but no actual command/api: " + msg.Body);
+                            Console.ForegroundColor = ConsoleColor.Gray;
+                        }
                     }
                     else
                     {
-                        Console.ForegroundColor = ConsoleColor.Red;
-                        Console.WriteLine("Got command reply or api response, but no actual command/api: " + msg.Body);
-                        Console.ForegroundColor = ConsoleColor.Gray;
+                        if (MessageReceived != null)
+                            MessageReceived(msg);
                     }
-                }
-                else
-                {
-                    if (MessageReceived != null)
-                        MessageReceived(msg);
-                }
-                msg = _parser.ParseMessage();
+                    msg = _parser.ParseOne();
+                }                
+            }
+            finally
+            {
+                lock (locker)
+                    _parsing = false;
             }
         }
 
@@ -223,7 +263,7 @@
             _parser.Clear();
             _authed = false;
             _socket.Close();
-            _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+            CreateSocket();
             if (_stream != null)
             {
                 _stream.Dispose();

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs	Mon Aug  4 21:29:58 2008
@@ -155,5 +155,10 @@
             }
             return true;
         }
+
+        public override string ToString()
+        {
+            return "Base(" + m_name + ")";
+        }
     }
 }
\ No newline at end of file

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj	Mon Aug  4 21:29:58 2008
@@ -43,10 +43,12 @@
     <Compile Include="ChannelEvents\EventChannelBridge.cs" />
     <Compile Include="ChannelEvents\ChannelEvent.cs" />
     <Compile Include="ChannelEvents\EventChannelAnswer.cs" />
+    <Compile Include="ChannelEvents\EventChannelPark.cs" />
     <Compile Include="ChannelEvents\EventChannelProgress.cs" />
     <Compile Include="ChannelEvents\EventChannelUnbridge.cs" />
     <Compile Include="ChannelEvents\EventChannelUnpark.cs" />
     <Compile Include="ChannelEvents\EventCodec.cs" />
+    <Compile Include="ChannelEvents\EventSessionCrash.cs" />
     <Compile Include="ChannelInfo.cs" />
     <Compile Include="Commands\AnyCommand.cs">
     </Compile>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PartyInfo.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PartyInfo.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PartyInfo.cs	Mon Aug  4 21:29:58 2008
@@ -1,12 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace FreeSwitch.EventSocket
 {
     public class PartyInfo
     {
-        private string m_userName = string.Empty;
+        public static PartyInfo Empty = new PartyInfo();
+        private string _userName = string.Empty;
         private string m_dialplan = string.Empty;
         private string m_callerIdName = string.Empty;
         private string m_callerIdNumber = string.Empty;
@@ -14,14 +11,14 @@
         private string m_uniqueId = string.Empty;
         private string m_source = string.Empty;
         private string m_context = string.Empty;
-        private string m_channelName = string.Empty;
+        private string _channelName = string.Empty;
         private bool m_screenBit;
         private bool m_privacyHideName;
         private bool m_privacyHideNumber;
 
         public PartyInfo()
         {
-            m_userName = string.Empty;
+            _userName = string.Empty;
             m_dialplan = string.Empty;
             m_callerIdName = string.Empty;
         }
@@ -70,8 +67,8 @@
 
         public string ChannelName
         {
-            get { return m_channelName; }
-            set { m_channelName = value; }
+            get { return _channelName; }
+            set { _channelName = value; }
         }
 
         public bool ScreenBit
@@ -94,8 +91,8 @@
 
         public string UserName
         {
-            get { return m_userName; }
-            set { m_userName = value; }
+            get { return _userName; }
+            set { _userName = value; }
         }
 
         public bool Parse(string name, string value)
@@ -103,7 +100,7 @@
             switch (name)
             {
                 case "username":
-                    m_userName = value;
+                    _userName = value;
                     break;
                 case "dialplan":
                     Dialplan = value;
@@ -146,5 +143,11 @@
 
         }
 
+        public override string ToString()
+        {
+            return _channelName + "(" + CallerIdName + "/" + CallerIdNumber + ") id: "+UniqueId+", destination: " + DestinationNumber;
+            
+        }
+
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PlainEventMsg.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PlainEventMsg.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/PlainEventMsg.cs	Mon Aug  4 21:29:58 2008
@@ -1,6 +1,5 @@
 using System;
 using System.Collections.Specialized;
-using EventSocketParser;
 
 namespace FreeSwitch.EventSocket
 {
@@ -50,7 +49,7 @@
         }
 
 
-        public NameValueCollection BodyToNameValue(bool urlDecodeValues)
+        public NameValueCollection ParseBody(bool urlDecodeValues)
         {
             NameValueCollection items = new NameValueCollection();
             StringParser parser = new StringParser(_body);
@@ -64,7 +63,7 @@
                     {
                         items.Add(name.ToLower(), Uri.UnescapeDataString(value));
                     }
-                    catch (UriFormatException) 
+                    catch (UriFormatException)
                     {
                         // add the value unformatted
                         items.Add(name.ToLower(), value);
@@ -77,4 +76,4 @@
             return items;
         }
     }
-}
+}
\ No newline at end of file

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresence.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresence.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresence.cs	Mon Aug  4 21:29:58 2008
@@ -10,7 +10,7 @@
         //private string _expires; //not "presencein/register", "presenceout/register"
         private string _eventType = string.Empty;
         private string _login = string.Empty;
-        private EventChannelState _channelState;
+        private EventChannelState _channelState = new EventChannelState();
 
         public string Login
         {
@@ -71,6 +71,7 @@
          * */
         public override bool ParseCommand(string name, string value)
         {
+            bool res = _channelState.ParseCommand(name, value);
             switch (name)
             {
                 case "status":
@@ -87,6 +88,7 @@
                     break;
 
                 default:
+
                     if (name.Length > 7 && name.Substring(0, 7) == "caller-")
                     {
                         if (Caller == null)
@@ -98,15 +100,16 @@
                         if (base.ParseCommand(name, value))
                             return true;
                         else
-                        {
-                            if (_channelState == null)
-                                _channelState = new EventChannelState();
-                            return _channelState.ParseCommand(name, value);
-                        }
+                            return res;
                     }
                         
             }
             return true;
         }
+
+        public override string ToString()
+        {
+            return "Presence(" + _login + ", " + _status + ")." + _channelState + "." + base.ToString();
+        }
     }
 }
\ No newline at end of file

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceIn.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceIn.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceIn.cs	Mon Aug  4 21:29:58 2008
@@ -2,5 +2,9 @@
 {
     public class EventPresenceIn : EventPresence
     {
+        public override string ToString()
+        {
+            return "PresenceIn." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceOut.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceOut.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceOut.cs	Mon Aug  4 21:29:58 2008
@@ -2,7 +2,11 @@
 {
     public class EventPresenceOut : EventPresence
     {
-       
+        public override string ToString()
+        {
+            return "PresenceOut." + base.ToString();
+        }
+
 
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs	Mon Aug  4 21:29:58 2008
@@ -6,5 +6,11 @@
 {
     class EventPresenceProbe : EventPresence
     {
+        public override string ToString()
+        {
+            return "PresenceProbe." + base.ToString();
+        }
+
     }
+
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventRoster.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventRoster.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventRoster.cs	Mon Aug  4 21:29:58 2008
@@ -1,7 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
 namespace FreeSwitch.EventSocket
 {
     class EventRoster : SipEvent

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaExpire.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaExpire.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaExpire.cs	Mon Aug  4 21:29:58 2008
@@ -59,5 +59,10 @@
             return true;
 
         }
+
+        public override string ToString()
+        {
+            return "SofiaExpire(" + _userName + "@" + _domain + ")." + base.ToString();
+        }
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaRegister.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaRegister.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventSofiaRegister.cs	Mon Aug  4 21:29:58 2008
@@ -88,5 +88,12 @@
             }
             return true;
         }
+
+        public override string ToString()
+        {
+            return "SofiaRegister(" + _user + "@" + _domain + ", " + _expires + ")." + base.ToString();
+        }
     }
+
+
 }
\ No newline at end of file

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/SipEvent.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/SipEvent.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/SipEvent.cs	Mon Aug  4 21:29:58 2008
@@ -35,5 +35,10 @@
             }
             return true;
         }
+
+        public override string ToString()
+        {
+            return "Sip(" + _from + ")." + base.ToString();
+        }
     }
 }
\ No newline at end of file

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs	Mon Aug  4 21:29:58 2008
@@ -1,6 +1,6 @@
 using System.Collections.Generic;
 
-namespace EventSocketParser
+namespace FreeSwitch.EventSocket
 {
     internal class StringParser
     {
@@ -44,12 +44,8 @@
 
         public void RestorePos()
         {
-            _pos = _savedPositions.Pop();
-        }
-
-        public void RemoveSavedPos()
-        {
-            _savedPositions.Pop();
+            if (_savedPositions.Count > 0)
+                _pos = _savedPositions.Pop();
         }
 
         public void ClearSavedPositions()
@@ -59,17 +55,19 @@
 
         private bool IsEOF(int pos)
         {
-            return pos >= _text.Length - 1;
+            return pos >= _text.Length;
         }
 
         public bool IsEmptyLine(bool skipWhitespaces)
         {
             if (EOF)
                 return false;
-            else if (_pos == _text.Length - 1)
+            else if (_pos < _text.Length - 1)
                 return _text[_pos] == '\n';
-            else
+            else if (_pos < _text.Length - 2)
                 return _text[_pos] == '\r' && _text[_pos + 1] == '\n';
+
+            return false;
         }
 
         public string PeekWord(bool skipWS, bool stopAtEOL)
@@ -126,10 +124,10 @@
             int endpos = _pos;
             _pos = pos;
 
-            // Move to after new line chars            
-            if (_text[_pos] == '\r')
-                _pos += 2;
-            else
+            // Move to after new line chars   
+            if (!EOF && _text[_pos] == '\r')
+                ++_pos;
+            if (!EOF && _text[_pos] == '\n')
                 ++_pos;
 
             // .. and the result is line without whitespaces at the end and without new line chars.
@@ -196,6 +194,9 @@
 
         private int TrimEnd()
         {
+            if (EOF)
+                return _pos;
+
             int pos = _pos;
             while (IsWS(_text[pos]))
                 --pos;
@@ -216,7 +217,9 @@
 
         private bool IsEOL()
         {
-            if (_text[_pos] == '\r' && _text[_pos + 1] == '\n')
+            if (EOF)
+                return true;
+            if (_text[_pos] == '\r')
                 return true;
             else if (_text[_pos] == '\n')
                 return true;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/js_modules/SpeechTools.jm
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/js_modules/SpeechTools.jm	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/js_modules/SpeechTools.jm	Mon Aug  4 21:29:58 2008
@@ -63,7 +63,7 @@
 	this.AutoUnload = false;
 	this.debug = false;
 
-	/* Set the TTS info*/
+	/* Set the TTS info */
 	this.setTTS = function (tts_eng, tts_voice) {
 		this.tts_eng = tts_eng;
 		this.tts_voice = tts_voice;		
@@ -79,7 +79,7 @@
 		this.audio_ext = audio_ext;
 	}
 	
-	/* Add a grammar to be used*/
+	/* Add a grammar to be used */
 	this.addGrammar = function(grammar_object) {
 		this.grammar_hash[grammar_object.grammar_name] = grammar_object;
 	}
@@ -180,21 +180,38 @@
 					console_log("debug", "----Heard [" + interp.input + "]\n");
 					console_log("debug", "----Hit score " + interp. at score + "/" + grammar_object.min_score + "/" + grammar_object.confirm_score + "\n");
 				}
-				
-				if (interp. at score >= grammar_object.min_score) {
-					if (interp. at score < grammar_object.confirm_score) {
-						rv.push("_confirm_");
-					}
 
-					eval("xo = interp." + grammar_object.obj_path + ";");
-					for (x = 0; x < xo.length(); x++) {
-						rv.push(xo[x]);
+				if (_this.mod == "pocketsphinx") {
+					/* pocketsphinx scores 0 best to 100 worst. */
+					if (interp. at score >= grammar_object.min_score) {
+						if (interp. at score >= grammar_object.confirm_score) {
+							rv.push("_confirm_");
+						}
+						
+						eval("xo = interp." + grammar_object.obj_path + ";");
+						for (x = 0; x < xo.length(); x++) {
+							rv.push(xo[x]);
+							console_log("info", "----" +xo[x] + "\n"); 
+						}
+					} else {
+						rv.push("_no_idea_");
 					}
 				} else {
-					rv.push("_no_idea_");
+					if (interp. at score >= grammar_object.min_score) {
+						if (interp. at score < grammar_object.confirm_score) {
+							rv.push("_confirm_");
+						}
+						
+						eval("xo = interp." + grammar_object.obj_path + ";");
+						for (x = 0; x < xo.length(); x++) {
+							rv.push(xo[x]);
+							console_log("info", "----" +xo[x] + "\n"); 
+						}
+					} else {
+						rv.push("_no_idea_");
+					}
 				}
 
-				console_log("debug", "dammit: " + rv + "\n");
 				delete interp;
 				return rv;
 			}
@@ -235,7 +252,7 @@
 
 	this.waitTime = wait_time + 0;
 
-	/* Set the TTS info*/
+	/* Set the TTS info */
 	this.setTTS = function (tts_eng, tts_voice) {
 		this.tts_eng = tts_eng;
 		this.tts_voice = tts_voice;		
@@ -278,7 +295,7 @@
 		this.add_sound = add_sound;		
 	}
 
-	/* Add acceptable items (comma sep list)*/
+	/* Add acceptable items (comma sep list) */
 	this.addItem = function(item) {
 		ia = item.split(",");
 		var x;
@@ -287,6 +304,14 @@
 		}
 	}
 
+	this.addItemAlias = function(item,alias) {
+		ia = item.split(",");
+		var x;
+		for (x = 0; x < ia.length; x++) {
+			this.items[this.index++] = ia[x]  + ":::" + alias;
+		}
+	}
+
 	/* Add a regex */
 	this.addRegEx = function(item) {
 		this.items[this.index++] = item;
@@ -404,29 +429,41 @@
 						if (this.debug) {
 							console_log("debug", "----Testing [" + y + "] [" + x + "] " + items[y] + " =~ [" + this.items[x] + "]\n");
 						}
-						var re = new RegExp(this.items[x]);
+						str = this.items[x];
+						
+						ab = str.split(":::");
+
+						var re = new RegExp(ab[0], "i");
 						match = re.exec(items[y]);
+
 						if (match) {
+							
 							for (i = 0; i < match.length; i++) {
+								if (ab.length == 1) {
+									rep = match[i];
+								} else {
+									rep = ab[1];
+								}
+
 								dup = false;
 								for(z = 0; z < this.collected_items.length; z++) {
-									if (this.collected_items[z] == match[i]) {
+									if (this.collected_items[z] == rep) {
 										dup = true;
 										break;
 									}
 								}
 								if (dup) {
 									if (this.dup_sound) {
-										rv = this.react(this.dup_sound + " " + match[i], this.dup_sound + "," + match[i]);
+										rv = this.react(this.dup_sound + " " + rep, this.dup_sound + "," + rep);
 									}
 								} else {
 									if (this.debug) {
-										console_log("debug", "----Adding " + match[i] + "\n");
+										console_log("debug", "----Adding " + rep + "\n");
 									}
-									this.collected_items[this.collected_index++] = match[i];
+									this.collected_items[this.collected_index++] = rep;
 									hit = true;
 									if (this.add_sound) {
-										rv = this.react(this.add_sound + " " + match[i], this.add_sound + "," + match[i]);
+										rv = this.react(this.add_sound + " " + rep, this.add_sound + "," + rep);
 									}
 								}
 							}

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/scenario/phones.cfg
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/scenario/phones.cfg	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/scenario/phones.cfg	Mon Aug  4 21:29:58 2008
@@ -1,4 +1,4 @@
-Snom_300,10.0.1.241,1000
+Snom_300,10.0.1.17,1000
 Snom_320,10.0.1.242,1002
 Snom_360,10.0.1.243,1006
 Snom_370,10.0.1.244,1007

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/FreeSWITCH/Client.pm
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/FreeSWITCH/Client.pm	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/FreeSWITCH/Client.pm	Mon Aug  4 21:29:58 2008
@@ -4,7 +4,7 @@
 use IO::Select;
 use Data::Dumper;
 
-
+$VERSION = "1.0";
 
 sub init($;$) {
   my $proto = shift;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/README
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/README	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/README	Mon Aug  4 21:29:58 2008
@@ -1,3 +1,34 @@
 
-Socket library to interface w/ freeswitch mod_event_socket from Twisted python applications.
+DESCRIPTION
+===========
+
+Socket library to interface w/ freeswitch mod_event_socket from Twisted python applications.  Used by WikiPBX for all non-http communication w/ Freeswitch.
+
+Install
+=======
+
+See INSTALL
+
+Debugging
+=========
+
+Set FREEPY_DEBUG_ON = True in globals.py
+
+TODO: pull this from an environment variable or a config file
+
+Rebulding State Machines
+========================
+
+(you only need to do this if you changed an .sm file)
+
+for each .sm file:
+
+java -jar /usr/src/smc/bin/Smc.jar -python -g THE.sm
+
+and loginrequest.sm -> loginrequest_sm.py with the state machine.
+
+TODO: create a Makefile to do this stuff
+TODO: use Miro Samek's HSM framework instead of SMC
+
+
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/__init__.py
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/__init__.py	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/__init__.py	Mon Aug  4 21:29:58 2008
@@ -54,20 +54,20 @@
         self.active_request = None # the current active (de-queued) request
 
     def connectionMade(self):
-        print "Connection made"
+        self.log("Connection made")
         self.conncb(self)
         
     def connectionLost(self, reason):
         if self.discocb:
             self.discocb(reason)        
-        print "connectionLost: %s" % reason
+        self.log("connectionLost: %s" % reason)
 
 
     def log(self, msg):
         """
         print a message to stdout if debug enabled
         """
-        if freepy.globals.DEBUG_ON:
+        if freepy.globals.FREEPY_DEBUG_ON:
             print msg
             
     def login(self, passwd):
@@ -166,7 +166,6 @@
 
                   TODO: add this        
         """
-        print "confdtmf called"        
         if bgapi == True:
             msg = "bgapi conference %s dtmf %s %s" % \
                   (conf_name, member_id, dtmf)
@@ -296,7 +295,7 @@
             msg = "api sofia status profile %s as xml" % (profile_name)
             req = request.ApiRequest()
         self.requestq.put(req)
-        print "sending to fs: %s" % msg
+        self.log("sending to fs: %s" % msg)
         self.transport.write("%s\n\n" % msg)
         return req.getDeferred()
         
@@ -357,9 +356,15 @@
     def lineReceived(self, line):
         self.log("<< %s" % line)                                
         if not self.active_request:
+
+            # if no active request pending, we ignore
+            # blank lines
+            if not line.strip():
+                return
+            
             # if no active request, dequeue a new one
             if self.requestq.empty():
-                # we are receiving data from fs without an
+                # we are receiving non-empty data from fs without an
                 # active request pending.  that means that
                 # there is a bug in the protocol handler
                 # (or possibly in fs)                

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/apirequest.sm
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/apirequest.sm	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/apirequest.sm	Mon Aug  4 21:29:58 2008
@@ -61,35 +61,35 @@
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - was not expecting blank line");		
 		}
 
     	ContentFinished		
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - was not expecting content to be finished");		
 		}
 
     	ContentLength
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - was not expecting content-length header");		
 		}
 
     	ApiResponse			
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - was not expecting api response");		
 		}
 
         ProcessLine(line)
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - was not expecting needing to process a line");		
 		}
 }
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/apirequest_sm.py
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/apirequest_sm.py	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/apirequest_sm.py	Mon Aug  4 21:29:58 2008
@@ -1,8 +1,10 @@
-
-# DO NOT MODIFY THIS CODE - AUTOMATICALLY GENERATED BY SMC
+# DO NOT EDIT.
+# generated by smc (http://smc.sourceforge.net/)
+# from file : apirequest.sm
 
 import statemap
 
+
 class ApiRequestState(statemap.State):
 
     def Entry(self, fsm):
@@ -31,7 +33,7 @@
             fsm.getDebugStream().write('TRANSITION   : Default\n')
         msg = "\n\tState: %s\n\tTransition: %s" % (
             fsm.getState().getName(), fsm.getTransition())
-        raise TransitionUndefinedException, msg
+        raise statemap.TransitionUndefinedException, msg
 
 class MainMap_Default(ApiRequestState):
 
@@ -44,7 +46,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - was not expecting blank line")
         finally:
             fsm.setState(endState)
 
@@ -57,7 +59,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - was not expecting content to be finished")
         finally:
             fsm.setState(endState)
 
@@ -70,7 +72,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - was not expecting content-length header")
         finally:
             fsm.setState(endState)
 
@@ -83,7 +85,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - was not expecting api response")
         finally:
             fsm.setState(endState)
 
@@ -96,7 +98,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - was not expecting needing to process a line")
         finally:
             fsm.setState(endState)
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/bgapirequest.sm
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/bgapirequest.sm	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/bgapirequest.sm	Mon Aug  4 21:29:58 2008
@@ -25,11 +25,16 @@
 GotReplyText
 {
         BlankLine
-		Startup                
+				nil                
                 {
-		setRequestFinished(); callOrErrback();		
+				
                 }
 
+		JobUuid
+				Startup
+				{
+				setRequestFinished(); callOrErrback();			
+				}
 
 }
 
@@ -43,28 +48,27 @@
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
-		}
+		errbackDeferred("Protocol failure - was not expecting blank line");			   }
 
     	CommandReply		
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - was not expecting command reply");		
 		}
 
     	ReplyText
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - was not expecting reply text");		
 		}
 
         ProcessLine(line)
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure handling bgapi response - was not expecting line needing to be processed");		
 		}
 
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/bgapirequest_sm.py
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/bgapirequest_sm.py	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/bgapirequest_sm.py	Mon Aug  4 21:29:58 2008
@@ -1,8 +1,10 @@
-
-# DO NOT MODIFY THIS CODE - AUTOMATICALLY GENERATED BY SMC
+# DO NOT EDIT.
+# generated by smc (http://smc.sourceforge.net/)
+# from file : bgapirequest.sm
 
 import statemap
 
+
 class BgApiRequestState(statemap.State):
 
     def Entry(self, fsm):
@@ -17,6 +19,9 @@
     def CommandReply(self, fsm):
         self.Default(fsm)
 
+    def JobUuid(self, fsm):
+        self.Default(fsm)
+
     def ProcessLine(self, fsm, line):
         self.Default(fsm)
 
@@ -28,7 +33,7 @@
             fsm.getDebugStream().write('TRANSITION   : Default\n')
         msg = "\n\tState: %s\n\tTransition: %s" % (
             fsm.getState().getName(), fsm.getTransition())
-        raise TransitionUndefinedException, msg
+        raise statemap.TransitionUndefinedException, msg
 
 class MainMap_Default(BgApiRequestState):
 
@@ -41,7 +46,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - was not expecting blank line")
         finally:
             fsm.setState(endState)
 
@@ -54,7 +59,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - was not expecting command reply")
         finally:
             fsm.setState(endState)
 
@@ -67,7 +72,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - was not expecting reply text")
         finally:
             fsm.setState(endState)
 
@@ -80,7 +85,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure handling bgapi response - was not expecting line needing to be processed")
         finally:
             fsm.setState(endState)
 
@@ -107,10 +112,15 @@
 class MainMap_GotReplyText(MainMap_Default):
 
     def BlankLine(self, fsm):
-        ctxt = fsm.getOwner()
         if fsm.getDebugFlag() == True:
             fsm.getDebugStream().write("TRANSITION   : MainMap.GotReplyText.BlankLine()\n")
 
+
+    def JobUuid(self, fsm):
+        ctxt = fsm.getOwner()
+        if fsm.getDebugFlag() == True:
+            fsm.getDebugStream().write("TRANSITION   : MainMap.GotReplyText.JobUuid()\n")
+
         fsm.getState().Exit(fsm)
         fsm.clearState()
         try:
@@ -145,6 +155,11 @@
         self.getState().CommandReply(self)
         self._transition = None
 
+    def JobUuid(self):
+        self._transition = 'JobUuid'
+        self.getState().JobUuid(self)
+        self._transition = None
+
     def ProcessLine(self, *arglist):
         self._transition = 'ProcessLine'
         self.getState().ProcessLine(self, *arglist)

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/globals.py
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/globals.py	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/globals.py	Mon Aug  4 21:29:58 2008
@@ -1,2 +1,10 @@
 
-DEBUG_ON = True
+import os
+
+if os.environ.has_key('FREEPY_DEBUG_ON'):
+    # pull from environment if avail
+    FREEPY_DEBUG_ON = os.environ['FREEPY_DEBUG_ON']
+else:
+    # fall back to hardcoded value
+    FREEPY_DEBUG_ON = False   
+

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/loginrequest.sm
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/loginrequest.sm	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/loginrequest.sm	Mon Aug  4 21:29:58 2008
@@ -57,35 +57,35 @@
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - Was not expecting a blank line");		
 		}
 
     	AuthRequest			
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - Was not expecting auth request");		
 		}
 
     	CommandReply			
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - was not expecting a command reply");		
 		}
 
     	ReplyText			
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - was not expecting reply text");		
 		}
 
         ProcessLine(line)
 		nil			
 		{ 
 		setRequestFinished();
-		errbackDeferred("Protocol failure");		
+		errbackDeferred("Protocol failure - was not expecting need to receive a line that needs to be processed");		
 		}
 
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/loginrequest_sm.py
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/loginrequest_sm.py	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/loginrequest_sm.py	Mon Aug  4 21:29:58 2008
@@ -1,5 +1,6 @@
-
-# DO NOT MODIFY THIS CODE - AUTOMATICALLY GENERATED BY SMC
+# DO NOT EDIT.
+# generated by smc (http://smc.sourceforge.net/)
+# from file : loginrequest.sm
 
 import statemap
 
@@ -32,7 +33,7 @@
             fsm.getDebugStream().write('TRANSITION   : Default\n')
         msg = "\n\tState: %s\n\tTransition: %s" % (
             fsm.getState().getName(), fsm.getTransition())
-        raise TransitionUndefinedException, msg
+        raise statemap.TransitionUndefinedException, msg
 
 class MainMap_Default(LoginRequestState):
 
@@ -45,7 +46,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - Was not expecting a blank line")
         finally:
             fsm.setState(endState)
 
@@ -58,7 +59,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - Was not expecting auth request")
         finally:
             fsm.setState(endState)
 
@@ -71,7 +72,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - was not expecting a command reply")
         finally:
             fsm.setState(endState)
 
@@ -84,7 +85,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - was not expecting reply text")
         finally:
             fsm.setState(endState)
 
@@ -97,7 +98,7 @@
         fsm.clearState()
         try:
             ctxt.setRequestFinished()
-            ctxt.errbackDeferred("Protocol failure")
+            ctxt.errbackDeferred("Protocol failure - was not expecting need to receive a line that needs to be processed")
         finally:
             fsm.setState(endState)
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/request.py
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/request.py	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/socket/freepy/request.py	Mon Aug  4 21:29:58 2008
@@ -70,7 +70,7 @@
         self.deferred.callback(cbval)
 
     def errbackDeferred(self, result):
-        self.deferred.errback(result)
+        self.deferred.errback(Exception(str(result)))
 
     def process(self, line):
         """
@@ -83,7 +83,7 @@
 
         otherwise, if the fs response is incomplete, just buffer the data
         """
-        if not line or len(line) == 0:
+        if not line.strip() or len(line.strip()) == 0:
             self._fsm.BlankLine()
             return self.isRequestFinished()
         
@@ -110,6 +110,16 @@
             self._fsm.ReplyText()
             return self.isRequestFinished()
 
+        matchstr = re.compile("Job-UUID", re.I)
+        result = matchstr.search(line)
+        if (result != None):
+            fields = line.split(":") # eg, ['Job-UUID','c9eee07e-508-..']
+            endfields = fields[1:]
+            # ignore job uuid given on this line, take the one sent
+            # in Reply-Text response line
+            # self.response_content = "".join(endfields)
+            self._fsm.JobUuid()
+            return self.isRequestFinished()
 
         matchstr = re.compile("api/response", re.I)
         result = matchstr.search(line)
@@ -125,7 +135,6 @@
             self._fsm.ContentLength()
             return self.isRequestFinished()
 
-
         self._fsm.ProcessLine(line)
         return self.isRequestFinished()
 
@@ -194,37 +203,12 @@
     linereceived: 
 
     """
-    
     def __init__(self):
         super(BgApiRequest, self).__init__()
         import bgapirequest_sm
         self._fsm = bgapirequest_sm.BgApiRequest_sm(self)
 
 
-    def processOLD(self, line):
-
-        if not line or len(line) == 0:
-            self._fsm.BlankLine()
-            return self.isRequestFinished()
-        
-        matchstr = re.compile("command/reply", re.I)
-        result = matchstr.search(line)
-        if (result != None):
-            self._fsm.CommandReply()
-            return self.isRequestFinished()
-
-        matchstr = re.compile("Reply-Text", re.I)
-        result = matchstr.search(line)
-        if (result != None):
-            self.response_content = line.split(":")[1]
-            self._fsm.ReplyText()
-            return self.isRequestFinished()
-
-        self._fsm.ProcessLine(line)
-        return self.isRequestFinished()
-
-
-
     def getResponse(self):
 
         # subclasses may want to parse this into a meaningful
@@ -252,28 +236,6 @@
         self._fsm = apirequest_sm.ApiRequest_sm(self)
         self.response_content = ""
 
-    def processOLD(self, line):
-
-        if not line or len(line) == 0:
-            self._fsm.BlankLine()
-            return self.isRequestFinished()
-        
-        matchstr = re.compile("api/response", re.I)
-        result = matchstr.search(line)
-        if (result != None):
-            self._fsm.ApiResponse()
-            return self.isRequestFinished()
-
-        matchstr = re.compile("Content-Length", re.I)
-        result = matchstr.search(line)
-        if (result != None):
-            # line: Content-Length: 34
-            self.content_length = int(line.split(":")[1].strip())
-            self._fsm.ContentLength()
-            return self.isRequestFinished()
-
-        self._fsm.ProcessLine(line)
-        return self.isRequestFinished()
 
     def doNothing(self):
         # weird smc issue workaround attempt

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/private/switch_core_pvt.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/private/switch_core_pvt.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/private/switch_core_pvt.h	Mon Aug  4 21:29:58 2008
@@ -60,6 +60,10 @@
 #include <sys/mman.h>
 #endif
 
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
 #ifndef WIN32
 /* setuid, setgid */
 #include <unistd.h>
@@ -101,7 +105,9 @@
 
 	switch_io_event_hooks_t event_hooks;
 	switch_codec_t *read_codec;
+	switch_codec_t *real_read_codec;
 	switch_codec_t *write_codec;
+	switch_codec_t *real_write_codec;
 	switch_codec_t *video_read_codec;
 	switch_codec_t *video_write_codec;
 
@@ -189,6 +195,7 @@
 	uint32_t default_dtmf_duration;
 	switch_frame_t dummy_cng_frame;
 	char dummy_data[5];
+	switch_bool_t colorize_console;
 };
 
 extern struct switch_runtime runtime;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch.h	Mon Aug  4 21:29:58 2008
@@ -218,5 +218,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_apr.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_apr.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_apr.h	Mon Aug  4 21:29:58 2008
@@ -303,6 +303,13 @@
 SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input);
 
 /**
+ * convert a time to its human readable components in a specific timezone with offset
+ * @param result the exploded time
+ * @param input the time to explode
+ */
+SWITCH_DECLARE(switch_status_t) switch_time_exp_tz(switch_time_exp_t *result, switch_time_t input, switch_int32_t offs);
+
+/**
  * Sleep for the specified number of micro-seconds.
  * @param t desired amount of time to sleep.
  * @warning May sleep for longer than the specified time. 
@@ -728,6 +735,12 @@
 
 SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset);
 
+
+SWITCH_DECLARE(switch_status_t) switch_file_copy(const char *from_path, 
+												 const char *to_path,
+												 switch_fileperms_t perms,
+												 switch_memory_pool_t *pool);
+
 /**
  * Close the specified file.
  * @param thefile The file descriptor to close.
@@ -1248,5 +1261,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_bitpack.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_bitpack.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_bitpack.h	Mon Aug  4 21:29:58 2008
@@ -290,5 +290,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_buffer.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_buffer.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_buffer.h	Mon Aug  4 21:29:58 2008
@@ -158,5 +158,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_caller.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_caller.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_caller.h	Mon Aug  4 21:29:58 2008
@@ -226,5 +226,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h	Mon Aug  4 21:29:58 2008
@@ -223,6 +223,7 @@
   \return the value of the requested variable
 */
 SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname);
+SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event);
 
 /*!
  * Start iterating over the entries in the channel variable list.
@@ -490,5 +491,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h	Mon Aug  4 21:29:58 2008
@@ -115,5 +115,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h	Mon Aug  4 21:29:58 2008
@@ -84,5 +84,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h	Mon Aug  4 21:29:58 2008
@@ -593,12 +593,17 @@
 */
 SWITCH_DECLARE(void) switch_core_set_variable(_In_z_ const char *varname, _In_opt_z_ const char *value);
 
+SWITCH_DECLARE(void) switch_core_dump_variables(_In_ switch_stream_handle_t *stream);
+
 /*! 
   \brief Hangup All Sessions
   \param cause the hangup cause to apply to the hungup channels
 */
 SWITCH_DECLARE(void) switch_core_session_hupall(_In_ switch_call_cause_t cause);
 
+SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(_In_ const char *var_name, _In_ const char *var_val, _In_ switch_call_cause_t cause);
+SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause);
+
 /*! 
   \brief Send a message to another session using it's uuid
   \param uuid_str the unique id of the session you want to send a message to
@@ -1119,6 +1124,8 @@
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
 
+SWITCH_DECLARE(void) switch_core_session_unset_read_codec(_In_ switch_core_session_t *session);
+
 /*! 
   \brief Retrieve the read codec from a given session
   \param session session to retrieve from
@@ -1127,6 +1134,13 @@
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_read_codec(_In_ switch_core_session_t *session);
 
 /*! 
+  \brief Retrieve the effevtive read codec from a given session
+  \param session session to retrieve from
+  \return a pointer to the codec
+*/
+SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_read_codec(_In_ switch_core_session_t *session);
+
+/*! 
   \brief Assign the write codec to a given session
   \param session session to add the codec to
   \param codec the codec to add
@@ -1142,6 +1156,13 @@
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_write_codec(_In_ switch_core_session_t *session);
 
 /*! 
+  \brief Retrieve the effevtive write codec from a given session
+  \param session session to retrieve from
+  \return a pointer to the codec
+*/
+SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_write_codec(_In_ switch_core_session_t *session);
+
+/*! 
   \brief Assign the video_read codec to a given session
   \param session session to add the codec to
   \param codec the codec to add
@@ -1623,7 +1644,8 @@
 SWITCH_DECLARE(void) switch_time_sync(void);
 SWITCH_DECLARE(time_t) switch_timestamp(time_t *t);
 SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload);
-SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip(const char *ip_str, const char *list_name);
+SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip_token(const char *ip_str, const char *list_name, const char **token);
+#define switch_check_network_list_ip(_ip_str, _list_name) switch_check_network_list_ip_token(_ip_str, _list_name, NULL)
 SWITCH_DECLARE(void) switch_time_set_monotonic(switch_bool_t enable);
 SWITCH_DECLARE(uint32_t) switch_core_max_dtmf_duration(uint32_t duration);
 SWITCH_DECLARE(uint32_t) switch_core_default_dtmf_duration(uint32_t duration);
@@ -1646,5 +1668,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_db.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_db.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_db.h	Mon Aug  4 21:29:58 2008
@@ -551,5 +551,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h	Mon Aug  4 21:29:58 2008
@@ -249,5 +249,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h	Mon Aug  4 21:29:58 2008
@@ -13,7 +13,31 @@
 #define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n");}} while(0)
 #define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
 #define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
-#define init_vars() do { allocated = 0; session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown";  caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = "";  caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0)
+#define init_vars() allocated = 0;						\
+	session = NULL;										\
+	channel = NULL;										\
+	uuid = NULL;										\
+	tts_name = NULL;									\
+	voice_name = NULL;									\
+	xml_cdr_text = NULL;								\
+	memset(&caller_profile, 0, sizeof(caller_profile)); \
+	memset(&args, 0, sizeof(args));						\
+	ap = NULL;											\
+	caller_profile.source = "mod_unknown";				\
+	caller_profile.dialplan = "";						\
+	caller_profile.context = "";						\
+	caller_profile.caller_id_name = "";					\
+	caller_profile.caller_id_number = "";				\
+	caller_profile.network_addr = "";					\
+	caller_profile.ani = "";							\
+	caller_profile.aniii = "";							\
+	caller_profile.rdnis = "";							\
+	caller_profile.username = "";						\
+	on_hangup = NULL;									\
+	memset(&cb_state, 0, sizeof(cb_state));				\
+	hook_state = CS_NEW;								\
+	fhp = NULL
+
 //// C++ Interface: switch_to_cpp_mempool//// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t//// Author: Yossi Neiman <freeswitch at cartissolutions.com>, (C) 2007//// Copyright: See COPYING file that comes with this distribution//
 #if 0
 #ifndef SWITCHTOMEMPOOL
@@ -101,6 +125,14 @@
 		 S_RDLOCK = (1 << 2)
 	 } session_flag_t;
 
+     class DTMF {
+	 public:
+		 char digit;
+		 uint32_t duration;
+		 SWITCH_DECLARE_CONSTRUCTOR DTMF(char idigit, uint32_t iduration = SWITCH_DEFAULT_DTMF_DURATION);
+		 virtual SWITCH_DECLARE_CONSTRUCTOR ~DTMF();
+     };
+
 	 class Stream {
 	   protected:
 		 switch_stream_handle_t mystream;
@@ -136,6 +168,20 @@
 
 	 };
 
+     class EventConsumer {
+	 protected:
+		 switch_memory_pool_t *pool;
+	 public:
+		 switch_queue_t *events;
+		 switch_event_types_t e_event_id;
+		 switch_event_node_t *node;
+		 char *e_callback;
+		 char *e_subclass_name;
+		 char *e_cb_arg;
+		 SWITCH_DECLARE_CONSTRUCTOR EventConsumer(const char *event_name, const char *subclass_name = "");
+		 SWITCH_DECLARE_CONSTRUCTOR ~ EventConsumer();
+		 SWITCH_DECLARE(Event *) pop(int block = 0);
+	 };
 
 	 class CoreSession {
 	   protected:
@@ -145,9 +191,6 @@
 		 switch_caller_profile_t caller_profile;	// avoid passing so many args to originate, 
 		 // instead set them here first
 		 char *xml_cdr_text;
-		 char *uuid;
-		 char *tts_name;
-		 char *voice_name;
 		 void store_file_handle(switch_file_handle_t *fh);
 		 void *on_hangup;		// language specific callback function, cast as void * 
 		 switch_file_handle_t local_fh;
@@ -156,9 +199,9 @@
 
 	   public:
 		 SWITCH_DECLARE_CONSTRUCTOR CoreSession();
-		 SWITCH_DECLARE_CONSTRUCTOR CoreSession(char *uuid);
+		 SWITCH_DECLARE_CONSTRUCTOR CoreSession(char *nuuid, CoreSession *a_leg = NULL);
 		 SWITCH_DECLARE_CONSTRUCTOR CoreSession(switch_core_session_t *new_session);
-		 SWITCH_DECLARE_CONSTRUCTOR ~ CoreSession();
+		 virtual SWITCH_DECLARE_CONSTRUCTOR ~ CoreSession();
 		 switch_core_session_t *session;
 		 switch_channel_t *channel;
 		 unsigned int flags;
@@ -167,6 +210,10 @@
 		 // field in this->args
 		 switch_channel_state_t hook_state;	// store hookstate for on_hangup callback
 
+		 char *uuid;
+		 char *tts_name;
+		 char *voice_name;
+
 		 SWITCH_DECLARE(int) answer();
 		 SWITCH_DECLARE(int) preAnswer();
 		 SWITCH_DECLARE(void) hangup(char *cause = "normal_clearing");
@@ -234,7 +281,7 @@
 	 * receiving dtmf digits.  For that, use collectDigits.
 	 */
 		 SWITCH_DECLARE(char *) getDigits(int maxdigits, char *terminators, int timeout);
-
+		 SWITCH_DECLARE(char *) getDigits(int maxdigits, char *terminators, int timeout, int interdigit);
 		 SWITCH_DECLARE(int) transfer(char *extensions, char *dialplan, char *context);
 
 
@@ -262,6 +309,7 @@
 	 *
 	 */
 		 SWITCH_DECLARE(int) streamFile(char *file, int starting_sample_count = 0);
+		 SWITCH_DECLARE(int) sleep(int ms);
 
 	/** \brief flush any pending events
 	 */
@@ -279,6 +327,10 @@
 		 SWITCH_DECLARE(void) setHangupHook(void *hangup_func);
 
 		 SWITCH_DECLARE(bool) ready();
+		 SWITCH_DECLARE(bool) answered();
+		 SWITCH_DECLARE(bool) mediaReady();
+
+		 SWITCH_DECLARE(void) waitForAnswer(CoreSession *calling_session);
 
 		 SWITCH_DECLARE(void) execute(char *app, char *data = NULL);
 
@@ -294,7 +346,7 @@
 	 * \return the uuid of this session
 	 */
 		 char *get_uuid() const {
-			 return uuid;
+			 return uuid ? uuid : (char *) "uninitialized";
 		 };
 
 	/** \brief Get the callback function arguments associated with this session
@@ -349,5 +401,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h	Mon Aug  4 21:29:58 2008
@@ -70,14 +70,6 @@
 	struct switch_event_header *next;
 };
 
-/*! \brief A registered custom event subclass  */
-struct switch_event_subclass {
-	/*! the owner of the subclass */
-	char *owner;
-	/*! the subclass name */
-	char *name;
-};
-
 /*! \brief Representation of an event */
 struct switch_event {
 	/*! the event id (descriptor) */
@@ -87,7 +79,7 @@
 	/*! the owner of the event */
 	char *owner;
 	/*! the subclass of the event */
-	switch_event_subclass_t *subclass;
+	char *subclass_name;
 	/*! the event headers */
 	switch_event_header_t *headers;
 	/*! the event headers tail pointer */
@@ -103,20 +95,7 @@
 	struct switch_event *next;
 };
 
-/*! \brief A node to store binded events */
-struct switch_event_node {
-	/*! the id of the node */
-	char *id;
-	/*! the event id enumeration to bind to */
-	switch_event_types_t event_id;
-	/*! the event subclass to bind to for custom events */
-	switch_event_subclass_t *subclass;
-	/*! a callback function to execute when the event is triggered */
-	switch_event_callback_t callback;
-	/*! private data */
-	void *user_data;
-	struct switch_event_node *next;
-};
+struct switch_event_node;
 
 #define SWITCH_EVENT_SUBCLASS_ANY NULL
 
@@ -156,7 +135,7 @@
   \param header_name the name of the header to read
   \return the value of the requested header
 */
-	 _Ret_opt_z_ SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, char *header_name);
+	 _Ret_opt_z_ SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, const char *header_name);
 
 #define switch_event_get_header_nil(e, h) switch_str_nil(switch_event_get_header(e,h))
 
@@ -229,6 +208,26 @@
 												  void *user_data);
 
 /*!
+  \brief Bind an event callback to a specific event
+  \param id an identifier token of the binder
+  \param event the event enumeration to bind to
+  \param subclass_name the event subclass to bind to in the case if SWITCH_EVENT_CUSTOM
+  \param callback the callback functon to bind
+  \param user_data optional user specific data to pass whenever the callback is invoked
+  \param node bind handle to later remove the binding.
+  \return SWITCH_STATUS_SUCCESS if the event was binded
+*/
+SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, switch_event_types_t event, const char *subclass_name, 
+															switch_event_callback_t callback, void *user_data, switch_event_node_t **node);
+/*!
+  \brief Unbind a bound event consumer
+  \param node node to unbind
+  \return SWITCH_STATUS_SUCCESS if the consumer was unbinded
+*/
+SWITCH_DECLARE(switch_status_t) switch_event_unbind(switch_event_node_t **node);
+SWITCH_DECLARE(switch_status_t) switch_event_unbind_callback(switch_event_callback_t callback);
+
+/*!
   \brief Render the name of an event id enumeration
   \param event the event id to render the name of
   \return the rendered name
@@ -253,6 +252,8 @@
 */
 SWITCH_DECLARE(switch_status_t) switch_event_reserve_subclass_detailed(const char *owner, const char *subclass_name);
 
+SWITCH_DECLARE(switch_status_t) switch_event_free_subclass_detailed(const char *owner, const char *subclass_name);
+
 /*!
   \brief Render a string representation of an event sutable for printing or network transport 
   \param event the event to render
@@ -311,6 +312,7 @@
   \note the body supplied by this function will supersede an existing body the event may have
 */
 #define switch_event_reserve_subclass(subclass_name) switch_event_reserve_subclass_detailed(__FILE__, subclass_name)
+#define switch_event_free_subclass(subclass_name) switch_event_free_subclass_detailed(__FILE__, subclass_name)
 
 /*!
   \brief Create a new event assuming it will not be custom event and therefore hiding the unused parameters
@@ -358,5 +360,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_frame.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_frame.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_frame.h	Mon Aug  4 21:29:58 2008
@@ -80,5 +80,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h	Mon Aug  4 21:29:58 2008
@@ -107,9 +107,10 @@
   \brief Wait for time to pass for a specified number of milliseconds
   \param session the session to wait for.
   \param ms the number of milliseconds
+  \param args arguements to pass for callbacks etc
   \return SWITCH_STATUS_SUCCESS if the channel is still up
 */
-SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, uint32_t ms);
+SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, uint32_t ms, switch_input_args_t *args);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, switch_input_args_t *args);
 
@@ -313,6 +314,9 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file,
 													 switch_input_args_t *args);
 
+SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_t *session, uint32_t thresh, uint32_t silence_hits, 
+															uint32_t listen_hits, uint32_t timeout_ms, const char *file);
+
 SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *session, char *script, int32_t loops, switch_input_args_t *args);
 
 /*!
@@ -779,7 +783,7 @@
 
 	 SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
 	 SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
-
+     SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data);
 /** @} */
 
 	 SWITCH_END_EXTERN_C
@@ -792,5 +796,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_loadable_module.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_loadable_module.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_loadable_module.h	Mon Aug  4 21:29:58 2008
@@ -242,6 +242,13 @@
 SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(char *dir, char *fname, switch_bool_t runtime, const char **err);
 
 /*!
+  \brief Check if a module is loaded
+  \param mod the module name
+  \return the status
+*/
+SWITCH_DECLARE(switch_status_t) switch_loadable_module_exists(const char *mod);
+
+/*!
   \brief Unoad a module
   \param dir the directory where the module resides
   \param fname the file name of the module
@@ -397,5 +404,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h	Mon Aug  4 21:29:58 2008
@@ -74,7 +74,7 @@
   \param pool the memory pool to use
   \note to be called at application startup by the core
 */
-SWITCH_DECLARE(switch_status_t) switch_log_init(_In_ switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_log_init(_In_ switch_memory_pool_t *pool, _In_ switch_bool_t colorize);
 
 /*! 
   \brief Shut down the logging engine
@@ -104,7 +104,8 @@
   \brief Shut down  the logging engine
   \note to be called at application termination by the core
 */
-SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(_In_ switch_log_function_t function, _In_ switch_log_level_t level);
+SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(_In_ switch_log_function_t function, _In_ switch_log_level_t level, _In_ switch_bool_t is_console);
+SWITCH_DECLARE(switch_status_t) switch_log_unbind_logger(_In_ switch_log_function_t function);
 
 /*! 
   \brief Return the name of the specified log level
@@ -134,5 +135,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h	Mon Aug  4 21:29:58 2008
@@ -195,6 +195,8 @@
 	/*! private information */
 	void *private_info;
 
+	switch_thread_rwlock_t *rwlock;
+
 	/* to facilitate linking */
 	struct switch_endpoint_interface *next;
 };
@@ -245,6 +247,7 @@
 	switch_status_t (*timer_check) (switch_timer_t *, switch_bool_t);
 	/*! function to deallocate the timer */
 	switch_status_t (*timer_destroy) (switch_timer_t *);
+	switch_thread_rwlock_t *rwlock;
 	struct switch_timer_interface *next;
 };
 
@@ -254,6 +257,7 @@
 	const char *interface_name;
 	/*! the function to read an extension and set a channels dialpan */
 	switch_dialplan_hunt_function_t hunt_function;
+	switch_thread_rwlock_t *rwlock;
 	struct switch_dialplan_interface *next;
 };
 
@@ -277,6 +281,7 @@
 	switch_status_t (*file_get_string) (switch_file_handle_t *fh, switch_audio_col_t col, const char **string);
 	/*! list of supported file extensions */
 	char **extens;
+	switch_thread_rwlock_t *rwlock;
 	struct switch_file_interface *next;
 };
 
@@ -353,6 +358,7 @@
 	switch_status_t (*asr_check_results) (switch_asr_handle_t *ah, switch_asr_flag_t *flags);
 	/*! function to read results from the ASR */
 	switch_status_t (*asr_get_results) (switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags);
+	switch_thread_rwlock_t *rwlock;
 	struct switch_asr_interface *next;
 };
 
@@ -393,7 +399,7 @@
 	void (*speech_text_param_tts) (switch_speech_handle_t *sh, char *param, const char *val);
 	void (*speech_numeric_param_tts) (switch_speech_handle_t *sh, char *param, int val);
 	void (*speech_float_param_tts) (switch_speech_handle_t *sh, char *param, double val);
-
+	switch_thread_rwlock_t *rwlock;
 	struct switch_speech_interface *next;
 };
 
@@ -426,6 +432,7 @@
 	const char *interface_name;
 	/*! function to pass down to the module */
 	switch_say_callback_t say_function;
+	switch_thread_rwlock_t *rwlock;
 	struct switch_say_interface *next;
 };
 
@@ -435,6 +442,7 @@
 	const char *interface_name;
 	/*! function to open the directory interface */
 	switch_status_t (*chat_send) (char *proto, char *from, char *to, char *subject, char *body, char *hint);
+	switch_thread_rwlock_t *rwlock;
 	struct switch_chat_interface *next;
 };
 
@@ -444,6 +452,7 @@
 	const char *relative_oid;
 	/*! function to open the directory interface */
 	switch_status_t (*management_function) (char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen);
+	switch_thread_rwlock_t *rwlock;
 	struct switch_management_interface *next;
 };
 
@@ -461,7 +470,7 @@
 	switch_status_t (*directory_next) (switch_directory_handle_t *dh);
 	/*! function to advance to the next name/value pair in the current record */
 	switch_status_t (*directory_next_pair) (switch_directory_handle_t *dh, char **var, char **val);
-
+	switch_thread_rwlock_t *rwlock;
 	struct switch_directory_interface *next;
 };
 
@@ -586,6 +595,7 @@
 	/*! a list of codec implementations related to the codec */
 	switch_codec_implementation_t *implementations;
 	uint32_t codec_id;
+	switch_thread_rwlock_t *rwlock;
 	struct switch_codec_interface *next;
 };
 
@@ -603,6 +613,7 @@
 	const char *syntax;
 	/*! flags to control behaviour */
 	uint32_t flags;
+	switch_thread_rwlock_t *rwlock;
 	struct switch_application_interface *next;
 };
 
@@ -616,6 +627,7 @@
 	switch_api_function_t function;
 	/*! an example of the api syntax */
 	const char *syntax;
+	switch_thread_rwlock_t *rwlock;
 	struct switch_api_interface *next;
 };
 
@@ -629,5 +641,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_odbc.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_odbc.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_odbc.h	Mon Aug  4 21:29:58 2008
@@ -77,5 +77,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_platform.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_platform.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_platform.h	Mon Aug  4 21:29:58 2008
@@ -160,6 +160,7 @@
 #endif
 #define SWITCH_THREAD_FUNC  __stdcall
 #else //not win32
+#define O_BINARY 0
 #define SWITCH_DECLARE(type) type
 #define SWITCH_DECLARE_NONSTD(type) type
 #define SWITCH_MOD_DECLARE(type) type
@@ -323,5 +324,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_regex.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_regex.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_regex.h	Mon Aug  4 21:29:58 2008
@@ -78,5 +78,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_resample.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_resample.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_resample.h	Mon Aug  4 21:29:58 2008
@@ -177,5 +177,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h	Mon Aug  4 21:29:58 2008
@@ -53,8 +53,9 @@
 
 typedef enum {
 	NO_CRYPTO,
-	AES_CM_128_HMAC_SHA1_80,
-	AES_CM_128_HMAC_SHA1_32
+	AES_CM_128_HMAC_SHA1_80, 
+	AES_CM_128_HMAC_SHA1_32,
+	AES_CM_128_NULL_AUTH
 } switch_rtp_crypto_key_type_t;
 
 struct switch_rtp_crypto_key {
@@ -417,6 +418,9 @@
 */
 SWITCH_DECLARE(void *) switch_rtp_get_private(switch_rtp_t *rtp_session);
 
+SWITCH_DECLARE(switch_status_t) switch_rtp_activate_stun_ping(switch_rtp_t *rtp_session, const char *stun_ip, switch_port_t stun_port,
+															  uint32_t packet_count, switch_bool_t funny);
+
 /*!
   \}
 */
@@ -431,5 +435,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_scheduler.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_scheduler.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_scheduler.h	Mon Aug  4 21:29:58 2008
@@ -101,5 +101,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h	Mon Aug  4 21:29:58 2008
@@ -249,5 +249,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h	Mon Aug  4 21:29:58 2008
@@ -38,6 +38,15 @@
 #include <switch.h>
 SWITCH_BEGIN_EXTERN_C
 #define SWITCH_BLANK_STRING ""
+#ifdef WIN32
+#define SWITCH_SEQ_FWHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
+#define SWITCH_SEQ_FRED FOREGROUND_RED | FOREGROUND_INTENSITY
+#define SWITCH_SEQ_FMAGEN FOREGROUND_BLUE | FOREGROUND_RED
+#define SWITCH_SEQ_FCYAN FOREGROUND_GREEN | FOREGROUND_BLUE
+#define SWITCH_SEQ_FGREEN FOREGROUND_GREEN
+#define SWITCH_SEQ_FYELLOW FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY
+#define SWITCH_SEQ_DEFAULT_COLOR SWITCH_SEQ_FWHITE
+#else
 #define SWITCH_SEQ_ESC "\033["
 /* Ansi Control character suffixes */
 #define SWITCH_SEQ_HOME_CHAR 'H'
@@ -91,6 +100,7 @@
 #define SWITCH_SEQ_CLEARLINE SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINE_CHAR_STR
 #define SWITCH_SEQ_CLEARLINEEND SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINEEND_CHAR
 #define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME
+#endif
 #define SWITCH_DEFAULT_DTMF_DURATION 2000
 #define SWITCH_MAX_DTMF_DURATION 192000
 #define SWITCH_DEFAULT_DIR_PERMS SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE
@@ -100,8 +110,11 @@
 #define SWITCH_PATH_SEPARATOR "/"
 #endif
 #define SWITCH_URL_SEPARATOR "://"
+#define SWITCH_COPY_XML_CDR_VARIABLE "copy_xml_cdr"
+#define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application"
 #define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause"
 #define SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE "execute_on_answer"
+#define SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE "execute_on_ring"
 #define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout"
 #define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid"
 #define SWITCH_API_BRIDGE_END_VARIABLE "api_after_bridge"
@@ -156,7 +169,8 @@
 	SBF_EXEC_BLEG = (1 << 3),
 	SBF_EXEC_OPPOSITE = (1 << 4),
 	SBF_EXEC_SAME = (1 << 5)
-} switch_bind_flag_t;
+} switch_bind_flag_enum_t;
+typedef uint32_t switch_bind_flag_t;
 
 typedef enum {
 	SWITCH_DTMF_RECV = 0,
@@ -167,19 +181,22 @@
 	SOF_NONE = 0,
 	SOF_NOBLOCK = (1 << 0),
 	SOF_FORKED_DIAL = (1 << 1)
-} switch_originate_flag_t;
+} switch_originate_flag_enum_t;
+typedef uint32_t switch_originate_flag_t;
 
 typedef enum {
 	SPF_NONE = 0,
 	SPF_ODD = (1 << 0),
 	SPF_EVEN = (1 << 1)
-} switch_port_flag_t;
+} switch_port_flag_enum_t;
+typedef uint32_t switch_port_flag_t;
 
 typedef enum {
 	ED_MUX_READ = (1 << 0),
 	ED_MUX_WRITE = (1 << 1),
 	ED_DTMF = (1 << 2)
-} switch_eavesdrop_flag_t;
+} switch_eavesdrop_flag_enum_t;
+typedef uint32_t switch_eavesdrop_flag_t;
 
 typedef enum {
 	SCF_NONE = 0,
@@ -187,7 +204,8 @@
 	SCF_NO_NEW_SESSIONS = (1 << 1),
 	SCF_SHUTTING_DOWN = (1 << 2),
 	SCF_CRASH_PROT = (1 << 3)
-} switch_core_flag_t;
+} switch_core_flag_enum_t;
+typedef uint32_t switch_core_flag_t;
 
 typedef enum {
 	SWITCH_ENDPOINT_INTERFACE,
@@ -210,7 +228,8 @@
 	SUF_THREAD_RUNNING = (1 << 0),
 	SUF_READY = (1 << 1),
 	SUF_NATIVE = (1 << 2)
-} switch_unicast_flag_t;
+} switch_unicast_flag_enum_t;
+typedef uint32_t switch_unicast_flag_t;
 
 typedef enum {
 	SWITCH_FALSE = 0,
@@ -256,7 +275,8 @@
 	SSHF_OWN_THREAD = (1 << 0),
 	SSHF_FREE_ARG = (1 << 1),
 	SSHF_NO_DEL = (1 << 2)
-} switch_scheduler_flag_t;
+} switch_scheduler_flag_enum_t;
+typedef uint32_t switch_scheduler_flag_t;
 
 typedef enum {
 	SMF_NONE = 0,
@@ -266,7 +286,8 @@
 	SMF_FORCE = (1 << 3),
 	SMF_LOOP = (1 << 4),
 	SMF_HOLD_BLEG = (1 << 5)
-} switch_media_flag_t;
+} switch_media_flag_enum_t;
+typedef uint32_t switch_media_flag_t;
 
 typedef enum {
 	SWITCH_BITPACK_MODE_RFC3551,
@@ -323,7 +344,7 @@
 #define SWITCH_MAX_SAMPLE_LEN 32
 #define SWITCH_BYTES_PER_SAMPLE 2	/* slin is 2 bytes per sample */
 #define SWITCH_RECOMMENDED_BUFFER_SIZE (SWITCH_BYTES_PER_SAMPLE * SWITCH_MAX_SAMPLE_LEN * (SWITCH_MAX_INTERVAL + SWITCH_INTERVAL_PAD))
-#define SWITCH_MAX_CODECS 30
+#define SWITCH_MAX_CODECS 50
 #define SWITCH_MAX_STATE_HANDLERS 30
 #define SWITCH_CORE_QUEUE_LEN 100000
 #define SWITCH_MAX_MANAGEMENT_BUFFER_LEN 1024 * 8
@@ -334,7 +355,8 @@
 	SWITCH_CPF_SCREEN = (1 << 0),
 	SWITCH_CPF_HIDE_NAME = (1 << 1),
 	SWITCH_CPF_HIDE_NUMBER = (1 << 2)
-} switch_caller_profile_flag_t;
+} switch_caller_profile_flag_enum_t;
+typedef uint32_t switch_caller_profile_flag_t;
 
 typedef enum {
 	SWITCH_AUDIO_COL_STR_TITLE = 0x01,
@@ -351,7 +373,8 @@
 	SWITCH_XML_SECTION_DIRECTORY = (1 << 1),
 	SWITCH_XML_SECTION_DIALPLAN = (1 << 2),
 	SWITCH_XML_SECTION_PHRASES = (1 << 3)
-} switch_xml_section_t;
+} switch_xml_section_enum_t;
+typedef uint32_t switch_xml_section_t;
 
 /*!
   \enum switch_vad_flag_t
@@ -368,7 +391,8 @@
 	SWITCH_VAD_FLAG_EVENTS_TALK = (1 << 1),
 	SWITCH_VAD_FLAG_EVENTS_NOTALK = (1 << 2),
 	SWITCH_VAD_FLAG_CNG = (1 << 3)
-} switch_vad_flag_t;
+} switch_vad_flag_enum_t;
+typedef uint32_t switch_vad_flag_t;
 
 #define SWITCH_RTP_CNG_PAYLOAD 13
 
@@ -414,14 +438,15 @@
 	SWITCH_RTP_FLAG_SECURE_RECV_RESET = (1 << 17),
 	SWITCH_RTP_FLAG_PROXY_MEDIA = (1 << 18),
 	SWITCH_RTP_FLAG_SHUTDOWN = (1 << 19)
-} switch_rtp_flag_t;
+} switch_rtp_flag_enum_t;
+typedef uint32_t switch_rtp_flag_t;
 
 
 #ifdef _MSC_VER
 #pragma pack(push, r1, 1)
 #endif
 
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if SWITCH_BYTE_ORDER == __BIG_ENDIAN
 typedef struct {
 	unsigned version:2;			/* protocol version       */
 	unsigned p:1;				/* padding flag           */
@@ -482,7 +507,8 @@
 	SWITCH_IVR_OPTION_NONE = 0,
 	SWITCH_IVR_OPTION_ASYNC = (1 << 0),
 	SWITCH_IVR_OPTION_FILE = (1 << 1)
-} switch_ivr_option_t;
+} switch_ivr_option_enum_t;
+typedef uint32_t switch_ivr_option_t;
 
 /*!
   \enum switch_core_session_message_types_t
@@ -634,7 +660,8 @@
 
 typedef enum {
 	SCSMF_DYNAMIC = (1 << 0)
-} switch_core_session_message_flag_t;
+} switch_core_session_message_flag_enum_t;
+typedef uint32_t switch_core_session_message_flag_t;
 
 #define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
 #define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
@@ -741,7 +768,8 @@
 	CF_PROXY_MEDIA = (1 << 27),
 	CF_INNER_BRIDGE = (1 << 28),
 	CF_REQ_MEDIA = (1 << 29)
-} switch_channel_flag_t;
+} switch_channel_flag_enum_t;
+typedef uint32_t switch_channel_flag_t;
 
 
 /*!
@@ -764,13 +792,15 @@
 	SFF_PLC = (1 << 3),
 	SFF_RFC2833 = (1 << 4),
 	SFF_PROXY_PACKET = (1 << 5)
-} switch_frame_flag_t;
+} switch_frame_flag_enum_t;
+typedef uint32_t switch_frame_flag_t;
 
 
 typedef enum {
 	SAF_NONE = 0,
 	SAF_SUPPORT_NOMEDIA = (1 << 0)
-} switch_application_flag_t;
+} switch_application_flag_enum_t;
+typedef uint32_t switch_application_flag_t;
 
 /*!
   \enum switch_signal_t
@@ -811,7 +841,8 @@
 	SWITCH_CODEC_FLAG_FREE_POOL = (1 << 5),
 	SWITCH_CODEC_FLAG_AAL2 = (1 << 6),
 	SWITCH_CODEC_FLAG_PASSTHROUGH = (1 << 7)
-} switch_codec_flag_t;
+} switch_codec_flag_enum_t;
+typedef uint32_t switch_codec_flag_t;
 
 
 /*!
@@ -832,8 +863,8 @@
 	SWITCH_SPEECH_FLAG_FREE_POOL = (1 << 2),
 	SWITCH_SPEECH_FLAG_BLOCKING = (1 << 3),
 	SWITCH_SPEECH_FLAG_PAUSE = (1 << 4)
-
-} switch_speech_flag_t;
+} switch_speech_flag_enum_t;
+typedef uint32_t switch_speech_flag_t;
 
 /*!
   \enum switch_asr_flag_t
@@ -853,7 +884,9 @@
 	SWITCH_ASR_FLAG_CLOSED = (1 << 2),
 	SWITCH_ASR_FLAG_FIRE_EVENTS = (1 << 3),
 	SWITCH_ASR_FLAG_AUTO_RESUME = (1 << 4)
-} switch_asr_flag_t;
+
+} switch_asr_flag_enum_t;
+typedef uint32_t switch_asr_flag_t;
 
 /*!
   \enum switch_directory_flag_t
@@ -865,7 +898,8 @@
 typedef enum {
 	SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0)
 
-} switch_directory_flag_t;
+} switch_directory_flag_enum_t;
+typedef uint32_t switch_directory_flag_t;
 
 /*!
   \enum switch_codec_type_t
@@ -894,7 +928,8 @@
 */
 typedef enum {
 	SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0)
-} switch_timer_flag_t;
+} switch_timer_flag_enum_t;
+typedef uint32_t switch_timer_flag_t;
 
 
 /*!
@@ -920,7 +955,8 @@
 	SMBF_STEREO = (1 << 5),
 	SMBF_RECORD_ANSWER_REQ = (1 << 6),
 	SMBF_THREAD_LOCK = (1 << 7)
-} switch_media_bug_flag_t;
+} switch_media_bug_flag_enum_t;
+typedef uint32_t switch_media_bug_flag_t;
 
 /*!
   \enum switch_file_flag_t
@@ -954,12 +990,14 @@
 	SWITCH_FILE_SEEK = (1 << 10),
 	SWITCH_FILE_OPEN = (1 << 11),
 	SWITCH_FILE_CALLBACK = (1 << 12)
-} switch_file_flag_t;
+} switch_file_flag_enum_t;
+typedef uint32_t switch_file_flag_t;
 
 typedef enum {
 	SWITCH_IO_FLAG_NONE = 0,
 	SWITCH_IO_FLAG_NOBLOCK = (1 << 0)
-} switch_io_flag_t;
+} switch_io_flag_enum_t;
+typedef uint32_t switch_io_flag_t;
 
 /* make sure this is synced with the EVENT_NAMES array in switch_event.c
    also never put any new ones before EVENT_ALL
@@ -1017,6 +1055,9 @@
 	SWITCH_EVENT_EXE_SCHEDULE		- Something scheduled has been executed
 	SWITCH_EVENT_RE_SCHEDULE		- Something scheduled has been rescheduled
 	SWITCH_EVENT_RELOADXML			- XML registry has been reloaded
+	SWITCH_EVENT_NOTIFY				- Notification
+	SWITCH_EVENT_SEND_MESSAGE		- Message
+	SWITCH_EVENT_RECV_MESSAGE		- Message
     SWITCH_EVENT_ALL				- All events at once
 </pre>
 
@@ -1071,6 +1112,9 @@
 	SWITCH_EVENT_EXE_SCHEDULE,
 	SWITCH_EVENT_RE_SCHEDULE,
 	SWITCH_EVENT_RELOADXML,
+	SWITCH_EVENT_NOTIFY,
+	SWITCH_EVENT_SEND_MESSAGE,
+	SWITCH_EVENT_RECV_MESSAGE,
 	SWITCH_EVENT_ALL
 } switch_event_types_t;
 
@@ -1080,8 +1124,8 @@
 } switch_input_type_t;
 
 typedef enum {
-	SWITCH_CAUSE_UNALLOCATED = 0,
-	SWITCH_CAUSE_SUCCESS = 1,
+	SWITCH_CAUSE_NONE = 0,
+	SWITCH_CAUSE_UNALLOCATED_NUMBER = 1,
 	SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET = 2,
 	SWITCH_CAUSE_NO_ROUTE_DESTINATION = 3,
 	SWITCH_CAUSE_CHANNEL_UNACCEPTABLE = 6,
@@ -1130,6 +1174,7 @@
 	SWITCH_CAUSE_MANDATORY_IE_LENGTH_ERROR = 103,
 	SWITCH_CAUSE_PROTOCOL_ERROR = 111,
 	SWITCH_CAUSE_INTERWORKING = 127,
+	SWITCH_CAUSE_SUCCESS = 142,
 	SWITCH_CAUSE_ORIGINATOR_CANCEL = 487,
 	SWITCH_CAUSE_CRASH = 500,
 	SWITCH_CAUSE_SYSTEM_SHUTDOWN = 501,
@@ -1205,7 +1250,7 @@
 typedef struct switch_core_port_allocator switch_core_port_allocator_t;
 typedef struct switch_media_bug switch_media_bug_t;
 typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t);
-
+typedef struct switch_xml_binding switch_xml_binding_t;
 
 typedef switch_status_t (*switch_core_codec_encode_func_t) (switch_codec_t *codec,
 															switch_codec_t *other_codec,
@@ -1327,5 +1372,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h	Mon Aug  4 21:29:58 2008
@@ -104,6 +104,22 @@
 !strcasecmp(expr, "active") ||\
 !strcasecmp(expr, "allow") ||\
 atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE
+
+/*!
+  \brief Evaluate the falsefullness of a string expression
+  \param expr a string expression
+  \return true or false 
+*/
+#define switch_false(expr)\
+(expr && ( !strcasecmp(expr, "no") ||\
+!strcasecmp(expr, "off") ||\
+!strcasecmp(expr, "false") ||\
+!strcasecmp(expr, "disabled") ||\
+!strcasecmp(expr, "inactive") ||\
+!strcasecmp(expr, "disallow") ||\
+!atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE
+
+
 /*!
   \brief find local ip of the box
   \param buf the buffer to write the ip adress found into
@@ -118,10 +134,44 @@
   \brief find the char representation of an ip adress
   \param buf the buffer to write the ip adress found into
   \param len the length of the buf
-  \param in the struct in_addr * to get the adress from
+  \param sa the struct sockaddr * to get the adress from
+  \param salen the length of sa
   \return the ip adress string
 */
-SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct in_addr *in);
+SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct sockaddr *sa, socklen_t salen);
+
+/*!
+  \brief get the port number of an ip address
+  \param sa the struct sockaddr * to get the port from
+  \return the ip adress string
+*/
+SWITCH_DECLARE(unsigned short) get_port(struct sockaddr *sa);
+
+/*!
+  \brief flags to be used with switch_build_uri()
+ */
+enum switch_uri_flags {
+	SWITCH_URI_NUMERIC_HOST = 1,
+	SWITCH_URI_NUMERIC_PORT = 2,
+	SWITCH_URI_NO_SCOPE = 4,
+};
+
+/*!
+  \brief build a URI string from components
+  \param uri output string
+  \param size maximum size of output string (including trailing null)
+  \param scheme URI scheme
+  \param user user part or null if none
+  \param sa host address
+  \param flags logical OR-ed combination of flags from \ref switch_uri_flags
+  \return number of characters printed (not including the trailing null)
+ */
+SWITCH_DECLARE(int) switch_build_uri(char *uri,
+									 switch_size_t size,
+									 const char *scheme,
+									 const char *user,
+									 const switch_sockaddr_t *sa,
+									 int flags);
 
 #define SWITCH_STATUS_IS_BREAK(x) (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35)
 
@@ -363,12 +413,17 @@
 
 SWITCH_DECLARE(int) switch_parse_cidr(const char *string, uint32_t *ip, uint32_t *mask, uint32_t *bitp);
 SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, switch_bool_t default_type, switch_memory_pool_t *pool);
-SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok);
+SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token);
+#define switch_network_list_add_cidr(_list, _cidr_str, _ok) switch_network_list_add_cidr_token(_list, _cidr_str, _ok, NULL)
+
+
 SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network_list_t *list, const char *host, const char *mask_str, switch_bool_t ok);
-SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip(switch_network_list_t *list, uint32_t ip);
+SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_network_list_t *list, uint32_t ip, const char **token);
+#define switch_network_list_validate_ip(_list, _ip) switch_network_list_validate_ip_token(_list, _ip, NULL);
+
 #define switch_test_subnet(_ip, _net, _mask) (_mask ? ((_net & _mask) == (_ip & _mask)) : _net ? _net == _ip : 1)
 
-	 int switch_inet_pton(int af, const char *src, void *dst);
+int switch_inet_pton(int af, const char *src, void *dst);
 
 /* malloc or DIE macros */
 #ifdef NDEBUG
@@ -394,5 +449,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h	Mon Aug  4 21:29:58 2008
@@ -58,6 +58,8 @@
 #include <switch.h>
 
 
+struct switch_xml_binding;
+
 ///\defgroup xml1 XML Library Functions
 ///\ingroup core1
 ///\{
@@ -349,6 +351,19 @@
 ///\note gateway functions will be executed in the order they were binded until a success is found else the root registry will be used
 SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function(switch_xml_search_function_t function, switch_xml_section_t sections, void *user_data);
 
+///\brief bind a search function to an external gateway
+///\param function the search function to bind
+///\param sections a bitmask of sections you wil service
+///\param user_data a pointer to private data to be used during the callback
+///\param binding a handle to use to later unbind.
+///\return SWITCH_STATUS_SUCCESS if successful
+///\note gateway functions will be executed in the order they were binded until a success is found else the root registry will be used
+SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function_removable(switch_xml_search_function_t function, 
+																		  switch_xml_section_t sections, void *user_data, switch_xml_binding_t **binding);
+
+SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function(switch_xml_binding_t **binding);
+SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function_ptr(switch_xml_search_function_t function);
+
 ///\brief parse a string for a list of sections
 ///\param str a | delimited list of section names
 ///\return the section mask
@@ -365,5 +380,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c	Mon Aug  4 21:29:58 2008
@@ -29,6 +29,7 @@
  * Paul Tinsley <jackhammer at gmail.com>
  * Marcel Barbulescu <marcelbarbulescu at gmail.com>
  * Bret McDanel <trixter AT 0xdecafbad.com>
+ * Cesar Cepeda <cesar at auronix.com>
  *
  * 
  * mod_commands.c -- Misc. Command Module
@@ -178,6 +179,60 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_STANDARD_API(url_decode_function)
+{
+	char *reply = "";
+	char *data = NULL;
+
+	if (!switch_strlen_zero(cmd)) {
+		data = strdup(cmd);
+		switch_url_decode(data);
+		reply = data;
+	}
+	
+	stream->write_function(stream, "%s", reply);
+
+	switch_safe_free(data);
+    return SWITCH_STATUS_SUCCESS;
+	
+}
+
+SWITCH_STANDARD_API(module_exists_function)
+{
+	if (!switch_strlen_zero(cmd)) {
+		if(switch_loadable_module_exists(cmd) == SWITCH_STATUS_SUCCESS) {
+			stream->write_function(stream, "true");
+		} else {
+			stream->write_function(stream, "false");
+
+		}		
+	}
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+SWITCH_STANDARD_API(url_encode_function)
+{
+	char *reply = "";
+	char *data = NULL;
+	int len = 0 ;
+
+	if (!switch_strlen_zero(cmd)) {
+		len = (strlen(cmd) * 3) + 1;
+		switch_zmalloc(data, len);
+		switch_url_encode(cmd, data, len);
+		reply = data;
+	}
+
+	stream->write_function(stream, "%s", reply);
+
+	switch_safe_free(data);
+    return SWITCH_STATUS_SUCCESS;
+
+}
+
+
 SWITCH_STANDARD_API(user_exists_function)
 {
 	return _find_user(cmd, session, stream, SWITCH_TRUE);
@@ -562,7 +617,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#define CTL_SYNTAX "[hupall|pause|resume|shutdown|sync_clock|reclaim_mem|max_sessions|max_dtmf_duration [num]|loglevel [level]]"
+#define CTL_SYNTAX "[hupall|pause|resume|shutdown|sps|sync_clock|reclaim_mem|max_sessions|max_dtmf_duration [num]|loglevel [level]]"
 SWITCH_STANDARD_API(ctl_function)
 {
 	int argc;
@@ -1028,7 +1083,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#define MEDIA_SYNTAX "<uuid>"
+#define MEDIA_SYNTAX "[off] <uuid>"
 SWITCH_STANDARD_API(uuid_media_function)
 {
 	char *mycmd = NULL, *argv[4] = { 0 };
@@ -1578,7 +1633,7 @@
 
 	SWITCH_STANDARD_STREAM(stream);
 	switch_api_execute(cmd, arg, NULL, &stream);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Command %s(%s):\n%s\n", cmd, arg, switch_str_nil((char *) stream.data));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Command %s(%s):\n%s\n", cmd, switch_str_nil(arg), switch_str_nil((char *) stream.data));
 	switch_safe_free(stream.data);
 }
 
@@ -1789,6 +1844,7 @@
 	int print_title;
 	switch_xml_t xml;
 	int rows;
+	int justcount;
 };
 
 static int show_as_xml_callback(void *pArg, int argc, char **argv, char **columnNames)
@@ -1803,7 +1859,12 @@
 			return -1;
 		}
 	}
-
+	
+	if (holder->justcount) {
+	    holder->count++;
+	    return 0;
+	}
+		
 	if (!(row = switch_xml_add_child_d(holder->xml, "row", holder->rows++))) {
 		return -1;
 	}
@@ -1836,7 +1897,12 @@
 {
 	struct holder *holder = (struct holder *) pArg;
 	int x;
-
+	
+	if (holder->justcount) {
+	    holder->count++;
+	    return 0;
+	}
+	
 	if (holder->print_title && holder->count == 0) {
 		if (holder->http) {
 			holder->stream->write_function(holder->stream, "\n<tr>");
@@ -1911,7 +1977,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#define SHOW_SYNTAX "codec|application|api|dialplan|file|timer|calls|channels|aliases|complete"
+#define SHOW_SYNTAX "codec|application|api|dialplan|file|timer|calls [count]|channels [count]|aliases|complete|chat|endpoint|management|say|interfaces|interface_types"
 SWITCH_STANDARD_API(show_function)
 {
 	char sql[1024];
@@ -1929,13 +1995,16 @@
 	}
 
 	db = switch_core_db_handle();
-
+	
+	holder.justcount = 0;
+	
 	if (cmd && (mydata = strdup(cmd))) {
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 		command = argv[0];
 		if (argv[2] && !strcasecmp(argv[1], "as")) {
 			as = argv[2];
 		}
+		
 	}
 
 	if (stream->param_event) {
@@ -1949,21 +2018,48 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 
+
 	/* If you change the field qty or order of any of these select */
 	/* statmements, you must also change show_callback and friends to match! */
 	if (!command) {
 		stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
-	} else if (!strcasecmp(command, "codec") || !strcasecmp(command, "dialplan") || !strcasecmp(command, "file") || !strcasecmp(command, "timer")) {
+	} else if (!strncasecmp(command, "codec", 5) || 
+			   !strncasecmp(command, "dialplan", 8) || 
+			   !strncasecmp(command, "file", 4) || 
+			   !strncasecmp(command, "timer", 5) || 
+			   !strncasecmp(command, "chat", 4) || 
+			   !strncasecmp(command, "say", 3) || 
+			   !strncasecmp(command, "management", 10) || 
+			   !strncasecmp(command, "endpoint", 8)) {
+		if (end_of(command) == 's') {
+			end_of(command) = '\0';
+		}
 		sprintf(sql, "select type, name from interfaces where type = '%s' order by type,name", command);
+	} else if (!strcasecmp(command, "interfaces")) {
+		sprintf(sql, "select type, name from interfaces order by type,name");
+	} else if (!strcasecmp(command, "interface_types")) {
+		sprintf(sql, "select type,count(type) as total from interfaces group by type order by type");
 	} else if (!strcasecmp(command, "tasks")) {
 		sprintf(sql, "select * from %s", command);
 	} else if (!strcasecmp(command, "application") || !strcasecmp(command, "api")) {
 		sprintf(sql, "select name, description, syntax from interfaces where type = '%s' and description != '' order by type,name", command);
 	} else if (!strcasecmp(command, "calls")) {
 		sprintf(sql, "select * from calls order by created_epoch");
+		if (argv[1] && !strcasecmp(argv[1],"count")) {
+		    holder.justcount = 1;
+		    if (argv[3] && !strcasecmp(argv[2], "as")) {
+			as = argv[3];
+		    }
+		}
 	} else if (!strcasecmp(command, "channels")) {
 		sprintf(sql, "select * from channels order by created_epoch");
+		if (argv[1] && !strcasecmp(argv[1],"count")) {
+		    holder.justcount = 1;
+		    if (argv[3] && !strcasecmp(argv[2], "as")) {
+			as = argv[3];
+		    }
+		}
 	} else if (!strcasecmp(command, "aliases")) {
 		sprintf(sql, "select * from aliases order by alias");
 	} else if (!strcasecmp(command, "complete")) {
@@ -2178,6 +2274,57 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define UUID_SEND_DTMF_SYNTAX "<uuid> <dtmf_data>"
+SWITCH_STANDARD_API(uuid_send_dtmf_function)
+{
+	switch_core_session_t *psession = NULL;
+	char *mycmd = NULL, *argv[2] = { 0 };
+	char *uuid = NULL, *dtmf_data = NULL;
+	int argc = 0;
+
+	if (session) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (switch_strlen_zero(cmd)) {
+		goto usage;
+	}
+
+	if (!(mycmd = strdup(cmd))) {
+		goto usage;
+	}
+
+	if ((argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
+		goto usage;
+	}
+
+	uuid = argv[0];
+	dtmf_data = argv[1];
+	if (switch_strlen_zero(uuid) || switch_strlen_zero(dtmf_data)) {
+		goto usage;
+	}
+
+	if (!(psession = switch_core_session_locate(uuid))) {
+		stream->write_function(stream, "-ERR Cannot locate session!\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	switch_core_session_send_dtmf_string(psession, (const char *) dtmf_data);
+	goto done;
+
+usage:
+	stream->write_function(stream, "-USAGE: %s\n", UUID_SEND_DTMF_SYNTAX);
+	switch_safe_free(mycmd);
+
+done:
+	if (psession) {
+		switch_core_session_rwunlock(psession);
+	}
+
+	switch_safe_free(mycmd);
+	return SWITCH_STATUS_SUCCESS;
+}
+
 #define DUMP_SYNTAX "<uuid> [format]"
 SWITCH_STANDARD_API(uuid_dump_function)
 {
@@ -2246,7 +2393,7 @@
 #define GLOBAL_SETVAR_SYNTAX "<var> <value>"
 SWITCH_STANDARD_API(global_setvar_function)
 {
-	char *mycmd = NULL, *argv[3] = { 0 };
+	char *mycmd = NULL, *argv[2] = { 0 };
 	int argc = 0;
 
 	if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
@@ -2275,13 +2422,11 @@
 SWITCH_STANDARD_API(global_getvar_function)
 {
 
-	if (!switch_strlen_zero(cmd)) {
+	if (switch_strlen_zero(cmd)) {
+		switch_core_dump_variables(stream);
+	} else {
 		stream->write_function(stream, "%s", switch_str_nil(switch_core_get_variable(cmd)));
-		goto done;
 	}
-
-	stream->write_function(stream, "-USAGE: %s\n", GLOBAL_GETVAR_SYNTAX);
-  done:
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -2295,6 +2440,7 @@
 	SWITCH_ADD_API(commands_api_interface, "uuid_kill", "Kill Channel", kill_function, KILL_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "uuid_park", "Park Channel", park_function, PARK_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "reloadacl", "Reload ACL", reload_acl_function, "[reloadxml]");
+	switch_console_set_complete("add reloadacl reloadxml");
 	SWITCH_ADD_API(commands_api_interface, "reloadxml", "Reload XML", reload_function, "");
 	SWITCH_ADD_API(commands_api_interface, "unload", "Unload Module", unload_function, LOAD_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "load", "Load Module", load_function, LOAD_SYNTAX);
@@ -2302,8 +2448,23 @@
 	SWITCH_ADD_API(commands_api_interface, "pause", "Pause", pause_function, PAUSE_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "break", "Break", break_function, BREAK_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "show", "Show", show_function, SHOW_SYNTAX);
+	switch_console_set_complete("add show channels");
+	switch_console_set_complete("add show codec");
+	switch_console_set_complete("add show application");
+	switch_console_set_complete("add show api");
+	switch_console_set_complete("add show dialplan");
+	switch_console_set_complete("add show file");
+	switch_console_set_complete("add show timer");
+	switch_console_set_complete("add show calls");
+	switch_console_set_complete("add show channels");
+	switch_console_set_complete("add show aliases");
+	switch_console_set_complete("add show complete");
 	SWITCH_ADD_API(commands_api_interface, "complete", "Complete", complete_function, COMPLETE_SYNTAX);
+	switch_console_set_complete("add complete add");
+	switch_console_set_complete("add complete del");
 	SWITCH_ADD_API(commands_api_interface, "alias", "Alias", alias_function, ALIAS_SYNTAX);
+	switch_console_set_complete("add alias add");
+	switch_console_set_complete("add alias del");
 	SWITCH_ADD_API(commands_api_interface, "status", "status", status_function, "");
 	SWITCH_ADD_API(commands_api_interface, "uuid_bridge", "uuid_bridge", uuid_bridge_function, "");
 	SWITCH_ADD_API(commands_api_interface, "uuid_setvar", "uuid_setvar", uuid_setvar_function, SETVAR_SYNTAX);
@@ -2318,6 +2479,15 @@
 	SWITCH_ADD_API(commands_api_interface, "uuid_display", "change display", uuid_display_function, DISPLAY_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "uuid_media", "media", uuid_media_function, MEDIA_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "fsctl", "control messages", ctl_function, CTL_SYNTAX);
+	switch_console_set_complete("add fsctl hupall");
+	switch_console_set_complete("add fsctl pause");
+	switch_console_set_complete("add fsctl resume");
+	switch_console_set_complete("add fsctl shutdown");
+	switch_console_set_complete("add fsctl sps");
+ 	switch_console_set_complete("add fsctl sync_clock");
+	switch_console_set_complete("add fsctl reclaim_mem");
+	switch_console_set_complete("add fsctl max_sessions");
+	switch_console_set_complete("add fsctl max_dtmf_duration");
 	SWITCH_ADD_API(commands_api_interface, "help", "Show help for all the api commands", help_function, "");
 	SWITCH_ADD_API(commands_api_interface, "version", "Show version of the switch", version_function, "");
 	SWITCH_ADD_API(commands_api_interface, "sched_hangup", "Schedule a running call to hangup", sched_hangup_function, SCHED_HANGUP_SYNTAX);
@@ -2339,6 +2509,10 @@
 	SWITCH_ADD_API(commands_api_interface, "user_exists", "find a user", user_exists_function, "<key> <user> <domain>");
 	SWITCH_ADD_API(commands_api_interface, "xml_locate", "find some xml", xml_locate_function, "[root | <section> <tag> <tag_attr_name> <tag_attr_val>]");
 	SWITCH_ADD_API(commands_api_interface, "user_data", "find user data", user_data_function, "<user>@<domain> [var|param] <name>");
+	SWITCH_ADD_API(commands_api_interface, "url_encode", "url encode a string", url_encode_function, "<string>");
+	SWITCH_ADD_API(commands_api_interface, "url_decode", "url decode a string", url_decode_function, "<string>");
+	SWITCH_ADD_API(commands_api_interface, "module_exists", "check if module exists", module_exists_function, "<module>");
+	SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_NOUNLOAD;
@@ -2352,5 +2526,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c	Mon Aug  4 21:29:58 2008
@@ -27,7 +27,7 @@
  * Neal Horman <neal at wanlink dot com>
  * Bret McDanel <trixter at 0xdecafbad dot com>
  * Dale Thatcher <freeswitch at dalethatcher dot com>
- *
+ * Chris Danielson <chris at maxpowersoft dot com>
  *
  * mod_conference.c -- Software Conference Bridge
  *
@@ -75,6 +75,7 @@
 	uint32_t id_pool;
 	int32_t running;
 	uint32_t threads;
+	switch_event_node_t *node;
 } globals;
 
 typedef enum {
@@ -229,6 +230,7 @@
 	char *caller_id_number;
 	char *sound_prefix;
 	char *special_announce;
+	char *auto_record;
 	uint32_t max_members;
 	char *maxmember_sound;
 	uint32_t anounce_count;
@@ -362,7 +364,7 @@
 static void launch_conference_thread(conference_obj_t *conference);
 static void launch_conference_video_thread(conference_obj_t *conference);
 static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj);
-static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin);
+static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin, void *buf, uint32_t buflen);
 static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin);
 static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin);
 static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop);
@@ -879,6 +881,21 @@
 	switch_mutex_lock(globals.hash_mutex);
 	globals.threads++;
 	switch_mutex_unlock(globals.hash_mutex);
+	
+	if (conference->auto_record) {
+		imember = conference->members;
+		if (imember) {
+			switch_channel_t *channel = switch_core_session_get_channel(imember->session);
+			char *rfile = switch_channel_expand_variables(channel, conference->auto_record); 
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Auto recording file: %s\n", rfile);
+			launch_conference_record_thread(conference, rfile);
+			if (rfile != conference->auto_record) {
+				switch_safe_free(rfile);
+			}
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Auto Record Failed.  No members in conference.\n");
+		}
+	}
 
 	while (globals.running && !switch_test_flag(conference, CFLAG_DESTRUCT)) {
 		switch_size_t file_sample_len = samples;
@@ -1065,16 +1082,21 @@
 #endif
 				}
 			}
-			/* Go back and write each member his dedicated copy of the audio frame that does not contain his own audio. */
-			for (imember = conference->members; imember; imember = imember->next) {
-				if (switch_test_flag(imember, MFLAG_RUNNING)) {
-					switch_mutex_lock(imember->audio_out_mutex);
-					switch_buffer_write(imember->mux_buffer, imember->mux_frame, bytes);
-					switch_mutex_unlock(imember->audio_out_mutex);
+			if (bytes) {
+				/* Go back and write each member his dedicated copy of the audio frame that does not contain his own audio. */
+				for (imember = conference->members; imember; imember = imember->next) {
+					if (switch_test_flag(imember, MFLAG_RUNNING)) {
+						switch_size_t ok = 1;
+						switch_mutex_lock(imember->audio_out_mutex);
+						ok = switch_buffer_write(imember->mux_buffer, imember->mux_frame, bytes);
+						switch_mutex_unlock(imember->audio_out_mutex);
+						if (!ok) {
+							goto end;
+						}
+					}
 				}
 			}
 		}
-
 		if (conference->async_fnode && conference->async_fnode->done) {
 			switch_memory_pool_t *pool;
 			switch_core_file_close(&conference->async_fnode->fh);
@@ -1100,7 +1122,9 @@
 		}
 
 		switch_mutex_unlock(conference->mutex);
-	}							/* Rinse ... Repeat */
+	}
+	/* Rinse ... Repeat */
+ end:
 
 	if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
@@ -1629,7 +1653,7 @@
 			switch_audio_resampler_t *read_resampler = member->read_resampler;
 			void *data;
 			uint32_t datalen;
-
+			
 			if (read_resampler) {
 				int16_t *bptr = (int16_t *) read_frame->data;
 				int len = (int) read_frame->datalen;
@@ -1653,10 +1677,17 @@
 				switch_change_sln_volume(data, datalen / 2, member->volume_in_level);
 			}
 
-			/* Write the audio into the input buffer */
-			switch_mutex_lock(member->audio_in_mutex);
-			switch_buffer_write(member->audio_buffer, data, datalen);
-			switch_mutex_unlock(member->audio_in_mutex);
+			if (datalen) {
+				switch_size_t ok = 1;
+
+				/* Write the audio into the input buffer */
+				switch_mutex_lock(member->audio_in_mutex);
+				ok = switch_buffer_write(member->audio_buffer, data, datalen);
+				switch_mutex_unlock(member->audio_in_mutex);
+				if (!ok) {
+					break;
+				}
+			}
 		}
 	}
 
@@ -3952,12 +3983,19 @@
 }
 
 /* Play a file */
-static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin)
+static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin, void *buf, uint32_t buflen)
 {
 	uint32_t x = 0;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	switch_channel_t *channel;
 	char *expanded = NULL;
+	switch_input_args_t args = { 0 }, *ap = NULL;
+
+	if (buf) {
+		args.buf = buf;
+		args.buflen = buflen;
+		ap = &args;
+	}
 
 	/* generate some space infront of the file to be played */
 	for (x = 0; x < leadin; x++) {
@@ -3984,7 +4022,7 @@
 			if (!(conference->tts_engine && conference->tts_voice)) {
 				status = SWITCH_STATUS_FALSE;
 			} else {
-				status = switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, path + 4, NULL);
+				status = switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, path + 4, ap);
 			}
 			goto done;
 		}
@@ -3997,7 +4035,7 @@
 			path = dpath;
 		}
 
-		status = switch_ivr_play_file(session, NULL, path, NULL);
+		status = switch_ivr_play_file(session, NULL, path, ap);
 		switch_safe_free(dpath);
 	}
 
@@ -4250,6 +4288,8 @@
 			goto done;
 		}
 
+		switch_channel_set_variable(channel, "conference_name", conference->name);
+
 		/* Set the minimum number of members (once you go above it you cannot go below it) */
 		conference->min = 2;
 
@@ -4279,6 +4319,8 @@
 			if (dpin) {
 				conference->pin = switch_core_strdup(conference->pool, dpin);
 			}
+		
+			switch_channel_set_variable(channel, "conference_name", conference->name);
 
 			/* Set the minimum number of members (once you go above it you cannot go below it) */
 			conference->min = 1;
@@ -4288,6 +4330,8 @@
 
 			/* Start the conference thread for this conference */
 			launch_conference_thread(conference);
+		} else { /* setup user variable */
+			switch_channel_set_variable(channel, "conference_name", conference->name);
 		}
 
 		/* acquire a read lock on the thread so it can't leave without us */
@@ -4311,7 +4355,7 @@
 
 				/* be friendly */
 				if (conference->pin_sound) {
-					conference_local_play_file(conference, session, conference->pin_sound, 20);
+					conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
 				}
 				/* wait for them if neccessary */
 				if (strlen(pin_buf) < strlen(conference->pin)) {
@@ -4331,7 +4375,7 @@
 
 					/* more friendliness */
 					if (conference->bad_pin_sound) {
-						conference_local_play_file(conference, session, conference->bad_pin_sound, 20);
+						conference_local_play_file(conference, session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
 					}
 				}
 				pin_retries--;
@@ -4343,7 +4387,7 @@
 		}
 
 		if (conference->special_announce) {
-			conference_local_play_file(conference, session, conference->special_announce, CONF_DEFAULT_LEADIN);
+			conference_local_play_file(conference, session, conference->special_announce, CONF_DEFAULT_LEADIN, NULL, 0);
 		}
 
 		/* don't allow more callers if the conference is locked, unless we invited them */
@@ -4352,7 +4396,7 @@
 			if (conference->locked_sound) {
 				/* Answer the channel */
 				switch_channel_answer(channel);
-				conference_local_play_file(conference, session, conference->locked_sound, 20);
+				conference_local_play_file(conference, session, conference->locked_sound, 20, NULL, 0);
 			}
 			goto done;
 		}
@@ -4366,7 +4410,7 @@
 			if (conference->maxmember_sound) {
 				/* Answer the channel */
 				switch_channel_answer(channel);
-				conference_local_play_file(conference, session, conference->maxmember_sound, 20);
+				conference_local_play_file(conference, session, conference->maxmember_sound, 20, NULL, 0);
 			}
 			goto done;
 		}
@@ -4798,6 +4842,7 @@
 	switch_status_t status;
 	int comfort_noise_level = 0;
 	char *suppress_events = NULL;
+	char *auto_record = NULL;
 
 	/* Validate the conference name */
 	if (switch_strlen_zero(name)) {
@@ -4915,6 +4960,8 @@
 			}
 		} else if (!strcasecmp(var, "suppress-events") && !switch_strlen_zero(val)) {
 			suppress_events = val;
+		} else if (!strcasecmp(var, "auto-record") && !switch_strlen_zero(val)) {
+			auto_record = val;
 		}
 	}
 
@@ -5070,6 +5117,10 @@
 		clear_eflags(suppress_events, &conference->eflags);
 	}
 
+	if (!switch_strlen_zero(auto_record)) {
+		conference->auto_record = switch_core_strdup(conference->pool, auto_record);
+	}
+	
 	/* caller control configuration chores */
 	if (switch_ivr_digit_stream_parser_new(conference->pool, &conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) {
 
@@ -5258,7 +5309,7 @@
 	switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
 
 	/* Subscribe to presence request events */
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n");
 		return SWITCH_STATUS_GENERR;
 	}
@@ -5283,6 +5334,9 @@
 			switch_yield(100000);
 		}
 
+		switch_event_unbind(&globals.node);
+		switch_event_free_subclass(CONF_EVENT_MAINT);
+
 		/* free api interface help ".syntax" field string */
 		switch_safe_free(api_syntax);
 	}
@@ -5299,5 +5353,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c	Mon Aug  4 21:29:58 2008
@@ -175,9 +175,11 @@
 		if (strchr(argv[1], 'a')) {
 			bind_flags |= SBF_DIAL_ALEG;
 		}
+
 		if (strchr(argv[1], 'b')) {
 			bind_flags |= SBF_DIAL_BLEG;
 		}
+
 		if (strchr(argv[2], 'a')) {
 			if ((bind_flags & SBF_EXEC_BLEG)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind execute to multiple legs\n");
@@ -185,6 +187,7 @@
 				bind_flags |= SBF_EXEC_ALEG;
 			}
 		}
+
 		if (strchr(argv[2], 'b')) {
 			if ((bind_flags & SBF_EXEC_ALEG)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind execute to multiple legs\n");
@@ -193,6 +196,14 @@
 			}
 		}
 
+		if (strchr(argv[2], 'a')) {
+			if ((bind_flags & SBF_EXEC_BLEG)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind execute to multiple legs\n");
+			} else {
+				bind_flags |= SBF_EXEC_ALEG;
+			}
+		}
+
 		if (strchr(argv[2], 'o')) {
 			if ((bind_flags & SBF_EXEC_BLEG) || (bind_flags & SBF_EXEC_ALEG) || (bind_flags & SBF_EXEC_SAME)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind execute to multiple legs\n");
@@ -304,7 +315,9 @@
 				}
 				if (e_data.total) {
 					for (x = 0; x < e_data.total && switch_channel_ready(channel); x++) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Spy: %s\n", e_data.uuid_list[x]);
+						/* If we have a group and 1000 concurrent calls, we will flood the logs. This check avoids this */
+						if ( !require_group )
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Spy: %s\n", e_data.uuid_list[x]);
 						if ((file = switch_channel_get_variable(channel, "eavesdrop_indicate_new"))) {
 							switch_ivr_play_file(session, NULL, file, NULL);
 						}
@@ -352,54 +365,7 @@
 #define SET_USER_SYNTAX "<user>@<domain>"
 SWITCH_STANDARD_APP(set_user_function)
 {
-	switch_xml_t x_domain, xml = NULL, x_user, x_param, x_params;
-	char *user, *mailbox, *domain;
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-
-	if (switch_strlen_zero(data)) {
-		goto error;
-	}
-
-	user = switch_core_session_strdup(session, data);
-
-	if (!(domain = strchr(user, '@'))) {
-		goto error;
-	}
-
-	*domain++ = '\0';
-
-	if (switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, NULL) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", user, domain);
-		goto done;
-	}
-
-	if ((mailbox = (char *) switch_xml_attr(x_user, "mailbox"))) {
-		switch_channel_set_variable(channel, "mailbox", mailbox);
-	}
-
-	if ((x_params = switch_xml_child(x_user, "variables"))) {
-		for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
-			const char *var = switch_xml_attr(x_param, "name");
-			const char *val = switch_xml_attr(x_param, "value");
-
-			if (var && val) {
-				switch_channel_set_variable(channel, var, val);
-			}
-		}
-	}
-
-	switch_channel_set_variable(channel, "user_name", user);
-	switch_channel_set_variable(channel, "domain_name", domain);
-
-	goto done;
-
-  error:
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No user at domain specified.\n");
-
-  done:
-	if (xml) {
-		switch_xml_free(xml);
-	}
+	switch_ivr_set_user(session, data);
 }
 
 SWITCH_STANDARD_APP(ring_ready_function)
@@ -573,16 +539,6 @@
 	}
 }
 
-SWITCH_STANDARD_APP(sleep_function)
-{
-	if (switch_strlen_zero(data)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No timeout specified.\n");
-	} else {
-		uint32_t ms = atoi(data);
-		switch_ivr_sleep(session, ms);
-	}
-}
-
 SWITCH_STANDARD_APP(delay_function)
 {
 	uint32_t len = 0;
@@ -698,10 +654,13 @@
 SWITCH_STANDARD_APP(set_function)
 {
 	char *var, *val = NULL;
-
+	
 	if (switch_strlen_zero(data)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
 	} else {
+		switch_channel_t *channel = switch_core_session_get_channel(session);
+		char *expanded = NULL;
+
 		var = switch_core_session_strdup(session, data);
 		val = strchr(var, '=');
 
@@ -712,8 +671,16 @@
 			}
 		}
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", var, val ? val : "UNDEF");
-		switch_channel_set_variable(switch_core_session_get_channel(session), var, val);
+		if (val) {
+			expanded = switch_channel_expand_variables(channel, val);
+		}
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", var, expanded ? expanded : "UNDEF");
+		switch_channel_set_variable(channel, var, expanded);
+
+		if (expanded && expanded != val) {
+			switch_safe_free(expanded);
+		}
 	}
 }
 
@@ -1080,8 +1047,11 @@
 		switch_chat_interface_t *ci;
 
 		if ((ci = switch_loadable_module_get_chat_interface(argv[0]))) {
-			ci->chat_send("dp", argv[1], argv[2], "", argv[3], "");
-			stream->write_function(stream, "Sent");
+			if (ci->chat_send("dp", argv[1], argv[2], "", argv[3], "") == SWITCH_STATUS_SUCCESS) {
+				stream->write_function(stream, "Sent");
+			} else {
+				stream->write_function(stream, "Error! Message Not Sent");
+			}
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Chat Interface [%s]!\n", argv[0]);
 		}
@@ -1222,7 +1192,9 @@
 			}
 		} else {
 			if ((to = atol(argv[3])) < switch_timestamp(NULL)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
+				if (to >= 1) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
+				}
 				to = 0;
 			}
 		}
@@ -1307,6 +1279,26 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+
+SWITCH_STANDARD_APP(sleep_function)
+{	
+	if (switch_strlen_zero(data)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No timeout specified.\n");
+	} else {
+		uint32_t ms = atoi(data);
+		char buf[10];
+		switch_input_args_t args = { 0 };
+
+		args.input_callback = on_dtmf;
+		args.buf = buf;
+		args.buflen = sizeof(buf);
+		
+		switch_ivr_sleep(session, ms, &args);
+	}
+}
+
+
+
 SWITCH_STANDARD_APP(clear_speech_cache_function)
 {
 	switch_ivr_clear_speech_cache(session);
@@ -1797,7 +1789,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Originate Failed.  Cause: %s\n", switch_channel_cause2str(cause));
 
 		/* no answer is *always* a reason to continue */
-		if (cause == SWITCH_CAUSE_NO_ANSWER || cause == SWITCH_CAUSE_NO_USER_RESPONSE) {
+		if (cause == SWITCH_CAUSE_NO_ANSWER || cause == SWITCH_CAUSE_NO_USER_RESPONSE || cause == SWITCH_CAUSE_ORIGINATOR_CANCEL) {
 			return;
 		}
 
@@ -1903,7 +1895,7 @@
 	switch_xml_t x_domain = NULL, xml = NULL, x_user = NULL, x_param, x_params;
 	char *user = NULL, *domain = NULL;
 	const char *dest = NULL;
-	static switch_call_cause_t cause = SWITCH_CAUSE_UNALLOCATED;
+	static switch_call_cause_t cause = SWITCH_CAUSE_NONE;
 	unsigned int timelimit = 60;
 	switch_channel_t *new_channel = NULL;
 	switch_event_t *params = NULL;
@@ -1961,6 +1953,13 @@
 		char *d_dest = NULL;
 		switch_channel_t *channel;
 		switch_originate_flag_t myflags = SOF_NONE;
+		char *cid_name_override = NULL;
+		char *cid_num_override = NULL;
+		
+		if (var_event) {
+			cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name");
+			cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number");
+		}
 
 		if (session) {
 			channel = switch_core_session_get_channel(session);
@@ -1992,7 +1991,8 @@
 			myflags |= SOF_NOBLOCK;
 		}
 
-		if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL, NULL, NULL, NULL, myflags) == SWITCH_STATUS_SUCCESS) {
+		if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL, 
+								 cid_name_override, cid_num_override, NULL, myflags) == SWITCH_STATUS_SUCCESS) {
 			const char *context;
 			switch_caller_profile_t *cp;
 
@@ -2057,6 +2057,105 @@
 	switch_ivr_unhold_uuid(switch_core_session_get_uuid(session));
 }
 
+#define WAIT_FOR_SILENCE_SYNTAX "<silence_thresh> <silence_hits> <listen_hits> <timeout_ms> [<file>]"
+SWITCH_STANDARD_APP(wait_for_silence_function)
+{
+	char *argv[5] = { 0 };
+	uint32_t thresh, silence_hits, listen_hits, timeout_ms = 0;
+	int argc;
+	char *lbuf = NULL;
+	
+	if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
+		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 3) {
+		thresh = atoi(argv[0]);
+		silence_hits = atoi(argv[1]);
+		listen_hits = atoi(argv[2]);
+
+		if (argv[3]) {
+			if ((timeout_ms = atoi(argv[3])) < 0) {
+				timeout_ms = 0;
+			}
+		}
+
+		if (thresh > 0 && silence_hits > 0 && listen_hits > 0) {
+			switch_ivr_wait_for_silence(session, thresh, silence_hits, listen_hits, timeout_ms, argv[4]);
+			return;
+		}
+
+	} 
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", WAIT_FOR_SILENCE_SYNTAX);
+
+}
+
+static switch_status_t event_chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint)
+{
+	switch_event_t *event;
+
+	if (switch_event_create(&event, SWITCH_EVENT_RECV_MESSAGE) == SWITCH_STATUS_SUCCESS) {
+		if (proto) switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Proto", "%s", proto);
+		if (from) switch_event_add_header(event, SWITCH_STACK_BOTTOM, "From", "%s", from);
+		if (subject) switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Subject", "%s", subject);
+		if (hint) switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Hint", "%s", hint);
+		if (body) switch_event_add_body(event, "%s", body);
+		if (to) { 
+			const char *v;
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "To", "%s", to);
+			if ((v = switch_core_get_variable(to))) {
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Command", "%s", v);
+			}
+		}
+
+		if (switch_event_fire(&event) == SWITCH_STATUS_SUCCESS) {
+			return SWITCH_STATUS_SUCCESS;
+		}
+
+		switch_event_destroy(&event);
+	}
+	
+	return SWITCH_STATUS_MEMERR;
+}
+
+
+static switch_status_t api_chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint)
+{
+
+	if (to) { 
+		const char *v;
+		switch_stream_handle_t stream = { 0 };
+		char *cmd, *arg;
+		switch_chat_interface_t *ci;
+
+		if (!(v = switch_core_get_variable(to))) {
+			v = to;
+		}
+
+		cmd = strdup(v);
+		switch_assert(cmd);
+
+		switch_url_decode(cmd);
+
+		if ((arg = strchr(cmd, ' '))) {
+			*arg++ = '\0';
+		}
+
+		SWITCH_STANDARD_STREAM(stream);
+		switch_api_execute(cmd, arg, NULL, &stream);
+
+		if (proto && (ci = switch_loadable_module_get_chat_interface(proto))) {
+			ci->chat_send("api", to, hint && strchr(hint, '/') ? hint : from, "text/plain", (char *) stream.data, NULL);
+		}
+
+		switch_safe_free(stream.data);
+		
+		free(cmd);
+
+	}
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
 #define SPEAK_DESC "Speak text to a channel via the tts interface"
 #define DISPLACE_DESC "Displace audio from a file to the channels input"
 #define SESS_REC_DESC "Starts a background recording of the entire session"
@@ -2077,6 +2176,7 @@
 	switch_api_interface_t *api_interface;
 	switch_application_interface_t *app_interface;
 	switch_dialplan_interface_t *dp_interface;
+	switch_chat_interface_t *chat_interface;
 
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@@ -2085,6 +2185,10 @@
 	user_endpoint_interface->interface_name = "USER";
 	user_endpoint_interface->io_routines = &user_io_routines;
 
+
+	SWITCH_ADD_CHAT(chat_interface, "event", event_chat_send);
+	SWITCH_ADD_CHAT(chat_interface, "api", api_chat_send);
+
 	SWITCH_ADD_API(api_interface, "strepoch", "Convert a date string into epoch time", strepoch_api_function, "<string>");
 	SWITCH_ADD_API(api_interface, "chat", "chat", chat_api_function, "<proto>|<from>|<to>|<message>");
 	SWITCH_ADD_API(api_interface, "strftime", "strftime", strftime_api_function, "<format_string>");
@@ -2100,14 +2204,14 @@
 				   "<ip> <acl | cidr> [<hangup_cause>]", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "sleep", "Pause a channel", SLEEP_LONG_DESC, sleep_function, "<pausemilliseconds>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "delay_echo", "echo audio at a specified delay", "Delay n ms", delay_function, "<delay ms>", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "strftime", NULL, NULL, strftime_function, NULL, SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "strftime", "strftime", "strftime", strftime_function, "[<epoch>|]<format string>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "phrase", "Say a Phrase", "Say a Phrase", phrase_function, "<macro_name>,<data>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "eval", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "hangup", "Hangup the call", "Hangup the call for a channel.", hangup_function, "[<cause>]", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "set_name", "Name the channel", "Name the channel", set_name_function, "<name>", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "log", "Logs a channel variable", LOG_LONG_DESC, log_function, "<varname>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "log", "Logs to the logger", LOG_LONG_DESC, log_function, "<log_level> <log_string>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "info", "Display Call Info", "Display Call Info", info_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "event", "Fire an event", "Fire an event", event_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "export", "Export a channel variable across a bridge", EXPORT_LONG_DESC, export_function, "<varname>=<value>",
@@ -2170,7 +2274,7 @@
 				   "<path> [<time_limit_secs>] [<silence_thresh>] [<silence_hits>]", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "stop_displace_session", "Stop Displace File", "Stop Displacing to a file", stop_displace_session_function, "<path>",
 				   SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "displace_session", "Displace File", DISPLACE_DESC, displace_session_function, "<path> [+time_limit_ms] [mux]",
+	SWITCH_ADD_APP(app_interface, "displace_session", "Displace File", DISPLACE_DESC, displace_session_function, "<path> [<flags>] [+time_limit_ms]",
 				   SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "speak", "Speak text", SPEAK_DESC, speak_function, "<engine>|<voice>|<text>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "clear_speech_cache", "Clear Speech Handle Cache", "Clear Speech Handle Cache", clear_speech_cache_function, "",
@@ -2181,6 +2285,8 @@
 				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "say", "say", "say", say_function, SAY_SYNTAX, SAF_NONE);
 
+	SWITCH_ADD_APP(app_interface, "wait_for_silence", "wait_for_silence", "wait_for_silence", wait_for_silence_function, WAIT_FOR_SILENCE_SYNTAX, SAF_NONE);
+
 	SWITCH_ADD_DIALPLAN(dp_interface, "inline", inline_dialplan_hunt);
 
 	/* indicate that the module should continue to be loaded */
@@ -2196,5 +2302,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_enum/mod_enum.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_enum/mod_enum.c	Mon Aug  4 21:29:58 2008
@@ -76,6 +76,8 @@
 
 static enum dns_class qcls = DNS_C_IN;
 
+static switch_event_node_t *NODE = NULL;
+
 static struct {
 	char *root;
 	char *isn_root;
@@ -747,7 +749,6 @@
 	globals.timeout = 10;
 	load_config();
 	switch_mutex_unlock(MUTEX);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ENUM Reloaded\n");
 
 }
 
@@ -816,11 +817,11 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
 static void event_handler(switch_event_t *event)
 {
 	if (globals.auto_reload) {
 		do_load();
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ENUM Reloaded\n");
 	}
 }
 
@@ -833,15 +834,18 @@
 
 	switch_mutex_init(&MUTEX, SWITCH_MUTEX_NESTED, pool);
 
-	memset(&globals, 0, sizeof(globals));
-	do_load();
-
-
-	if (switch_event_bind(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_TERM;
 	}
 
+	if (dns_init(0) < 0) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	memset(&globals, 0, sizeof(globals));
+	do_load();
+	
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_API(api_interface, "enum", "ENUM", enum_function, "");
@@ -858,11 +862,13 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown)
 {
 
+	switch_event_unbind(&NODE);
+
 	if (globals.pool) {
 		switch_core_destroy_memory_pool(&globals.pool);
 	}
 
-	return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_UNLOAD;
 }
 
 /* For Emacs:
@@ -873,5 +879,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c	Mon Aug  4 21:29:58 2008
@@ -280,5 +280,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/mod_expr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/mod_expr.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/mod_expr.c	Mon Aug  4 21:29:58 2008
@@ -200,5 +200,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c	Mon Aug  4 21:29:58 2008
@@ -65,8 +65,15 @@
 			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
 			switch_channel_t *bchan = switch_core_session_get_channel(bleg);
 			switch_channel_t *channel = switch_core_session_get_channel(session);
+
+			const char *consumer_exit_key = switch_channel_get_variable(channel, "fifo_consumer_exit_key");
+
 			if (switch_channel_test_flag(switch_core_session_get_channel(session), CF_ORIGINATOR)) {
-				if (dtmf->digit == '*') {
+				if ( consumer_exit_key && dtmf->digit == *consumer_exit_key ) {
+					switch_channel_hangup(bchan, SWITCH_CAUSE_NORMAL_CLEARING);
+					return SWITCH_STATUS_BREAK;
+				}
+				else if ( !consumer_exit_key && dtmf->digit == '*' ) {
 					switch_channel_hangup(bchan, SWITCH_CAUSE_NORMAL_CLEARING);
 					return SWITCH_STATUS_BREAK;
 				} else if (dtmf->digit == '0') {
@@ -220,8 +227,8 @@
 {
 	fifo_node_t *node, **node_list = (fifo_node_t **) user_data;
 	int x = 0, total = 0, i = 0;
-
-	for (i = 0;; i++) {
+	
+	for (i = 0 ;; i++) {
 		if (!(node = node_list[i])) {
 			break;
 		}
@@ -242,6 +249,7 @@
 	switch_mutex_t *mutex;
 	switch_memory_pool_t *pool;
 	int running;
+	switch_event_node_t *node;
 } globals;
 
 
@@ -341,7 +349,7 @@
 
 #define MAX_NODES_PER_CONSUMER 25
 #define FIFO_DESC "Fifo for stacking parked calls."
-#define FIFO_USAGE "<fifo name> [in [<announce file>|undef] [<music file>|undef] | out [wait|nowait] [<announce file>|undef] [<music file>|undef]]"
+#define FIFO_USAGE "<fifo name>[!<importance_number>] [in [<announce file>|undef] [<music file>|undef] | out [wait|nowait] [<announce file>|undef] [<music file>|undef]]"
 SWITCH_STANDARD_APP(fifo_function)
 {
 	int argc;
@@ -448,8 +456,9 @@
 
 	check_string(announce);
 	check_string(moh);
+	switch_assert(node);
 
-	if (!consumer && node) {
+	if (!consumer) {
 		switch_core_session_t *other_session;
 		switch_channel_t *other_channel;
 		const char *uuid = switch_core_session_get_uuid(session);
@@ -734,17 +743,17 @@
 
 		while (switch_channel_ready(channel)) {
 			int x = 0, winner = -1;
-			switch_time_t longest = 0xFFFFFFFFFFFFFFFF / 2;
+			switch_time_t longest = (0xFFFFFFFFFFFFFFFFULL / 2);
 			uint32_t importance = 0, waiting = 0, most_waiting = 0;
 
 			pop = NULL;
 
 			if (moh && do_wait) {
-				switch_status_t moh_status = switch_ivr_play_file(session, NULL, moh, &args);
+				switch_status_t moh_status;
 				memset(&args, 0, sizeof(args));
 				args.read_frame_callback = consumer_read_frame_callback;
 				args.user_data = node_list;
-				switch_ivr_play_file(session, NULL, moh, &args);
+				moh_status = switch_ivr_play_file(session, NULL, moh, &args);
 
 				if (!SWITCH_READ_ACCEPTABLE(moh_status)) {
 					break;
@@ -853,7 +862,7 @@
 				if (announce) {
 					switch_ivr_play_file(session, NULL, announce, NULL);
 				} else {
-					switch_ivr_sleep(session, 500);
+					switch_ivr_sleep(session, 500, NULL);
 				}
 
 
@@ -1125,7 +1134,7 @@
 		switch_safe_free(xml_text);
 
 	} else if (!strcasecmp(argv[0], "importance")) {
-		if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
+		if (argv[1] && (node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
 			int importance = 0;
 			if (argc > 2) {
 				importance = atoi(argv[2]);
@@ -1181,7 +1190,8 @@
 	}
 
 	/* Subscribe to presence request events */
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, 
+									pres_event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n");
 		return SWITCH_STATUS_GENERR;
 	}
@@ -1194,6 +1204,11 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_APP(app_interface, "fifo", "Park with FIFO", FIFO_DESC, fifo_function, FIFO_USAGE, SAF_NONE);
 	SWITCH_ADD_API(commands_api_interface, "fifo", "Return data about a fifo", fifo_api_function, FIFO_API_SYNTAX);
+	switch_console_set_complete("add fifo list");
+	switch_console_set_complete("add fifo list_verbose");
+	switch_console_set_complete("add fifo count");
+	switch_console_set_complete("add fifo importance");
+
 	globals.running = 1;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -1209,7 +1224,10 @@
 	fifo_node_t *node;
 	switch_memory_pool_t *pool = globals.pool;
 	switch_mutex_t *mutex = globals.mutex;
-
+	
+	switch_event_unbind(&globals.node);
+	switch_event_free_subclass(FIFO_EVENT);
+	
 	switch_mutex_lock(mutex);
 
 	globals.running = 0;
@@ -1223,6 +1241,7 @@
 				free(pop);
 			}
 		}
+
 		switch_core_hash_destroy(&node->caller_hash);
 		switch_core_hash_destroy(&node->consumer_hash);
 	}
@@ -1242,5 +1261,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fsv/mod_fsv.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fsv/mod_fsv.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fsv/mod_fsv.c	Mon Aug  4 21:29:58 2008
@@ -231,7 +231,7 @@
 	aud_buffer = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
 	vid_buffer = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
 
-	if ((fd = open((char *) data, O_RDONLY)) < 0) {
+	if ((fd = open((char *) data, O_RDONLY | O_BINARY)) < 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error opening file %s\n", (char *) data);
 		return;
 	}
@@ -381,5 +381,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_limit/mod_limit.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_limit/mod_limit.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_limit/mod_limit.c	Mon Aug  4 21:29:58 2008
@@ -623,7 +623,13 @@
 	SWITCH_ADD_APP(app_interface, "group", "Manage a group", GROUP_DESC, group_function, GROUP_USAGE, SAF_SUPPORT_NOMEDIA);
 
 	SWITCH_ADD_API(commands_api_interface, "db", "db get/set", db_api_function, "[insert|delete|select]/<realm>/<key>/<value>");
+	switch_console_set_complete("add db insert");
+	switch_console_set_complete("add db delete");
+	switch_console_set_complete("add db select");
 	SWITCH_ADD_API(commands_api_interface, "group", "group [insert|delete|call]", group_api_function, "[insert|delete|call]:<group name>:<url>");
+	switch_console_set_complete("add group insert");
+	switch_console_set_complete("add group delete");
+	switch_console_set_complete("add group call");
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
@@ -639,5 +645,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_rss/mod_rss.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_rss/mod_rss.c	Mon Aug  4 21:29:58 2008
@@ -170,7 +170,6 @@
 	switch_speech_handle_t sh;
 	switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
 	switch_core_thread_session_t thread_session;
-	uint32_t rate, interval = 20;
 	switch_timer_t timer = { 0 }, *timerp = NULL;
 	uint32_t last;
 	char *mydata = NULL;
@@ -186,6 +185,8 @@
 	switch_input_args_t args = { 0 };
 	const char *vcf = NULL;
 	char *chanvars = switch_channel_build_param_string(channel, NULL, NULL);
+	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
+	uint32_t rate, interval = read_codec->implementation->microseconds_per_frame / 1000;
 
 	if ((vcf = switch_channel_get_variable(channel, "rss_alt_config"))) {
 		cf = vcf;
@@ -367,7 +368,7 @@
 			x = atoi(cmd) - 1;
 
 			if (x > -1 && x < feed_index) {
-				filename = feed_list[i];
+				filename = feed_list[x];
 			} else if (matches > 1) {
 
 			} else {
@@ -643,5 +644,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c	Mon Aug  4 21:29:58 2008
@@ -46,6 +46,7 @@
 
 #define VM_MAX_GREETINGS 9
 
+
 static struct {
 	switch_hash_t *profile_hash;
 	int debug;
@@ -94,6 +95,8 @@
 	char *callback_context;
 	char *email_body;
 	char *email_headers;
+	char *notify_email_body;
+	char *notify_email_headers;
 	char *web_head;
 	char *web_tail;
 	char *email_from;
@@ -272,6 +275,8 @@
 		char *callback_context = "default";
 		char *email_body = NULL;
 		char *email_headers = NULL;
+		char *notify_email_body = NULL;
+		char *notify_email_headers = NULL;
 		char *email_from = "";
 		char *date_fmt = "%A, %B %d %Y, %I %M %p";
 		char *web_head = NULL;
@@ -338,6 +343,36 @@
 						}
 					}
 					switch_safe_free(dpath);
+				} else if (!strcasecmp(var, "notify-template-file") && !switch_strlen_zero(val)) {
+					switch_stream_handle_t stream = { 0 };
+					int fd;
+					char *dpath = NULL;
+					char *path;
+
+					if (switch_is_file_path(val)) {
+						path = val;
+					} else {
+						dpath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, val);
+						path = dpath;
+					}
+
+					if ((fd = open(path, O_RDONLY)) > -1) {
+						char buf[2048];
+						SWITCH_STANDARD_STREAM(stream);
+						while (switch_fd_read_line(fd, buf, sizeof(buf))) {
+							stream.write_function(&stream, "%s", buf);
+						}
+						close(fd);
+						notify_email_headers = stream.data;
+						if ((notify_email_body = strstr(notify_email_headers, "\n\n"))) {
+							*notify_email_body = '\0';
+							notify_email_body += 2;
+						} else if ((notify_email_body = strstr(notify_email_headers, "\r\n\r\n"))) {
+							*notify_email_body = '\0';
+							notify_email_body += 4;
+						}
+					}
+					switch_safe_free(dpath);
 				}
 			}
 		}
@@ -614,6 +649,13 @@
 
 			profile->email_body = email_body;
 			profile->email_headers = email_headers;
+			if (notify_email_headers) {
+				profile->notify_email_body = notify_email_body;
+				profile->notify_email_headers = notify_email_headers;
+			} else {
+				profile->notify_email_body = email_body;
+				profile->notify_email_headers = email_headers;
+			}
 			profile->email_from = switch_core_strdup(globals.pool, email_from);
 			profile->date_fmt = switch_core_strdup(globals.pool, date_fmt);
 
@@ -892,6 +934,30 @@
 } msg_type_t;
 
 
+switch_status_t measure_file_len(const char *path, switch_size_t *message_len)
+{
+	
+	switch_file_handle_t fh = { 0 };
+	uint32_t pos = 0;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	if (switch_core_file_open(&fh,
+							  path,
+							  0,
+							  0,
+							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
+
+		if (switch_core_file_seek(&fh, &pos, 0, SEEK_END) == SWITCH_STATUS_SUCCESS) {
+			*message_len = pos;
+			status = SWITCH_STATUS_SUCCESS;
+		}
+		switch_core_file_close(&fh);
+	}
+	
+	return status;
+
+}
+
 static switch_status_t create_file(switch_core_session_t *session, vm_profile_t *profile,
 								   char *macro_name, char *file_path, switch_size_t *message_len, switch_bool_t limit)
 {
@@ -1231,7 +1297,7 @@
 {
 	vm_check_state_t vm_check_state = VM_CHECK_START;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_caller_profile_t *caller_profile;
+	switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(channel);
 	vm_profile_t *profile;
 	switch_xml_t x_domain = NULL, x_domain_root = NULL, x_user = NULL, x_params, x_param;
 	switch_status_t status;
@@ -1247,9 +1313,19 @@
 	int total_new_urgent_messages = 0;
 	int total_saved_urgent_messages = 0;
 	int heard_auto_saved = 0, heard_auto_new = 0;
-	char *email_vm = NULL;
+	char *vm_email = NULL;
 	char foo[2] = "";
 	switch_input_args_t args = { 0 };
+	const char *caller_id_name = NULL;
+	const char *caller_id_number = NULL;
+	
+	if (!(caller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name"))) {
+		caller_id_name = caller_profile->caller_id_name;
+	}
+
+	if (!(caller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number"))) {
+		caller_id_number = caller_profile->caller_id_number;
+	}
 
 	if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error invalid profile %s\n", profile_name);
@@ -1263,7 +1339,7 @@
 	status = switch_ivr_phrase_macro(session, VM_HELLO_MACRO, NULL, NULL, &args);
 
 	while (switch_channel_ready(channel)) {
-		switch_ivr_sleep(session, 100);
+		switch_ivr_sleep(session, 100, NULL);
 
 		switch (vm_check_state) {
 		case VM_CHECK_START:
@@ -1351,7 +1427,7 @@
 				message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
 							  &total_new_urgent_messages, &total_saved_urgent_messages);
 				memset(&cbt, 0, sizeof(cbt));
-				cbt.email = email_vm;
+				cbt.email = vm_email;
 				switch (play_msg_type) {
 				case MSG_NEW:
 					{
@@ -1566,13 +1642,13 @@
 				if (!x_user) {
 					switch_event_t *params;
 					int ok = 1;
-					caller_profile = switch_channel_get_caller_profile(channel);
+
 
 					switch_event_create(&params, SWITCH_EVENT_MESSAGE);
 					switch_assert(params);
 					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", myid);
 					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "destination_number", caller_profile->destination_number);
-					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "caller_id_number", caller_profile->caller_id_number);
+					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "caller_id_number", caller_id_number);
 
 
 					if (switch_xml_locate_user("id", myid, domain_name, switch_channel_get_variable(channel, "network_addr"),
@@ -1620,7 +1696,7 @@
 					} else if (!strcasecmp(var, "vm-password")) {
 						thepass = val;
 					} else if (!strcasecmp(var, "vm-mailto")) {
-						email_vm = switch_core_session_strdup(session, val);
+						vm_email = switch_core_session_strdup(session, val);
 					}
 				}
 				switch_xml_free(x_domain_root);
@@ -1677,10 +1753,431 @@
 }
 
 
+static void deliver_vm(vm_profile_t *profile, 
+					   switch_xml_t x_user, 
+					   const char *domain_name, 
+					   const char *path, 
+					   uint32_t message_len,
+					   const char *read_flags,
+					   switch_event_t *params, 
+					   switch_memory_pool_t *pool, 
+					   const char *caller_id_name, 
+					   const char *caller_id_number,
+					   switch_bool_t copy)
+{
+	char *file_path = NULL, *dir_path = NULL;
+	const char *myid = switch_xml_attr(x_user, "id");
+	switch_uuid_t uuid;
+	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
+	const char *filename;
+	switch_xml_t x_param, x_params;
+	char *vm_email = NULL;
+	char *vm_notify_email = NULL;
+	char *email_addr = NULL;
+	int send_mail = 0;
+	int send_main = 0;
+	int send_notify = 0;
+	int insert_db = 1;
+	int email_attach = 0;
+	char *myfolder = "inbox";
+	int priority = 3;
+	const char *tmp;
+	switch_event_t *local_event = NULL;
+
+	if (params) {
+		switch_event_create(&local_event, SWITCH_EVENT_MESSAGE);
+		params = local_event;
+	}
+	
+	if ((tmp = switch_event_get_header(params, "effective_caller_id_name"))) {
+		caller_id_name = tmp;
+	}
+
+	if ((tmp = switch_event_get_header(params, "effective_caller_id_number"))) {
+		caller_id_number = tmp;
+	}
+	
+	switch_uuid_get(&uuid);
+	switch_uuid_format(uuid_str, &uuid);
+
+	if ((filename = strrchr(path, *SWITCH_PATH_SEPARATOR))) {
+		filename++;
+	} else {
+		filename = path;
+	}
+
+	if (!(x_params = switch_xml_child(x_user, "params"))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find params for user [%s@%s]\n", myid, domain_name);
+		goto failed;
+	}
+
+	for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
+		const char *var = switch_xml_attr_soft(x_param, "name");
+		const char *val = switch_xml_attr_soft(x_param, "value");
+
+		if (!strcasecmp(var, "vm-mailto")) {
+			vm_email = switch_core_strdup(pool, val);
+		} else if (!strcasecmp(var, "vm-notify-mailto")) {
+			vm_notify_email = switch_core_strdup(pool, val);
+		} else if (!strcasecmp(var, "email-addr")) {
+			email_addr = switch_core_strdup(pool, val);
+		} else if (!strcasecmp(var, "vm-email-all-messages")) {
+			send_main = send_mail = switch_true(val);
+		} else if (!strcasecmp(var, "vm-notify-email-all-messages")) {
+			send_notify = send_mail = switch_true(val);
+		} else if (!strcasecmp(var, "vm-keep-local-after-email")) {
+			insert_db = switch_true(val);
+		} else if (!strcasecmp(var, "vm-attach-file")) {
+			email_attach = switch_true(val);
+		}
+	}
+
+
+	if (switch_strlen_zero(profile->storage_dir)) {
+		dir_path = switch_mprintf("%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
+								  SWITCH_PATH_SEPARATOR,
+								  SWITCH_PATH_SEPARATOR, profile->name, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, myid);
+	} else {
+		dir_path = switch_mprintf("%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, myid);
+	}
+
+	if (switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", dir_path);
+		goto failed;
+	}
+
+	file_path = switch_mprintf("%s%smsg_%s_broadcast_%s", dir_path, SWITCH_PATH_SEPARATOR, uuid_str, filename);
+
+	if (copy) {
+		switch_file_copy(path, file_path, SWITCH_FPROT_FILE_SOURCE_PERMS, pool);
+	} else {
+		file_path = (char *)path;
+	}
+
+	if (!message_len) {
+		size_t len = 0;
+		if (measure_file_len(file_path, &len) == SWITCH_STATUS_SUCCESS) {
+			message_len = len;
+		}
+	}
+
+
+	if (insert_db && switch_file_exists(file_path, pool) == SWITCH_STATUS_SUCCESS) {
+		char *usql;
+		switch_event_t *event;
+		char *mwi_id = NULL;
+		int total_new_messages = 0;
+		int total_saved_messages = 0;
+		int total_new_urgent_messages = 0;
+		int total_saved_urgent_messages = 0;
+		
+		usql = switch_mprintf("insert into voicemail_msgs values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long) switch_timestamp(NULL),
+							  myid, domain_name, uuid_str, caller_id_name, caller_id_number,
+							  myfolder, file_path, message_len, read_flags);
+		vm_execute_sql(profile, usql, profile->mutex);
+		switch_safe_free(usql);
+
+		message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
+					  &total_new_urgent_messages, &total_saved_urgent_messages);
+
+		if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
+			const char *yn = "no";
+			if (total_new_messages || total_new_urgent_messages) {
+				yn = "yes";
+			}
+			mwi_id = switch_mprintf("%s@%s", myid, domain_name);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", mwi_id);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
+									total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+			switch_event_fire(&event);
+			switch_safe_free(mwi_id);
+		}
+	}
+
+	if (send_mail && !switch_strlen_zero(vm_email) && switch_file_exists(file_path, pool) == SWITCH_STATUS_SUCCESS) {
+		switch_event_t *event;
+		char *from;
+		char *body;
+		char *headers;
+		char *header_string;
+		char tmpvar[50] = "";
+		int total_new_messages = 0;
+		int total_saved_messages = 0;
+		int total_new_urgent_messages = 0;
+		int total_saved_urgent_messages = 0;
+		char *p;
+		long l_duration = 0;
+		switch_core_time_duration_t duration;
+		char duration_str[80];
+		switch_time_exp_t tm;
+		char date[80] = "";
+		switch_size_t retsize;
+
+		message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
+					  &total_new_urgent_messages, &total_saved_urgent_messages);
+
+		switch_time_exp_lt(&tm, switch_timestamp_now());
+		switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
+
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_current_folder", myfolder);
+		switch_snprintf(tmpvar, sizeof(tmpvar), "%d", total_new_messages);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_total_new_messages", tmpvar);
+		switch_snprintf(tmpvar, sizeof(tmpvar), "%d", total_saved_messages);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_total_saved_messages", tmpvar);
+		switch_snprintf(tmpvar, sizeof(tmpvar), "%d", total_new_urgent_messages);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_urgent_new_messages", tmpvar);
+		switch_snprintf(tmpvar, sizeof(tmpvar), "%d", total_saved_urgent_messages);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_urgent_saved_messages", tmpvar);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_account", myid);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_domain", domain_name);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_caller_id_number", caller_id_number);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_caller_id_name", caller_id_name);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_file_path", file_path);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_read_flags", read_flags);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_time", date);
+		switch_snprintf(tmpvar, sizeof(tmpvar), "%d", priority);
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_priority", tmpvar);
+		if (vm_email) {
+			switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_email", vm_email);
+		}
+		if (vm_notify_email) {
+			switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_notify_email", vm_notify_email);
+		}
+		l_duration = (long) message_len *1000000;
+		switch_core_measure_time(l_duration, &duration);
+		duration.day += duration.yr * 365;
+		duration.hr += duration.day * 24;
+		switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", duration.hr, duration.min, duration.sec);
+
+		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_message_len", duration_str);
+
+		if (switch_strlen_zero(profile->email_from)) {
+			from = switch_core_sprintf(pool, "%s@%s", myid, domain_name);
+		} else {
+			from = switch_event_expand_headers(params, profile->email_headers);
+		}
+
+
+		if (send_main) {
+			if (switch_strlen_zero(profile->email_headers)) {
+				headers = switch_mprintf(
+										 "From: FreeSWITCH mod_voicemail <%s@%s>\n"
+										 "Subject: Voicemail from %s %s\nX-Priority: %d",
+										 myid, domain_name, caller_id_name, caller_id_number, priority);
+			} else {
+				headers = switch_event_expand_headers(params, profile->email_headers);
+			}
+
+			p = headers + (strlen(headers) - 1);
+
+			if (*p == '\n') {
+				if (*(p - 1) == '\r') {
+					p--;
+				}
+				*p = '\0';
+			}
+
+			header_string = switch_core_sprintf(pool, "%s\nX-Voicemail-Length: %u", headers, message_len);
+
+			switch_event_dup(&event, params);
+
+			if (event) {
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Type", "voicemail");
+				switch_event_fire(&event);
+			}
+
+			if (profile->email_body) {
+				body = switch_event_expand_headers(params, profile->email_body);
+			} else {
+				body = switch_mprintf("%u second Voicemail from %s %s", message_len, caller_id_name, caller_id_number);
+			}
+
+			if (email_attach) {
+				switch_simple_email(vm_email, from, header_string, body, file_path);
+			} else {
+				switch_simple_email(vm_email, from, header_string, body, NULL);
+			}
+
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending message to %s\n", vm_email);
+			switch_safe_free(body);
+
+			if (headers != profile->email_headers) {
+				switch_safe_free(headers);
+			}
+		}
+
+
+		if (send_notify) {
+			if (switch_strlen_zero(profile->notify_email_headers)) {
+				headers = switch_mprintf(
+										 "From: FreeSWITCH mod_voicemail <%s@%s>\n"
+										 "Subject: Voicemail from %s %s\nX-Priority: %d",
+										 myid, domain_name, caller_id_name, caller_id_number, priority);
+			} else {
+				headers = switch_event_expand_headers(params, profile->notify_email_headers);
+			}
+
+			p = headers + (strlen(headers) - 1);
+
+			if (*p == '\n') {
+				if (*(p - 1) == '\r') {
+					p--;
+				}
+				*p = '\0';
+			}
+
+			header_string = switch_core_sprintf(pool, "%s\nX-Voicemail-Length: %u", headers, message_len);
+
+			switch_event_dup(&event, params);
+
+			if (event) {
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Type", "voicemail-notify");
+				switch_event_fire(&event);
+			}
+
+			if (profile->notify_email_body) {
+				body = switch_event_expand_headers(params, profile->notify_email_body);
+			} else {
+				body = switch_mprintf("%u second Voicemail from %s %s", message_len, caller_id_name, caller_id_number);
+			}
+
+			switch_simple_email(vm_notify_email, from, header_string, body, NULL);
+
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending notify message to %s\n", vm_notify_email);
+			switch_safe_free(body);
+
+			if (headers != profile->notify_email_headers) {
+				switch_safe_free(headers);
+			}
+		}
+
+		if (!insert_db) {
+			if (unlink(file_path) != 0) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "failed to delete file [%s]\n", file_path);
+			}
+		}
+	}
+
+ failed:
+
+	switch_event_destroy(&local_event);
+
+	switch_safe_free(dir_path);
+
+	if (file_path != path) {
+		switch_safe_free(file_path);
+	}
+
+	return;
+
+}
+
+static switch_status_t voicemail_inject(const char *data)
+{
+	vm_profile_t *profile;
+	char *dup, *user = NULL, *domain = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	int istag = 0, isall = 0;
+	int argc = 0;
+    char *argv[4];
+	char *box, *path, *cid_num, *cid_name;
+	switch_memory_pool_t *pool = NULL;
+
+	dup = strdup(data);
+	switch_assert(dup);
+
+	if ((argc = switch_separate_string(dup, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "not enough args [%s]\n", data);
+		goto end;
+	}
+
+	box = argv[0];
+	path = argv[1];
+	cid_num = argv[2] ? argv[2] : "anonymous";
+	cid_name = argv[3] ? argv[3] : "anonymous";
+
+	user = box;
+	
+	if ((domain = strchr(user, '@'))) {
+		*domain++ = '\0';
+	} else {
+		domain = user;
+	}
+
+	if (switch_stristr("tag=", user)) {
+		user += 4;
+		istag++;
+	} else if (user == domain) {
+		isall++;
+	}
+	
+	if (!(user && domain)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid syntax [%s][%s]\n", switch_str_nil(user), switch_str_nil(domain));
+		goto end;
+	}
+
+	if (!(profile = switch_core_hash_find(globals.profile_hash, domain))) {
+		profile = switch_core_hash_find(globals.profile_hash, "default");
+	}
+	
+	if (!profile) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find profile\n");
+	} else {
+		switch_xml_t x_domain, xml_root;
+		switch_event_t *my_params = NULL;
+		switch_xml_t ut;
+
+		switch_event_create(&my_params, SWITCH_EVENT_MESSAGE);
+		switch_assert(my_params);
+		switch_event_add_header_string(my_params, SWITCH_STACK_BOTTOM, "domain", domain);
+		switch_event_add_header_string(my_params, SWITCH_STACK_BOTTOM, "purpose", "publish-vm");
+		
+		if (switch_xml_locate_domain(domain, my_params, &xml_root, &x_domain) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate domain %s\n", domain);
+			switch_event_destroy(&my_params);
+			goto end;
+		}
+		
+		switch_event_destroy(&my_params);
+
+		switch_core_new_memory_pool(&pool);
+		
+		if (!isall && !istag) {
+			ut = switch_xml_find_child(x_domain, "user", "id", user);
+			switch_event_create(&my_params, SWITCH_EVENT_MESSAGE);
+			deliver_vm(profile, ut, domain, path, 0, "B", my_params, pool, cid_name, cid_num, SWITCH_TRUE);
+			switch_event_destroy(&my_params);
+		} else {
+			for (ut = switch_xml_child(x_domain, "user"); ut; ut = ut->next) {
+				const char *tag;
+
+				if (isall || (istag && (tag=switch_xml_attr(ut, "vm-tag")) && !strcasecmp(tag, user))) {
+					switch_event_create(&my_params, SWITCH_EVENT_MESSAGE);
+					deliver_vm(profile, ut, domain, path, 0, "B", my_params, pool, cid_name, cid_num, SWITCH_TRUE);
+					switch_event_destroy(&my_params);
+				}
+			}
+		}
+		
+		switch_core_destroy_memory_pool(&pool);
+
+		switch_xml_free(xml_root);
+
+	}
+
+	
+ end:
+
+	switch_safe_free(dup);
+
+	return status;
+
+}
+
 static switch_status_t voicemail_leave_main(switch_core_session_t *session, const char *profile_name, const char *domain_name, const char *id)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	char *myfolder = "inbox";
 	char sql[256];
 	prefs_callback_t cbt;
 	vm_profile_t *profile;
@@ -1691,15 +2188,13 @@
 	switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(channel);
 	switch_file_handle_t fh = { 0 };
 	switch_input_args_t args = { 0 };
-	char *email_vm = NULL;
-	char *email_vm_notify = NULL;
+	char *vm_email = NULL;
+	char *vm_notify_email = NULL;
 	int send_mail = 0;
-	int send_mail_only = 0;
 	cc_t cc = { 0 };
 	char *read_flags = NORMAL_FLAG_STRING;
 	int priority = 3;
 	int email_attach = 1;
-	int email_delete = 1;
 	char buf[2];
 	char *greet_path = NULL;
 	const char *voicemail_greeting_number = NULL;
@@ -1709,6 +2204,22 @@
 	switch_size_t retsize;
 	switch_time_t ts = switch_timestamp_now();
 	char *dbuf = NULL;
+	int send_main = 0;
+	int send_notify = 0;
+	int insert_db = 1;
+	const char *caller_id_name = NULL;
+	const char *caller_id_number = NULL;
+	switch_xml_t x_domain = NULL, x_domain_root = NULL, x_user = NULL, x_params = NULL, x_param = NULL;
+	switch_event_t *vars = NULL;
+	const char *vm_cc = NULL, *vtmp, *vm_ext = NULL;
+	
+	if (!(caller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name"))) {
+		caller_id_name = caller_profile->caller_id_name;
+	}
+
+	if (!(caller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number"))) {
+		caller_id_number = caller_profile->caller_id_number;
+	}
 
 	memset(&cbt, 0, sizeof(cbt));
 	if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
@@ -1732,14 +2243,12 @@
 	if (id) {
 		int ok = 1;
 		switch_event_t *params = NULL;
-		switch_xml_t x_domain, x_domain_root, x_user, x_params, x_param;
 		const char *email_addr = NULL;
 
 		switch_event_create(&params, SWITCH_EVENT_MESSAGE);
 		switch_assert(params);
 		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", id);
 
-		x_user = x_domain = x_domain_root = NULL;
 		if (switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"),
 								   &x_domain_root, &x_domain, &x_user, params) == SWITCH_STATUS_SUCCESS) {
 			if ((x_params = switch_xml_child(x_user, "params"))) {
@@ -1748,34 +2257,56 @@
 					const char *val = switch_xml_attr_soft(x_param, "value");
 
 					if (!strcasecmp(var, "vm-mailto")) {
-						email_vm = switch_core_session_strdup(session, val);
-					} else if (!strcasecmp(var, "vm-mailto-notify")) {
-						email_vm_notify = switch_core_session_strdup(session, val);
+						vm_email = switch_core_session_strdup(session, val);
+					} else if (!strcasecmp(var, "vm-notify-mailto")) {
+						vm_notify_email = switch_core_session_strdup(session, val);
 					} else if (!strcasecmp(var, "email-addr")) {
-						email_addr = val;
-					} else if (!strcasecmp(var, "vm-email-only")) {
-						send_mail_only = switch_true(val);
+						email_addr = switch_core_session_strdup(session, val);
 					} else if (!strcasecmp(var, "vm-email-all-messages")) {
-						send_mail = switch_true(val);
-					} else if (!strcasecmp(var, "vm-delete-file")) {
-						email_delete = switch_true(val);
+						send_main = send_mail = switch_true(val);
+					} else if (!strcasecmp(var, "vm-notify-email-all-messages")) {
+						send_notify = send_mail = switch_true(val);
+					} else if (!strcasecmp(var, "vm-keep-local-after-email")) {
+						insert_db = switch_true(val);
 					} else if (!strcasecmp(var, "vm-attach-file")) {
 						email_attach = switch_true(val);
 					}
 				}
 			}
 
-			if (send_mail && switch_strlen_zero(email_vm) && !switch_strlen_zero(email_addr)) {
-				email_vm = switch_core_session_strdup(session, email_addr);
+			if (send_main && switch_strlen_zero(vm_email) && !switch_strlen_zero(email_addr)) {
+				vm_email = switch_core_session_strdup(session, email_addr);
+				if (switch_strlen_zero(vm_email)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No email address, not going to send email.\n");
+					send_main = 0;
+				}
+			}
+
+			if (send_notify && switch_strlen_zero(vm_notify_email)) {
+				vm_notify_email = vm_email;
+				if (switch_strlen_zero(vm_notify_email)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No notify email address, not going to notify.\n");
+					send_notify = 0;
+				}
+			}
+			
+			if (send_mail && (!(send_main || send_notify))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Falling back to leaving message locally due to too many misconfigurations.\n");
+				send_mail = 0;
+				insert_db = 1;
 			}
 
+			if (send_notify && !send_main) {
+				insert_db = 1;
+			}
+			
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", id, domain_name);
 			ok = 0;
 		}
 
 		switch_event_destroy(&params);
-		switch_xml_free(x_domain_root);
+		
 		if (!ok) {
 			goto end;
 		}
@@ -1784,7 +2315,12 @@
 	switch_snprintf(sql, sizeof(sql), "select * from voicemail_prefs where username='%s' and domain='%s'", id, domain_name);
 	vm_execute_sql_callback(profile, profile->mutex, sql, prefs_callback, &cbt);
 
-	file_path = switch_mprintf("%s%smsg_%s.%s", dir_path, SWITCH_PATH_SEPARATOR, uuid, profile->file_ext);
+	vm_ext = profile->file_ext;
+	if ((vtmp = switch_channel_get_variable(channel, "vm_message_ext"))) {
+		vm_ext = vtmp;
+	}
+
+	file_path = switch_mprintf("%s%smsg_%s.%s", dir_path, SWITCH_PATH_SEPARATOR, uuid, vm_ext);
 
 	if ((voicemail_greeting_number = switch_channel_get_variable(channel, "voicemail_greeting_number"))) {
 		int num = atoi(voicemail_greeting_number);
@@ -1859,7 +2395,7 @@
 	cc.noexit = 1;
 	args.buf = &cc;
 
-	dbuf = switch_mprintf("%s (%s)", caller_profile->caller_id_name, caller_profile->caller_id_number);
+	dbuf = switch_mprintf("%s (%s)", caller_id_name, caller_id_number);
 	switch_channel_set_variable(channel, "RECORD_ARTIST", dbuf);
 	free(dbuf);
 
@@ -1887,146 +2423,22 @@
 			TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL));
 		}
 	}
-
-	if (!send_mail_only && switch_file_exists(file_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
-		char *usql;
-		switch_event_t *event;
-		char *mwi_id = NULL;
-		int total_new_messages = 0;
-		int total_saved_messages = 0;
-		int total_new_urgent_messages = 0;
-		int total_saved_urgent_messages = 0;
-
-		usql = switch_mprintf("insert into voicemail_msgs values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long) switch_timestamp(NULL),
-							  id, domain_name, uuid, caller_profile->caller_id_name, caller_profile->caller_id_number,
-							  myfolder, file_path, message_len, read_flags);
-		vm_execute_sql(profile, usql, profile->mutex);
-		switch_safe_free(usql);
-
-		message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
-					  &total_new_urgent_messages, &total_saved_urgent_messages);
-
-		if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
-			const char *yn = "no";
-			if (total_new_messages || total_new_urgent_messages) {
-				yn = "yes";
-			}
-			mwi_id = switch_mprintf("%s@%s", id, domain_name);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", mwi_id);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
-									total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
-			switch_event_fire(&event);
-			switch_safe_free(mwi_id);
-		}
+	
+	switch_channel_get_variables(channel, &vars);
+	deliver_vm(profile, x_user, domain_name, file_path, message_len, read_flags, vars, 
+			   switch_core_session_get_pool(session), caller_id_name, caller_id_number, SWITCH_FALSE);
+	switch_event_destroy(&vars);
+
+	if ((vm_cc = switch_channel_get_variable(channel, "vm_cc"))) {
+		char *cmd = switch_core_session_sprintf(session, "%s %s %s %s", vm_cc, file_path, caller_id_number, caller_id_name);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc);
+		voicemail_inject(cmd);
 	}
 
-  end:
-
-	if (send_mail && !switch_strlen_zero(email_vm) && switch_file_exists(file_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
-		switch_event_t *event;
-		char *from;
-		char *body;
-		char *headers;
-		char *header_string;
-		char tmp[50] = "";
-		int total_new_messages = 0;
-		int total_saved_messages = 0;
-		int total_new_urgent_messages = 0;
-		int total_saved_urgent_messages = 0;
-		char *p;
-		long l_duration = 0;
-		switch_core_time_duration_t duration;
-		char duration_str[80];
-
-		message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
-					  &total_new_urgent_messages, &total_saved_urgent_messages);
-
-		switch_time_exp_lt(&tm, switch_timestamp_now());
-		switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
-
-		switch_channel_set_variable(channel, "voicemail_current_folder", myfolder);
-		switch_snprintf(tmp, sizeof(tmp), "%d", total_new_messages);
-		switch_channel_set_variable(channel, "voicemail_total_new_messages", tmp);
-		switch_snprintf(tmp, sizeof(tmp), "%d", total_saved_messages);
-		switch_channel_set_variable(channel, "voicemail_total_saved_messages", tmp);
-		switch_snprintf(tmp, sizeof(tmp), "%d", total_new_urgent_messages);
-		switch_channel_set_variable(channel, "voicemail_urgent_new_messages", tmp);
-		switch_snprintf(tmp, sizeof(tmp), "%d", total_saved_urgent_messages);
-		switch_channel_set_variable(channel, "voicemail_urgent_saved_messages", tmp);
-		switch_channel_set_variable(channel, "voicemail_account", id);
-		switch_channel_set_variable(channel, "voicemail_domain", domain_name);
-		switch_channel_set_variable(channel, "voicemail_caller_id_number", caller_profile->caller_id_number);
-		switch_channel_set_variable(channel, "voicemail_caller_id_name", caller_profile->caller_id_name);
-		switch_channel_set_variable(channel, "voicemail_file_path", file_path);
-		switch_channel_set_variable(channel, "voicemail_read_flags", read_flags);
-		switch_channel_set_variable(channel, "voicemail_time", date);
-		switch_snprintf(tmp, sizeof(tmp), "%d", priority);
-		switch_channel_set_variable(channel, "voicemail_priority", tmp);
-		switch_channel_set_variable(channel, "voicemail_email", email_vm);
-
-		l_duration = (long) message_len *1000000;
-		switch_core_measure_time(l_duration, &duration);
-		duration.day += duration.yr * 365;
-		duration.hr += duration.day * 24;
-		switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", duration.hr, duration.min, duration.sec);
-
-		switch_channel_set_variable(channel, "voicemail_message_len", duration_str);
-
-		if (switch_strlen_zero(profile->email_from)) {
-			from = switch_core_session_sprintf(session, "%s@%s", id, domain_name);
-		} else {
-			from = switch_channel_expand_variables(channel, profile->email_headers);
-		}
-
-		if (switch_strlen_zero(profile->email_headers)) {
-			headers = switch_core_session_sprintf(session,
-												  "From: FreeSWITCH mod_voicemail <%s@%s>\n"
-												  "Subject: Voicemail from %s %s\nX-Priority: %d",
-												  id, domain_name, caller_profile->caller_id_name, caller_profile->caller_id_number, priority);
-		} else {
-			headers = switch_channel_expand_variables(channel, profile->email_headers);
-		}
-
-		p = headers + (strlen(headers) - 1);
-
-		if (*p == '\n') {
-			if (*(p - 1) == '\r') {
-				p--;
-			}
-			*p = '\0';
-		}
-
-		header_string = switch_core_session_sprintf(session, "%s\nX-Voicemail-Length: %u", headers, message_len);
-
-		if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
-			switch_channel_event_set_data(channel, event);
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Type", "voicemail");
-			switch_event_fire(&event);
-		}
+ end:
 
-		if (profile->email_body) {
-			body = switch_channel_expand_variables(channel, profile->email_body);
-		} else {
-			body = switch_mprintf("%u second Voicemail from %s %s", message_len, caller_profile->caller_id_name, caller_profile->caller_id_number);
-		}
-
-		if (email_attach) {
-			switch_simple_email(email_vm, from, header_string, body, file_path);
-		} else {
-			switch_simple_email(email_vm, from, header_string, body, NULL);
-		}
-		if (!switch_strlen_zero(email_vm_notify)) {
-			switch_simple_email(email_vm_notify, from, header_string, body, NULL);
-		}
-
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending message to %s\n", email_vm);
-		switch_safe_free(body);
-		if (email_delete && send_mail_only) {
-			if (unlink(file_path) != 0) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "failed to delete file [%s]\n", file_path);
-			}
-		}
+	if (x_domain_root) {
+		switch_xml_free(x_domain_root);
 	}
 
 	switch_safe_free(file_path);
@@ -2678,6 +3090,16 @@
 	}
 }
 
+
+
+SWITCH_STANDARD_API(voicemail_inject_api_function)
+{
+	voicemail_inject(cmd);
+
+	stream->write_function(stream, "%s", "+OK\n");
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_STANDARD_API(voicemail_api_function)
 {
 	int argc = 0;
@@ -2797,13 +3219,14 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_APP(app_interface, "voicemail", "Voicemail", VM_DESC, voicemail_function, VM_USAGE, SAF_NONE);
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL)
+	if (switch_event_bind(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL)
 		!= SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
 	SWITCH_ADD_API(commands_api_interface, "voicemail", "voicemail", voicemail_api_function, VOICEMAIL_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "voicemail_inject", "voicemail", voicemail_inject_api_function, "");
 	SWITCH_ADD_API(commands_api_interface, "vm_boxcount", "vm_boxcount", boxcount_api_function, BOXCOUNT_SYNTAX);
 
 	/* indicate that the module should continue to be loaded */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/Makefile	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/Makefile	Mon Aug  4 21:29:58 2008
@@ -1,4 +1,4 @@
-LOCAL_INSERT_LDFLAGS=if test $$osarch = "Darwin" ; then echo "-framework swift" ; else echo "-L$(SWIFT_HOME)/lib -L/opt/swift/lib -lswift -lceplex_us -lceplang_en -lm" ; fi ;
+LOCAL_INSERT_LDFLAGS=if test $$osarch = "Darwin" ; then echo "-framework swift" ; else echo "-L$(SWIFT_HOME)/lib -L/opt/swift/lib -lswift -lm" ; fi ;
 
 LOCAL_INSERT_CFLAGS=test $$osarch = "Darwin" || echo "-I$(SWIFT_HOME)/include -I/opt/swift/include";
 LOCAL_CFLAGS=-w

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.2008.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.2008.vcproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.2008.vcproj	Mon Aug  4 21:29:58 2008
@@ -54,7 +54,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="swift.lib"
-				AdditionalLibraryDirectories="&quot;C:\Program Files\Cepstral\sdk\lib\winnt&quot;"
+				AdditionalLibraryDirectories="&quot;C:\Program Files\Cepstral\sdk\lib\winnt&quot;;&quot;C:\Program Files\Cepstral\sdk\lib\windows&quot;"
 				RandomizedBaseAddress="1"
 				DataExecutionPrevention="0"
 			/>
@@ -118,7 +118,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="swift.lib"
-				AdditionalLibraryDirectories="&quot;C:\Program Files\Cepstral\sdk\lib\winnt&quot;"
+				AdditionalLibraryDirectories="&quot;C:\Program Files\Cepstral\sdk\lib\winnt&quot;;&quot;C:\Program Files\Cepstral\sdk\lib\windows&quot;"
 				RandomizedBaseAddress="1"
 				DataExecutionPrevention="0"
 			/>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	Mon Aug  4 21:29:58 2008
@@ -114,7 +114,7 @@
 	return rv;
 }
 
-static switch_status_t cepstral_speech_open(switch_speech_handle_t *sh, char *voice_name, int rate, switch_speech_flag_t *flags)
+static switch_status_t cepstral_speech_open(switch_speech_handle_t *sh, const char *voice_name, int rate, switch_speech_flag_t *flags)
 {
 	cepstral_t *cepstral = switch_core_alloc(sh->memory_pool, sizeof(*cepstral));
 	char srate[25];
@@ -325,7 +325,7 @@
 	return status;
 }
 
-static void cepstral_text_param_tts(switch_speech_handle_t *sh, char *param, char *val)
+static void cepstral_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)
 {
 	cepstral_t *cepstral;
 
@@ -333,14 +333,14 @@
 	assert(cepstral != NULL);
 
 	if (!strcasecmp(param, "voice")) {
-		char *voice_name = val;
+		const char *voice_name = val;
 		if (!strcasecmp(voice_name, "next")) {
 			if ((cepstral->voice = swift_port_find_next_voice(cepstral->port))) {
 				if (SWIFT_FAILED(swift_port_set_voice(cepstral->port, cepstral->voice))) {
 					cepstral->done = cepstral->done_gen = 1;
 					return;
 				}
-				voice_name = (char *) swift_voice_get_attribute(cepstral->voice, "name");
+				voice_name = swift_voice_get_attribute(cepstral->voice, "name");
 			} else {
 				voice_name = NULL;
 			}
@@ -366,7 +366,7 @@
 				return;
 			}
 
-			voice_name = (char *) swift_voice_get_attribute(cepstral->voice, "name");
+			voice_name = swift_voice_get_attribute(cepstral->voice, "name");
 		}
 
 		if (voice_name) {
@@ -437,5 +437,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.vcproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.vcproj	Mon Aug  4 21:29:58 2008
@@ -23,7 +23,7 @@
 			>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;C:\Program Files\Cepstral\sdk\include&quot;"
+				AdditionalIncludeDirectories="&quot;C:\Program Files\Cepstral\sdk\lib\winnt&quot;;&quot;C:\Program Files\Cepstral\sdk\lib\windows&quot;"
 				UsePrecompiledHeader="0"
 			/>
 			<Tool
@@ -40,7 +40,7 @@
 			>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;C:\Program Files\Cepstral\sdk\include&quot;"
+				AdditionalIncludeDirectories="&quot;C:\Program Files\Cepstral\sdk\lib\winnt&quot;;&quot;C:\Program Files\Cepstral\sdk\lib\windows&quot;"
 				UsePrecompiledHeader="0"
 			/>
 			<Tool

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp	Mon Aug  4 21:29:58 2008
@@ -178,7 +178,7 @@
 }
 
 /*! function to open the asr interface */
-static switch_status_t lumenvox_asr_open(switch_asr_handle_t *ah, char *codec, int rate, char *dest, switch_asr_flag_t *flags)
+static switch_status_t lumenvox_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags)
 {
 
 	lumenvox_t *lv;
@@ -291,7 +291,7 @@
 }
 
 /*! function to load a grammar to the asr interface */
-static switch_status_t lumenvox_asr_load_grammar(switch_asr_handle_t *ah, char *grammar, char *path)
+static switch_status_t lumenvox_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path)
 {
 	lumenvox_t *lv = (lumenvox_t *) ah->private_info;
 
@@ -312,7 +312,7 @@
 
 
 /*! function to unload a grammar to the asr interface */
-static switch_status_t lumenvox_asr_unload_grammar(switch_asr_handle_t *ah, char *grammar)
+static switch_status_t lumenvox_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar)
 {
 	lumenvox_t *lv = (lumenvox_t *) ah->private_info;
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	Mon Aug  4 21:29:58 2008
@@ -241,6 +241,7 @@
 	apr_finfo_t finfo;
 	char *buf1;
 	apr_size_t bytes2read = 0;
+	mrcp_recognizer_header_t *recognizer_header;
 
 	mrcp_message_t *mrcp_message =
 		mrcp_client_context_message_get(context, asr_session->client_session, asr_session->control_channel, RECOGNIZER_RECOGNIZE);
@@ -263,14 +264,25 @@
 	rv = apr_file_read(fp, buf1, &bytes2read);
 	buf1[bytes2read] = '\0';
 
+	recognizer_header = mrcp_resource_header_prepare(mrcp_message);
+
+	if(!recognizer_header) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not prepare resource_header\n");
+		return MRCP_STATUS_FAILURE;
+	}
+	recognizer_header->cancel_if_queue = FALSE;
+	mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CANCEL_IF_QUEUE);
+
 	generic_header = mrcp_generic_header_prepare(mrcp_message);
 	if (!generic_header) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not prepare generic_header\n");
 		return MRCP_STATUS_FAILURE;
 	}
 
-	generic_header->content_type = "application/srgs+xml";
+	generic_header->content_type = " application/srgs+xml";
 	mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE);
+	generic_header->content_id = " <request1 at form-level.store>";
+	mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_ID);
 	mrcp_message->body = buf1;
 
 	/* send the MRCP RECOGNIZE message to MRCP server */
@@ -973,5 +985,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_amr/mod_amr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_amr/mod_amr.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_amr/mod_amr.c	Mon Aug  4 21:29:58 2008
@@ -24,7 +24,7 @@
  * Contributor(s):
  * 
  * Anthony Minessale II <anthmct at yahoo.com>
- * Brian K. West <brian.west at mac.com>
+ * Brian K. West <brian at freeswitch.org>
  *
  * The amr codec itself is not distributed with this module.
  *
@@ -334,5 +334,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g723_1/mod_g723_1.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g723_1/mod_g723_1.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g723_1/mod_g723_1.c	Mon Aug  4 21:29:58 2008
@@ -24,7 +24,7 @@
  * Contributor(s):
  * 
  * Anthony Minessale II <anthmct at yahoo.com>
- * Brian K. West <brian.west at mac.com>
+ * Brian K. West <brian at freeswitch.org>
  *
  * The g723.1 codec itself is not distributed with this module.
  *
@@ -192,5 +192,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g729/mod_g729.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g729/mod_g729.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g729/mod_g729.c	Mon Aug  4 21:29:58 2008
@@ -233,5 +233,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_h26x/mod_h26x.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_h26x/mod_h26x.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_h26x/mod_h26x.c	Mon Aug  4 21:29:58 2008
@@ -114,5 +114,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c	Mon Aug  4 21:29:58 2008
@@ -225,5 +225,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_speex/mod_speex.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_speex/mod_speex.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_speex/mod_speex.c	Mon Aug  4 21:29:58 2008
@@ -298,5 +298,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c	Mon Aug  4 21:29:58 2008
@@ -17,12 +17,12 @@
  * The Original Code is FreeSWITCH Modular Media Switching Software Library / G722 codec module
  *
  * The Initial Developer of the Original Code is
- * Brian K. West <brian.west at mac.com>
+ * Brian K. West <brian at freeswitch.org>
  * Portions created by the Initial Developer are Copyright (C)
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * Brian K. West <brian.west at mac.com>
+ * Brian K. West <brian at freeswitch.org>
  * Anthony Minessale II <anthmct at yahoo.com>
  * Michael Jerris <mike at jerris.com>
  *
@@ -706,5 +706,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c	Mon Aug  4 21:29:58 2008
@@ -82,7 +82,9 @@
 
 SWITCH_STANDARD_APP(avoid_function)
 {
+#if 0
 	void *y = NULL;
+#endif
 	int x = 0;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 
@@ -92,7 +94,9 @@
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "I should never be called!.\n");
+#if 0
 	memset((void *) y, 0, 1000);
+#endif
 }
 
 SWITCH_STANDARD_APP(goto_function)
@@ -391,5 +395,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	Mon Aug  4 21:29:58 2008
@@ -163,5 +163,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	Mon Aug  4 21:29:58 2008
@@ -147,7 +147,7 @@
 			}
 
 			if (field && strchr(expression, '(')) {
-				len = (uint32_t) (strlen(data) + strlen(field_data) + 10);
+				len = (uint32_t) (strlen(data) + strlen(field_data) + 10) * proceed;
 				if (!(substituted = malloc(len))) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
 					proceed = 0;
@@ -299,5 +299,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/directories/mod_ldap/mod_ldap.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/directories/mod_ldap/mod_ldap.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/directories/mod_ldap/mod_ldap.c	Mon Aug  4 21:29:58 2008
@@ -229,5 +229,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Mon Aug  4 21:29:58 2008
@@ -103,6 +103,11 @@
 	int running;
 	int handles;
 	char guess_ip[80];
+	switch_event_node_t *in_node;
+	switch_event_node_t *probe_node;
+	switch_event_node_t *out_node;
+	switch_event_node_t *roster_node;
+
 } globals;
 
 struct mdl_profile {
@@ -1755,22 +1760,22 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.in_node) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.probe_node) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.out_node) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_ROSTER, SWITCH_EVENT_SUBCLASS_ANY, roster_event_handler, NULL)
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_ROSTER, SWITCH_EVENT_SUBCLASS_ANY, roster_event_handler, NULL, &globals.roster_node)
 		!= SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
@@ -1867,6 +1872,16 @@
 			ldl_global_destroy();
 		}
 	}
+
+	switch_event_free_subclass(DL_EVENT_LOGIN_SUCCESS);
+	switch_event_free_subclass(DL_EVENT_LOGIN_FAILURE);
+	switch_event_free_subclass(DL_EVENT_CONNECTED);
+	switch_event_unbind(&globals.in_node);
+	switch_event_unbind(&globals.probe_node);
+	switch_event_unbind(&globals.out_node);
+	switch_event_unbind(&globals.roster_node);
+
+
 	switch_core_hash_destroy(&globals.profile_hash);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -2962,5 +2977,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c	Mon Aug  4 21:29:58 2008
@@ -574,6 +574,7 @@
 {
 	private_t *tech_pvt = switch_core_session_get_private(session);
 	switch_byte_t *data;
+	int ms_count = 0;
 
 	switch_assert(tech_pvt != NULL);
 	tech_pvt->read_frame.flags = SFF_NONE;
@@ -615,6 +616,9 @@
 		}
 
 		switch_yield(1000);
+		if (++ms_count >= 30000) {
+			break;
+		}
 	}
 
 	return SWITCH_STATUS_FALSE;
@@ -1159,5 +1163,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_PortAudio.2008.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_PortAudio.2008.vcproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_PortAudio.2008.vcproj	Mon Aug  4 21:29:58 2008
@@ -56,6 +56,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/NODEFAULTLIB:LIMBCTD"
+				AdditionalDependencies="ksuser.lib"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\portaudio\winvc\Lib&quot;"
 				RandomizedBaseAddress="1"
 				DataExecutionPrevention="0"
@@ -121,6 +122,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\portaudio\winvc\Lib&quot;"
 				RandomizedBaseAddress="1"
 				DataExecutionPrevention="0"

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_PortAudio.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_PortAudio.vcproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_PortAudio.vcproj	Mon Aug  4 21:29:58 2008
@@ -31,6 +31,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/NODEFAULTLIB:LIMBCTD"
+				AdditionalDependencies="ksuser.lib"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\portaudio\winvc\Lib&quot;"
 			/>
 		</Configuration>
@@ -49,6 +50,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\portaudio\winvc\Lib&quot;"
 			/>
 		</Configuration>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c	Mon Aug  4 21:29:58 2008
@@ -107,6 +107,7 @@
 	switch_mutex_t *device_lock;
 	switch_mutex_t *pvt_lock;
 	switch_mutex_t *flag_mutex;
+	switch_mutex_t *pa_mutex;
 	int sample_rate;
 	int codec_ms;
 	PABLIO_Stream *audio_stream;
@@ -121,6 +122,7 @@
 	int ring_interval;
 	GFLAGS flags;
 	switch_timer_t timer;
+	switch_timer_t hold_timer;
 } globals;
 
 
@@ -152,7 +154,7 @@
 static switch_status_t engage_device(int samplerate, int codec_ms);
 static switch_status_t engage_ring_device(int sample_rate, int channels);
 static void deactivate_ring_device(void);
-static int dump_info(void);
+static int dump_info(int verbose);
 static switch_status_t load_config(void);
 static int get_dev_by_name(char *name, int in);
 static int get_dev_by_number(int number, int in);
@@ -315,10 +317,10 @@
 static void deactivate_ring_device(void)
 {
 	switch_mutex_lock(globals.device_lock);
-	if (globals.ring_stream) {
+	if (globals.ringdev != globals.outdev && globals.ring_stream) {
 		CloseAudioStream(globals.ring_stream);
-		globals.ring_stream = NULL;
 	}
+	globals.ring_stream = NULL;
 	switch_mutex_unlock(globals.device_lock);
 }
 
@@ -332,10 +334,12 @@
 	switch_mutex_lock(globals.pvt_lock);
 
 	if (*tech_pvt->call_id == '\0') {
+		switch_mutex_lock(globals.pa_mutex);
 		switch_snprintf(tech_pvt->call_id, sizeof(tech_pvt->call_id), "%d", ++globals.call_id);
 		switch_core_hash_insert(globals.call_hash, tech_pvt->call_id, tech_pvt);
 		switch_core_session_set_read_codec(tech_pvt->session, &globals.read_codec);
 		switch_core_session_set_write_codec(tech_pvt->session, &globals.write_codec);
+		switch_mutex_unlock(globals.pa_mutex);
 	}
 
 	for (tp = globals.call_list; tp; tp = tp->next) {
@@ -394,22 +398,29 @@
 	switch_mutex_unlock(globals.pvt_lock);
 }
 
+static void tech_close_file(private_t *tech_pvt)
+{
+	if (tech_pvt->hfh) {
+		tech_pvt->hfh = NULL;
+		switch_core_file_close(&tech_pvt->fh);
+	}
+}
+
 static switch_status_t channel_on_hangup(switch_core_session_t *session)
 {
 	private_t *tech_pvt = switch_core_session_get_private(session);
 	switch_assert(tech_pvt != NULL);
-
-	remove_pvt(tech_pvt);
+	
+	switch_mutex_lock(globals.pa_mutex);
+	switch_core_hash_delete(globals.call_hash, tech_pvt->call_id);
+	switch_mutex_unlock(globals.pa_mutex);
 
 	switch_clear_flag_locked(tech_pvt, TFLAG_IO);
 	switch_set_flag_locked(tech_pvt, TFLAG_HUP);
 
-	switch_core_hash_delete(globals.call_hash, tech_pvt->call_id);
+	remove_pvt(tech_pvt);
 
-	if (tech_pvt->hfh) {
-		tech_pvt->hfh = NULL;
-		switch_core_file_close(&tech_pvt->fh);
-	}
+	tech_close_file(tech_pvt);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session)));
 
@@ -466,19 +477,21 @@
 	switch_assert(tech_pvt != NULL);
 
 	if (!globals.audio_stream) {
-		return SWITCH_STATUS_FALSE;
+		goto normal_return;
 	}
 
 	if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
-		return SWITCH_STATUS_FALSE;
+		goto normal_return;
 	}
 
 	if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
-		goto cng;
+		goto cng_wait;
 	}
-
+	
 	if (!is_master(tech_pvt)) {
 		if (tech_pvt->hold_file) {
+			switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
+			
 			if (!tech_pvt->hfh) {
 				int sample_rate = tech_pvt->sample_rate ? tech_pvt->sample_rate : globals.sample_rate;
 				if (switch_core_file_open(&tech_pvt->fh,
@@ -487,7 +500,7 @@
 										  globals.read_codec.implementation->actual_samples_per_second,
 										  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 					tech_pvt->hold_file = NULL;
-					goto cng;
+					goto cng_wait;
 				}
 
 				tech_pvt->hfh = &tech_pvt->fh;
@@ -497,46 +510,39 @@
 				tech_pvt->hold_frame.codec = &globals.write_codec;
 			}
 
-			goto hold;
-		}
-	  cng:
-		switch_yield(globals.read_codec.implementation->microseconds_per_frame);
-		*frame = &globals.cng_frame;
-		return SWITCH_STATUS_SUCCESS;
-
-	  hold:
-		{
-			switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
-			if (switch_core_timer_next(&globals.timer) != SWITCH_STATUS_SUCCESS) {
+			if (switch_core_timer_next(&globals.hold_timer) != SWITCH_STATUS_SUCCESS) {
 				switch_core_file_close(&tech_pvt->fh);
-				goto cng;
+				goto cng_nowait;
 			}
 			switch_core_file_read(tech_pvt->hfh, tech_pvt->hold_frame.data, &olen);
 
 			if (olen == 0) {
 				unsigned int pos = 0;
 				switch_core_file_seek(tech_pvt->hfh, &pos, 0, SEEK_SET);
-				goto cng;
+				goto cng_nowait;
 			}
 
 			tech_pvt->hold_frame.datalen = (uint32_t) (olen * sizeof(int16_t));
 			tech_pvt->hold_frame.samples = (uint32_t) olen;
 			*frame = &tech_pvt->hold_frame;
 
+			status = SWITCH_STATUS_SUCCESS;
+			goto normal_return;
 		}
 
-		return SWITCH_STATUS_SUCCESS;
+		goto cng_wait;
 	}
 
+	if (tech_pvt->hfh) {
+		tech_close_file(tech_pvt);
+	}
+	
 	switch_mutex_lock(globals.device_lock);
-
-  get_samples:
-
-	if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
-								   globals.read_codec.implementation->samples_per_frame, &globals.timer)) == 0) {
-		switch_yield(1000);
-		goto get_samples;
-	} else {
+	samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
+							  globals.read_codec.implementation->samples_per_frame, &globals.timer);
+	switch_mutex_unlock(globals.device_lock);
+	
+	if (samples) {
 		globals.read_frame.datalen = samples * 2;
 		globals.read_frame.samples = samples;
 
@@ -546,12 +552,23 @@
 		if (!switch_test_flag((&globals), GFLAG_MOUTH)) {
 			memset(globals.read_frame.data, 255, globals.read_frame.datalen);
 		}
-
 		status = SWITCH_STATUS_SUCCESS;
+	} else {
+		goto cng_nowait;
 	}
-	switch_mutex_unlock(globals.device_lock);
-
+	
+ normal_return:
 	return status;
+
+ cng_nowait:
+	*frame = &globals.cng_frame;
+	return SWITCH_STATUS_SUCCESS;
+
+ cng_wait:
+	switch_core_timer_next(&globals.hold_timer);
+	*frame = &globals.cng_frame;
+	return SWITCH_STATUS_SUCCESS;
+	
 }
 
 static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
@@ -690,11 +707,13 @@
 
 	Pa_Initialize();
 
-	if (dump_info()) {
+	if (dump_info(0)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't find any audio devices!\n");
 		return SWITCH_STATUS_TERM;
 	}
 
+	memset(&globals, 0, sizeof(globals));
+
 	if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
 		return status;
 	}
@@ -708,6 +727,7 @@
 	switch_mutex_init(&globals.device_lock, SWITCH_MUTEX_NESTED, module_pool);
 	switch_mutex_init(&globals.pvt_lock, SWITCH_MUTEX_NESTED, module_pool);
 	switch_mutex_init(&globals.flag_mutex, SWITCH_MUTEX_NESTED, module_pool);
+	switch_mutex_init(&globals.pa_mutex, SWITCH_MUTEX_NESTED, module_pool);
 
 	if (switch_event_reserve_subclass(MY_EVENT_RINGING) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");
@@ -729,7 +749,19 @@
 	portaudio_endpoint_interface->state_handler = &portaudio_event_handlers;
 
 	SWITCH_ADD_API(api_interface, "pa", "PortAudio", pa_cmd, "<command> [<args>]");
-
+	switch_console_set_complete("add pa help");
+	switch_console_set_complete("add pa dump");
+	switch_console_set_complete("add pa call");
+	switch_console_set_complete("add pa answer");
+	switch_console_set_complete("add pa hangup");
+	switch_console_set_complete("add pa list");
+	switch_console_set_complete("add pa switch");
+	switch_console_set_complete("add pa dtmf");
+	switch_console_set_complete("add pa flags");
+	switch_console_set_complete("add pa devlist");
+	switch_console_set_complete("add pa indev");
+	switch_console_set_complete("add pa outdev");
+	switch_console_set_complete("add pa ringdev");
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -746,7 +778,6 @@
 		return SWITCH_STATUS_TERM;
 	}
 
-	memset(&globals, 0, sizeof(globals));
 	globals.indev = globals.outdev = globals.ringdev = -1;
 
 	if ((settings = switch_xml_child(cfg, "settings"))) {
@@ -865,6 +896,7 @@
 	}
 
 	switch_core_timer_destroy(&globals.timer);
+	switch_core_timer_destroy(&globals.hold_timer);
 	Pa_Terminate();
 	switch_core_hash_destroy(&globals.call_hash);
 
@@ -975,7 +1007,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static int dump_info(void)
+static int dump_info(int verbose)
 {
 	int i, numDevices, defaultDisplayed;
 	const PaDeviceInfo *deviceInfo;
@@ -990,6 +1022,14 @@
 		return 0;
 	}
 
+	if (verbose < 0) {
+		Pa_Terminate();
+		Pa_Initialize();
+		load_config();
+		verbose = 0;
+	}
+
+
 	numDevices = Pa_GetDeviceCount();
 	if (numDevices < 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
@@ -998,6 +1038,11 @@
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Number of devices = %d\n", numDevices);
+
+	if (!verbose) {
+		return 0;
+	}
+
 	for (i = 0; i < numDevices; i++) {
 		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "%s", line);
 		deviceInfo = Pa_GetDeviceInfo(i);
@@ -1070,7 +1115,7 @@
 			PrintSupportedStandardSampleRates(&inputParameters, &outputParameters);
 		}
 	}
-
+	
 	switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "%s", line);
 
 	return 0;
@@ -1122,6 +1167,16 @@
 			return SWITCH_STATUS_FALSE;
 		}
 
+		if (switch_core_timer_init(&globals.hold_timer,
+									   globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_frame,
+								   module_pool) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup hold timer failed!\n");
+			switch_core_codec_destroy(&globals.read_codec);
+			switch_core_codec_destroy(&globals.write_codec);
+			switch_core_timer_destroy(&globals.timer);
+			return SWITCH_STATUS_FALSE;
+		}
+
 		globals.read_frame.rate = sample_rate;
 		globals.read_frame.codec = &globals.read_codec;
 
@@ -1157,28 +1212,33 @@
 
 static switch_status_t engage_ring_device(int sample_rate, int channels)
 {
-	PaStreamParameters outputParameters;
+	PaStreamParameters outputParameters = {0};
 	PaError err;
 
 	if (!globals.ring_stream) {
-		if (!sample_rate) {
-			sample_rate = globals.sample_rate;
-		}
+		if (globals.ringdev == globals.outdev) {
+			globals.ring_stream = globals.audio_stream;
+		} else {
+			if (!sample_rate) {
+				sample_rate = globals.sample_rate;
+			}
 
-		switch_mutex_lock(globals.device_lock);
-		/* LOCKED ************************************************************************************************** */
-		outputParameters.device = globals.ringdev;
-		outputParameters.channelCount = channels;
-		outputParameters.sampleFormat = SAMPLE_TYPE;
-		outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
-		outputParameters.hostApiSpecificStreamInfo = NULL;
-		err = OpenAudioStream(&globals.ring_stream, NULL, &outputParameters, sample_rate, paClipOff, globals.read_codec.implementation->samples_per_frame);
-		/* UNLOCKED ************************************************************************************************* */
-		switch_mutex_unlock(globals.device_lock);
+			switch_mutex_lock(globals.device_lock);
+			/* LOCKED ************************************************************************************************** */
+			outputParameters.device = globals.ringdev;
+			outputParameters.channelCount = channels;
+			outputParameters.sampleFormat = SAMPLE_TYPE;
+			outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
+			outputParameters.hostApiSpecificStreamInfo = NULL;
+			err = OpenAudioStream(&globals.ring_stream, NULL, &outputParameters, sample_rate, paClipOff, globals.read_codec.implementation->samples_per_frame);
 
-		if (err != paNoError) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open ring device!\n");
-			return SWITCH_STATUS_FALSE;
+			/* UNLOCKED ************************************************************************************************* */
+			switch_mutex_unlock(globals.device_lock);
+
+			if (err != paNoError) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open ring device!\n");
+				return SWITCH_STATUS_FALSE;
+			}
 		}
 	}
 
@@ -1525,6 +1585,7 @@
 		"--------------------------------------------------------------------------------\n"
 		"pa help\n"
 		"pa dump\n"
+		"pa rescan\n"
 		"pa call <dest> [<dialplan> <cid_name> <cid_num> <rate>]\n"
 		"pa answer [<call_id>]\n"
 		"pa hangup [<call_id>]\n"
@@ -1537,6 +1598,7 @@
 		"pa outdev #<num>|<partial name>\n"
 		"pa ringdev #<num>|<partial name>\n" "--------------------------------------------------------------------------------\n";
 
+
 	if (stream->param_event) {
 		http = switch_event_get_header(stream->param_event, "http-host");
 	}
@@ -1602,8 +1664,12 @@
 		goto done;
 	} else if (!strcasecmp(argv[0], "devlist")) {
 		func = devlist;
+	} else if (!strcasecmp(argv[0], "rescan")) {
+		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Looking for new devices.\n");
+		dump_info(-1);
+		goto done;
 	} else if (!strcasecmp(argv[0], "dump")) {
-		dump_info();
+		dump_info(1);
 		goto done;
 	} else if (!strcasecmp(argv[0], "list")) {
 		func = list_calls;
@@ -1653,7 +1719,11 @@
 		if (http) {
 			stream->write_function(stream, "<pre>");
 		}
+
+		switch_mutex_lock(globals.pa_mutex);
 		status = func(&argv[lead], argc - lead, stream);
+		switch_mutex_unlock(globals.pa_mutex);
+
 		if (http) {
 			stream->write_function(stream, "\n\n</pre>");
 		}
@@ -1713,5 +1783,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/pablio.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/pablio.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/pablio.c	Mon Aug  4 21:29:58 2008
@@ -149,7 +149,7 @@
 
 	for (;;) {
 		avail = PaUtil_GetRingBufferReadAvailable(&aStream->inFIFO);
-
+		
 		if (switch_core_timer_check(timer, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
 			break;
 		}

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c	Mon Aug  4 21:29:58 2008
@@ -224,8 +224,8 @@
 	int sip_cause = hangup_cause_to_sip(cause);
 	const char *ps_cause = switch_channel_get_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE);
 
-	if (!switch_strlen_zero(ps_cause) && !strncasecmp(ps_cause, "sip:", 4)) {
-		int new_cause = atoi(ps_cause + 4);
+	if (!switch_strlen_zero(ps_cause) && (!strncasecmp(ps_cause, "sip:", 4) || !strncasecmp(ps_cause, "sips:", 5))) {
+		int new_cause = atoi(sofia_glue_strip_proto(ps_cause));
 		if (new_cause) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n",
 							  switch_channel_get_name(channel), sip_cause, new_cause);
@@ -284,7 +284,29 @@
 
 	if (tech_pvt->nh && !switch_test_flag(tech_pvt, TFLAG_BYE)) {
 		char reason[128] = "";
-		if (cause > 1 && cause < 128) {
+		switch_stream_handle_t stream = { 0 };
+		switch_event_header_t *hi;
+		char *bye_headers = NULL;
+
+		SWITCH_STANDARD_STREAM(stream);
+		if ((hi = switch_channel_variable_first(channel))) {
+			for (; hi; hi = hi->next) {
+				const char *name = (char *) hi->name;
+				char *value = (char *) hi->value;
+				
+				if (!strncasecmp(name, SOFIA_SIP_BYE_HEADER_PREFIX, strlen(SOFIA_SIP_BYE_HEADER_PREFIX))) {
+					const char *hname = name + strlen(SOFIA_SIP_BYE_HEADER_PREFIX);
+					stream.write_function(&stream, "%s: %s\r\n", hname, value);
+				}
+			}
+			switch_channel_variable_last(channel);
+		}
+
+		if (stream.data) {
+			bye_headers = stream.data;
+		}
+		
+		if (cause > 0 && cause < 128) {
 			switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
 		} else if (cause == SWITCH_CAUSE_PICKED_OFF) {
 			switch_snprintf(reason, sizeof(reason), "SIP;cause=200;text=\"Call completed elsewhere\"");
@@ -294,17 +316,28 @@
 
 		if (switch_test_flag(tech_pvt, TFLAG_ANS)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
-			nua_bye(tech_pvt->nh, SIPTAG_REASON_STR(reason), TAG_END());
+			nua_bye(tech_pvt->nh, 
+					SIPTAG_REASON_STR(reason),
+					TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+					TAG_END());
 		} else {
 			if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel));
-				nua_cancel(tech_pvt->nh, SIPTAG_REASON_STR(reason), TAG_END());
+				nua_cancel(tech_pvt->nh, 
+						   SIPTAG_REASON_STR(reason), 
+						   TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+						   TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+						   TAG_END());
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause);
-				nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause), SIPTAG_REASON_STR(reason), TAG_END());
+				nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause), 
+							SIPTAG_REASON_STR(reason), 
+							TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+							TAG_END());
 			}
 		}
 		switch_set_flag(tech_pvt, TFLAG_BYE);
+		switch_safe_free(stream.data);
 	}
 
 	switch_clear_flag(tech_pvt, TFLAG_IO);
@@ -926,7 +959,8 @@
 			char ref_to[128] = "";
 
 			if (!strstr(msg->string_arg, "sip:")) {
-				switch_snprintf(ref_to, sizeof(ref_to), "sip:%s@%s", msg->string_arg, tech_pvt->profile->sipip);
+				const char *format = strchr(tech_pvt->profile->sipip, ':') ? "sip:%s@[%s]" : "sip:%s@%s";
+				switch_snprintf(ref_to, sizeof(ref_to), format, msg->string_arg, tech_pvt->profile->sipip);
 			} else {
 				switch_set_string(ref_to, msg->string_arg);
 			}
@@ -988,7 +1022,7 @@
 				}
 
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Overlap Dial with %d %s\n", code, reason);
-				nua_respond(tech_pvt->nh, code, reason, TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)),
+				nua_respond(tech_pvt->nh, code, su_strdup(tech_pvt->nh->nh_home, reason), TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)),
 							SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL),
 							TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END());
 				if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
@@ -1003,12 +1037,12 @@
 						sofia_glue_tech_patch_sdp(tech_pvt);
 						sofia_glue_tech_proxy_remote_addr(tech_pvt);
 					}
-					nua_respond(tech_pvt->nh, code, reason, SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+					nua_respond(tech_pvt->nh, code, su_strdup(tech_pvt->nh->nh_home, reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
 								SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
 								SOATAG_REUSE_REJECTED(1),
 								SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
 				} else {
-					nua_respond(tech_pvt->nh, code, reason, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
+					nua_respond(tech_pvt->nh, code, su_strdup(tech_pvt->nh->nh_home, reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
 				}
 				if (!switch_channel_test_flag(channel, CF_ANSWERED) && code >= 300) {
 					switch_set_flag_locked(tech_pvt, TFLAG_BYE);
@@ -1200,22 +1234,22 @@
 				switch_assert(gp->state < REG_STATE_LAST);
 
 				stream->write_function(stream, "%s\n", line);
-				stream->write_function(stream, "Name    \t%s\n", switch_str_nil(gp->name));
-				stream->write_function(stream, "Scheme  \t%s\n", switch_str_nil(gp->register_scheme));
-				stream->write_function(stream, "Realm   \t%s\n", switch_str_nil(gp->register_realm));
-				stream->write_function(stream, "Username\t%s\n", switch_str_nil(gp->register_username));
-				stream->write_function(stream, "Password\t%s\n", switch_strlen_zero(gp->register_password) ? "no" : "yes");
-				stream->write_function(stream, "From    \t%s\n", switch_str_nil(gp->register_from));
-				stream->write_function(stream, "Contact \t%s\n", switch_str_nil(gp->register_contact));
-				stream->write_function(stream, "To      \t%s\n", switch_str_nil(gp->register_to));
-				stream->write_function(stream, "Proxy   \t%s\n", switch_str_nil(gp->register_proxy));
-				stream->write_function(stream, "Context \t%s\n", switch_str_nil(gp->register_context));
-				stream->write_function(stream, "Expires \t%s\n", switch_str_nil(gp->expires_str));
-				stream->write_function(stream, "Freq    \t%d\n", gp->freq);
-				stream->write_function(stream, "Ping    \t%d\n", gp->ping);
-				stream->write_function(stream, "PingFreq\t%d\n", gp->ping_freq);
-				stream->write_function(stream, "State   \t%s\n", sofia_state_names[gp->state]);
-				stream->write_function(stream, "Status  \t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : "");
+				stream->write_function(stream, "Name    \t\t%s\n", switch_str_nil(gp->name));
+				stream->write_function(stream, "Scheme  \t\t%s\n", switch_str_nil(gp->register_scheme));
+				stream->write_function(stream, "Realm   \t\t%s\n", switch_str_nil(gp->register_realm));
+				stream->write_function(stream, "Username\t\t%s\n", switch_str_nil(gp->register_username));
+				stream->write_function(stream, "Password\t\t%s\n", switch_strlen_zero(gp->register_password) ? "no" : "yes");
+				stream->write_function(stream, "From    \t\t%s\n", switch_str_nil(gp->register_from));
+				stream->write_function(stream, "Contact \t\t%s\n", switch_str_nil(gp->register_contact));
+				stream->write_function(stream, "To      \t\t%s\n", switch_str_nil(gp->register_to));
+				stream->write_function(stream, "Proxy   \t\t%s\n", switch_str_nil(gp->register_proxy));
+				stream->write_function(stream, "Context \t\t%s\n", switch_str_nil(gp->register_context));
+				stream->write_function(stream, "Expires \t\t%s\n", switch_str_nil(gp->expires_str));
+				stream->write_function(stream, "Freq    \t\t%d\n", gp->freq);
+				stream->write_function(stream, "Ping    \t\t%d\n", gp->ping);
+				stream->write_function(stream, "PingFreq\t\t%d\n", gp->ping_freq);
+				stream->write_function(stream, "State   \t\t%s\n", sofia_state_names[gp->state]);
+				stream->write_function(stream, "Status  \t\t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : "");
 				stream->write_function(stream, "%s\n", line);
 				sofia_reg_release_gateway(gp);
 			} else {
@@ -1224,36 +1258,50 @@
 		} else if (!strcasecmp(argv[0], "profile")) {
 			struct cb_helper cb;
 
-			if ((profile = sofia_glue_find_profile(argv[1]))) {
+			if ((argv[1]) && (profile = sofia_glue_find_profile(argv[1]))) {
 				stream->write_function(stream, "%s\n", line);
-				stream->write_function(stream, "Name       \t%s\n", switch_str_nil(argv[1]));
-				stream->write_function(stream, "Domain Name\t%s\n", switch_str_nil(profile->domain_name));
+				stream->write_function(stream, "Name          \t\t%s\n", switch_str_nil(argv[1]));
+				stream->write_function(stream, "Domain Name   \t\t%s\n", switch_str_nil(profile->domain_name));
 				if (strcasecmp(argv[1], profile->name)) {
-					stream->write_function(stream, "Alias Of   \t%s\n", switch_str_nil(profile->name));
+					stream->write_function(stream, "Alias Of      \t\t%s\n", switch_str_nil(profile->name));
 				}
-				stream->write_function(stream, "DBName     \t%s\n", switch_str_nil(profile->dbname));
-				stream->write_function(stream, "Dialplan   \t%s\n", switch_str_nil(profile->dialplan));
-				stream->write_function(stream, "RTP-IP     \t%s\n", switch_str_nil(profile->rtpip));
+				stream->write_function(stream, "DBName        \t\t%s\n", switch_str_nil(profile->dbname));
+				stream->write_function(stream, "Dialplan      \t\t%s\n", switch_str_nil(profile->dialplan));
+				stream->write_function(stream, "Context       \t\t%s\n", switch_str_nil(profile->context));
+				stream->write_function(stream, "RTP-IP        \t\t%s\n", switch_str_nil(profile->rtpip));
 				if (profile->extrtpip) {
-					stream->write_function(stream, "Ext-RTP-IP \t%s\n", profile->extrtpip);
+					stream->write_function(stream, "Ext-RTP-IP    \t\t%s\n", profile->extrtpip);
 				}
 
-				stream->write_function(stream, "SIP-IP     \t%s\n", switch_str_nil(profile->sipip));
+				stream->write_function(stream, "SIP-IP        \t\t%s\n", switch_str_nil(profile->sipip));
 				if (profile->extsipip) {
-					stream->write_function(stream, "Ext-SIP-IP \t%s\n", profile->extsipip);
+					stream->write_function(stream, "Ext-SIP-IP    \t\t%s\n", profile->extsipip);
 				}
-				stream->write_function(stream, "URL        \t%s\n", switch_str_nil(profile->url));
-				stream->write_function(stream, "BIND-URL   \t%s\n", switch_str_nil(profile->bindurl));
+				stream->write_function(stream, "URL           \t\t%s\n", switch_str_nil(profile->url));
+				stream->write_function(stream, "BIND-URL      \t\t%s\n", switch_str_nil(profile->bindurl));
 				if (sofia_test_pflag(profile, PFLAG_TLS)) {
-					stream->write_function(stream, "TLS-URL   \t%s\n", switch_str_nil(profile->tls_url));
-					stream->write_function(stream, "TLS-BIND-URL   \t%s\n", switch_str_nil(profile->tls_bindurl));
+					stream->write_function(stream, "TLS-URL      \t\t%s\n", switch_str_nil(profile->tls_url));
+					stream->write_function(stream, "TLS-BIND-URL      \t%s\n", switch_str_nil(profile->tls_bindurl));
 				}
-				stream->write_function(stream, "HOLD-MUSIC \t%s\n", switch_str_nil(profile->hold_music));
-				stream->write_function(stream, "CODECS     \t%s\n", switch_str_nil(profile->codec_string));
-				stream->write_function(stream, "TEL-EVENT  \t%d\n", profile->te);
-				stream->write_function(stream, "CNG        \t%d\n", profile->cng_pt);
-				stream->write_function(stream, "SESSION-TO \t%d\n", profile->session_timeout);
-				stream->write_function(stream, "MAX-DIALOG \t%d\n", profile->max_proceeding);
+				stream->write_function(stream, "HOLD-MUSIC    \t\t%s\n", switch_strlen_zero(profile->hold_music) ? "NONE" : profile->hold_music);
+				stream->write_function(stream, "CODECS        \t\t%s\n", switch_str_nil(profile->codec_string));
+				stream->write_function(stream, "TEL-EVENT     \t\t%d\n", profile->te);
+				if (profile->dtmf_type == DTMF_2833) {
+					stream->write_function(stream, "DTMF-MODE     \t\trfc2833\n");
+				} else if (profile->dtmf_type == DTMF_INFO) {
+					stream->write_function(stream, "DTMF-MODE     \t\tinfo\n");
+				} else {
+					stream->write_function(stream, "DTMF-MODE     \t\tnone\n");
+				}
+				stream->write_function(stream, "CNG           \t\t%d\n", profile->cng_pt);
+				stream->write_function(stream, "SESSION-TO    \t\t%d\n", profile->session_timeout);
+				stream->write_function(stream, "MAX-DIALOG    \t\t%d\n", profile->max_proceeding);
+				stream->write_function(stream, "NOMEDIA       \t\t%s\n", switch_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
+				stream->write_function(stream, "LATE-NEG      \t\t%s\n", switch_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
+				stream->write_function(stream, "PROXY-MEDIA   \t\t%s\n", switch_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
+				stream->write_function(stream, "AGGRESSIVENAT \t\t%s\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
+				stream->write_function(stream, "STUN_ENABLED \t\t%s\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
+				stream->write_function(stream, "STUN_AUTO_DISABLE \t%s\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
 				stream->write_function(stream, "\nRegistrations:\n%s\n", line);
 
 				cb.profile = profile;
@@ -1340,18 +1388,102 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 
+	if (argv[1] && !strcasecmp(argv[0], "restart") && !strcasecmp(argv[1], "all")) {
+		sofia_glue_restart_all_profiles();
+		return SWITCH_STATUS_SUCCESS;
+	}
+	
 	if (switch_strlen_zero(profile_name) || !(profile = sofia_glue_find_profile(profile_name))) {
 		stream->write_function(stream, "Invalid Profile [%s]", switch_str_nil(profile_name));
 		return SWITCH_STATUS_SUCCESS;
 	}
 
+	if (!strcasecmp(argv[1], "killgw")) {
+		sofia_gateway_t *gateway_ptr;
+		if (argc < 2) {
+			stream->write_function(stream, "-ERR missing gw name\n");
+			goto done;
+		}
+
+		if ((gateway_ptr = sofia_reg_find_gateway(argv[2]))) { 			
+			sofia_glue_del_gateway(gateway_ptr);
+			sofia_reg_release_gateway(gateway_ptr);
+			stream->write_function(stream, "+OK gateway marked for deletion.\n");
+		} else {
+			stream->write_function(stream, "-ERR no such gateway.\n");
+		}
+
+		goto done;
+	}
+
+	if (!strcasecmp(argv[1], "stun-auto-disable")) {
+		if (argv[2]) {
+			int is_true = switch_true(argv[2]);
+			if (is_true) {
+				profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+			} else {
+				profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE;
+			}
+		}
+
+		stream->write_function(stream, "+OK stun-auto-disable=%s", (profile->pflags & PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
+		
+		goto done;
+	}
+
+	if (!strcasecmp(argv[1], "stun-enabled")) {
+		if (argv[2]) {
+			int is_true = switch_true(argv[2]);
+			if (is_true) {
+				profile->pflags |= PFLAG_STUN_ENABLED;
+			} else {
+				profile->pflags &= ~PFLAG_STUN_ENABLED;
+			}
+		}
+
+		stream->write_function(stream, "+OK stun-enabled=%s", (profile->pflags & PFLAG_STUN_ENABLED) ? "true" : "false");
+		
+		goto done;
+	}
+
+
+	if (!strcasecmp(argv[1], "rescan")) {
+
+		if (argc > 2 && !strcasecmp(argv[2], "reloadxml")) {
+			if ((xml_root = switch_xml_open_root(1, &err))) {
+				switch_xml_free(xml_root);
+			}
+			stream->write_function(stream, "Reload XML [%s]\n", err);
+		}
+			
+		if (reconfig_sofia(profile) == SWITCH_STATUS_SUCCESS) {
+			stream->write_function(stream, "+OK scan complete\n");
+		} else {
+			stream->write_function(stream, "-ERR cannot find config for profile %s\n", profile->name);
+		}
+		goto done;
+	}
+
 	if (!strcasecmp(argv[1], "flush_inbound_reg")) {
+		int reboot = 0;
+
 		if (argc > 2) {
-			sofia_reg_expire_call_id(profile, argv[2]);
-			stream->write_function(stream, "+OK flushing all registrations matching specified call_id\n");
+			if (!strcasecmp(argv[2], "reboot")) {
+				reboot = 1;
+				argc = 2;
+			}
+		}
+
+		if (argc > 2) {
+			if (argc > 3 && !strcasecmp(argv[3], "reboot")) {
+				reboot = 1;
+			}
+
+			sofia_reg_expire_call_id(profile, argv[2], reboot);
+			stream->write_function(stream, "+OK %s all registrations matching specified call_id\n", reboot ? "rebooting" : "flushing");
 		} else {
-			sofia_reg_check_expire(profile, 0);
-			stream->write_function(stream, "+OK flushing all registrations\n");
+			sofia_reg_check_expire(profile, 0, reboot);
+			stream->write_function(stream, "+OK %s all registrations\n", reboot ? "rebooting" : "flushing");
 		}
 
 		goto done;
@@ -1453,8 +1585,8 @@
 	struct cb_helper *cb = (struct cb_helper *) pArg;
 	char *contact;
 
-	if (!switch_strlen_zero(argv[0]) && (contact = sofia_glue_get_url_from_contact(argv[0], 1))) {
-		cb->stream->write_function(cb->stream, "sofia/%s/%s,", cb->profile->name, contact + 4);
+	if (!switch_strlen_zero(argv[0]) && (contact = sofia_glue_get_url_from_contact(argv[0], 1)) ) {
+		cb->stream->write_function(cb->stream, "%ssofia/%s/%s,", argv[1], cb->profile->name, sofia_glue_strip_proto(contact));
 		free(contact);
 	}
 
@@ -1466,6 +1598,7 @@
 	char *data;
 	char *user = NULL;
 	char *domain = NULL;
+	char *concat = NULL;
 	char *profile_name = NULL;
 	char *p;
 	sofia_profile_t *profile = NULL;
@@ -1496,6 +1629,14 @@
 
 	if ((domain = strchr(user, '@'))) {
 		*domain++ = '\0';
+		if ( (concat = strchr( domain, '/')) ) {
+		    *concat++ = '\0';
+		}
+	}
+	else {
+		if ( (concat = strchr( user, '/')) ) {
+		    *concat++ = '\0';
+		}
 	}
 
 	if (!profile_name && domain) {
@@ -1528,10 +1669,11 @@
 			cb.stream = &mystream;
 
 			if (exclude_contact) {
-				sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q' and contact not like '%%%s%%'",
-									 user, domain, exclude_contact);
+				sql = switch_mprintf("select contact, '%q' from sip_registrations where sip_user='%q' and sip_host='%q' and contact not like '%%%s%%'",
+									 ( concat != NULL ) ? concat : "", user, domain, exclude_contact);
 			} else {
-				sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q'", user, domain);
+				sql = switch_mprintf("select contact, '%q' from sip_registrations where sip_user='%q' and sip_host='%q'", 
+									 ( concat != NULL ) ? concat : "", user, domain);
 			}
 
 			switch_assert(sql);
@@ -1571,7 +1713,7 @@
 	const char *usage_string = "USAGE:\n"
 		"--------------------------------------------------------------------------------\n"
 		"sofia help\n"
-		"sofia profile <profile_name> [start|stop|restart|flush_inbound_reg [<call_id>]|[register|unregister] [<gateway name>|all]] [reloadxml]\n"
+		"sofia profile <profile_name> [start|stop|restart|rescan|flush_inbound_reg [<call_id>]|[register|unregister|killgw] [<gateway name>|all]] [reloadxml]\n"
 		"sofia status [[profile | gateway] <name>]\n"
 		"sofia loglevel [0-9]\n" "--------------------------------------------------------------------------------\n";
 
@@ -1763,7 +1905,7 @@
 		}
 
 		if (!strchr(dest, '@')) {
-			tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s@%s", dest, gateway_ptr->register_proxy + 4);
+			tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s@%s", dest, sofia_glue_strip_proto(gateway_ptr->register_proxy));
 		} else {
 			tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s", dest);
 		}
@@ -1913,6 +2055,132 @@
 	return cause;
 }
 
+static void general_event_handler(switch_event_t *event)
+{
+	switch (event->event_id) {
+	case SWITCH_EVENT_NOTIFY:
+		{
+			const char *profile_name = switch_event_get_header(event, "profile");
+			const char *ct = switch_event_get_header(event, "content-type");
+			const char *es = switch_event_get_header(event, "event-string");
+			const char *user = switch_event_get_header(event, "user");
+			const char *host = switch_event_get_header(event, "host");
+			const char *body = switch_event_get_body(event);
+			sofia_profile_t *profile;
+			nua_handle_t *nh;
+
+			if (profile_name && ct && es && body && user && host && (profile = sofia_glue_find_profile(profile_name))) {
+				char *id = NULL;
+				char *contact, *p;
+				char buf[512] = "";
+
+				if (!sofia_reg_find_reg_url(profile, user, host, buf, sizeof(buf))) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find user %s@%s\n", user, host);
+					return;
+				}
+
+				id = switch_mprintf("sip:%s@%s", user, host);
+
+				switch_assert(id);
+				contact = sofia_glue_get_url_from_contact(buf, 0);
+				
+				if ((p = strstr(contact, ";fs_"))) {
+					*p = '\0';
+				}
+
+				nh = nua_handle(profile->nua, 
+								NULL, 
+								NUTAG_URL(contact), 
+								SIPTAG_FROM_STR(id), 
+								SIPTAG_TO_STR(id), 
+								SIPTAG_CONTACT_STR(profile->url), 
+								TAG_END());
+				
+				nua_notify(nh,
+						   NUTAG_NEWSUB(1),
+						   SIPTAG_EVENT_STR(es), 
+						   SIPTAG_CONTENT_TYPE_STR(ct), 
+						   SIPTAG_PAYLOAD_STR(body), 
+						   TAG_END());
+
+				
+				free(id);
+				sofia_glue_release_profile(profile);
+			}
+
+		}
+		break;
+	case SWITCH_EVENT_SEND_MESSAGE:
+		{
+			const char *profile_name = switch_event_get_header(event, "profile");
+			const char *ct = switch_event_get_header(event, "content-type");
+			const char *user = switch_event_get_header(event, "user");
+			const char *host = switch_event_get_header(event, "host");
+			const char *body = switch_event_get_body(event);
+			sofia_profile_t *profile;
+			nua_handle_t *nh;
+
+			if (profile_name && ct && body && user && host) {
+				char *id = NULL;
+				char *contact, *p;
+				char buf[512] = "";
+
+				if (!(profile = sofia_glue_find_profile(profile_name))) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find profile %s\n", profile_name);
+					return;
+				}
+
+
+				if (!sofia_reg_find_reg_url(profile, user, host, buf, sizeof(buf))) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find user %s@%s\n", user, host);
+					return;
+				}
+
+				id = switch_mprintf("sip:%s@%s", user, host);
+
+				switch_assert(id);
+				contact = sofia_glue_get_url_from_contact(buf, 0);
+
+				if ((p = strstr(contact, ";fs_"))) {
+					*p = '\0';
+				}
+				
+				nh = nua_handle(profile->nua, 
+								NULL, 
+								NUTAG_URL(contact), 
+								SIPTAG_FROM_STR(id), 
+								SIPTAG_TO_STR(id), 
+								SIPTAG_CONTACT_STR(profile->url), 
+								TAG_END());
+				
+				nua_message(nh,
+							NUTAG_NEWSUB(1),
+ 							SIPTAG_CONTENT_TYPE_STR(ct), 
+							SIPTAG_PAYLOAD_STR(body), 
+							TAG_END());
+
+				
+				free(id);
+				sofia_glue_release_profile(profile);
+			}
+
+		}
+		break;
+	case SWITCH_EVENT_TRAP:
+		{
+			const char *cond = switch_event_get_header(event, "condition");
+
+			if (cond && !strcmp(cond, "network-address-change")) {
+				sofia_glue_restart_all_profiles();
+			}
+			
+		}
+		break;
+	default:
+		break;
+	}
+}
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
 {
 	switch_chat_interface_t *chat_interface;
@@ -1950,37 +2218,53 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for profiles to start\n");
 	switch_yield(1500000);
 
-	if (switch_event_bind(modname, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT, event_handler, NULL,
+									&mod_sofia_globals.custom_node) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_TERM;
 	}
 
-	if (switch_event_bind(modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
-		!= SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL,
+									&mod_sofia_globals.in_node) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL,
+									&mod_sofia_globals.out_node) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL,
+									&mod_sofia_globals.probe_node) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_ROSTER, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL,
+									&mod_sofia_globals.roster_node) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind(modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
-		!= SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_WAITING, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_mwi_event_handler, NULL,
+									&mod_sofia_globals.mwi_node) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
-		!= SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, general_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind(modname, SWITCH_EVENT_ROSTER, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
-		!= SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind(modname, SWITCH_EVENT_NOTIFY, SWITCH_EVENT_SUBCLASS_ANY, general_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind(modname, SWITCH_EVENT_MESSAGE_WAITING, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_mwi_event_handler, NULL)
-		!= SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind(modname, SWITCH_EVENT_SEND_MESSAGE, SWITCH_EVENT_SUBCLASS_ANY, general_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
@@ -1997,6 +2281,12 @@
 	management_interface->management_function = sofia_manage;
 
 	SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, "<cmd> <args>");
+	switch_console_set_complete("add sofia help");
+	switch_console_set_complete("add sofia status");
+	switch_console_set_complete("add sofia loglevel");
+	switch_console_set_complete("add sofia profile");
+	switch_console_set_complete("add sofia profile restart all");
+
 	SWITCH_ADD_API(api_interface, "sofia_contact", "Sofia Contacts", sofia_contact_function, "[profile/]<user>@<domain>");
 	SWITCH_ADD_CHAT(chat_interface, SOFIA_CHAT_PROTO, sofia_presence_chat_send);
 
@@ -2014,6 +2304,14 @@
 	}
 	switch_mutex_unlock(mod_sofia_globals.mutex);
 
+	switch_event_unbind(&mod_sofia_globals.in_node);
+	switch_event_unbind(&mod_sofia_globals.probe_node);
+	switch_event_unbind(&mod_sofia_globals.out_node);
+	switch_event_unbind(&mod_sofia_globals.roster_node);
+	switch_event_unbind(&mod_sofia_globals.custom_node);
+	switch_event_unbind(&mod_sofia_globals.mwi_node);
+	switch_event_unbind_callback(general_event_handler);
+	
 	while (mod_sofia_globals.threads) {
 		switch_yield(1000);
 		if (++sanity >= 10000) {
@@ -2039,5 +2337,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h	Mon Aug  4 21:29:58 2008
@@ -47,6 +47,11 @@
 #endif
 #define SOFIA_NAT_SESSION_TIMEOUT 20
 #define SOFIA_MAX_ACL 100
+#ifdef _MSC_VER
+#define HAVE_FUNCTION 1
+#else
+#define HAVE_FUNC 1
+#endif
 
 #define MODNAME "mod_sofia"
 static const switch_state_handler_table_t noop_state_handler = { 0 };
@@ -73,6 +78,7 @@
 #define SOFIA_USER_AGENT "FreeSWITCH-mod_sofia/" SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO "-" SWITCH_VERSION_REVISION
 #define SOFIA_CHAT_PROTO "sip"
 #define SOFIA_SIP_HEADER_PREFIX "sip_h_"
+#define SOFIA_SIP_BYE_HEADER_PREFIX "sip_bye_h_"
 #define SOFIA_SIP_HEADER_PREFIX_T "~sip_h_"
 #define SOFIA_DEFAULT_PORT "5060"
 #define SOFIA_DEFAULT_TLS_PORT "5061"
@@ -91,6 +97,7 @@
 #include <sofia-sip/su_log.h>
 #include <sofia-sip/nea.h>
 #include <sofia-sip/msg_addr.h>
+#include "nua_stack.h"
 
 typedef enum {
 	DTMF_2833,
@@ -147,7 +154,13 @@
 	PFLAG_DISABLE_TIMER = (1 << 19),
 	PFLAG_DISABLE_100REL = (1 << 20),
 	PFLAG_AGGRESSIVE_NAT_DETECTION = (1 << 21),
-	PFLAG_RECIEVED_IN_NAT_REG_CONTACT = (1 << 22)
+	PFLAG_RECIEVED_IN_NAT_REG_CONTACT = (1 << 22),
+	PFLAG_3PCC = (1 << 23),
+	PFLAG_DISABLE_RTP_AUTOADJ = (1 << 24),
+	PFLAG_DISABLE_SRTP_AUTH = (1 << 25),
+	PFLAG_FUNNY_STUN = (1 << 26),
+	PFLAG_STUN_ENABLED = (1 << 27),
+	PFLAG_STUN_AUTO_DISABLE = (1 << 28)
 } PFLAGS;
 
 typedef enum {
@@ -156,6 +169,12 @@
 } sofia_NDLB_t;
 
 typedef enum {
+	STUN_FLAG_SET = (1 << 0),
+	STUN_FLAG_PING = (1 << 1),
+	STUN_FLAG_FUNNY = (1 << 2)
+} STUNFLAGS;
+
+typedef enum {
 	TFLAG_IO = (1 << 0),
 	TFLAG_CHANGE_MEDIA = (1 << 1),
 	TFLAG_OUTBOUND = (1 << 2),
@@ -202,6 +221,12 @@
 	switch_queue_t *mwi_queue;
 	struct sofia_private destroy_private;
 	struct sofia_private keep_private;
+	switch_event_node_t *in_node;
+	switch_event_node_t *probe_node;
+	switch_event_node_t *out_node;
+	switch_event_node_t *roster_node;
+	switch_event_node_t *custom_node;
+	switch_event_node_t *mwi_node;
 };
 extern struct mod_sofia_globals mod_sofia_globals;
 
@@ -263,6 +288,7 @@
 	int32_t retry_seconds;
 	reg_state_t state;
 	switch_memory_pool_t *pool;
+	int deleted;
 	struct sofia_gateway *next;
 };
 
@@ -336,7 +362,7 @@
 	uint32_t reg_acl_count;
 	char *nat_acl[SOFIA_MAX_ACL];
 	uint32_t nat_acl_count;
-
+	int rport_level;
 };
 
 struct private_object {
@@ -401,6 +427,10 @@
 	char *local_crypto_key;
 	char *remote_crypto_key;
 	char *record_route;
+	char *extrtpip;
+	char *stun_ip;
+	switch_port_t stun_port;
+	uint32_t stun_flags;
 	int crypto_tag;
 	unsigned char local_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
 	unsigned char remote_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
@@ -547,10 +577,10 @@
 
 void sofia_glue_execute_sql(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic);
 void sofia_glue_actually_execute_sql(sofia_profile_t *profile, switch_bool_t master, char *sql, switch_mutex_t *mutex);
-void sofia_reg_check_expire(sofia_profile_t *profile, time_t now);
+void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot);
 void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now);
 void sofia_reg_unregister(sofia_profile_t *profile);
-switch_status_t sofia_glue_ext_address_lookup(char **ip, switch_port_t *port, char *sourceip, switch_memory_pool_t *pool);
+switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_object_t *tech_pvt, char **ip, switch_port_t *port, char *sourceip, switch_memory_pool_t *pool);
 
 void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp);
 int sofia_glue_get_user_host(char *in, char **user, char **host);
@@ -580,11 +610,11 @@
 void sofia_glue_release_profile__(const char *file, const char *func, int line, sofia_profile_t *profile);
 #define sofia_glue_release_profile(x) sofia_glue_release_profile__(__FILE__, __SWITCH_FUNC__, __LINE__,  x)
 
-sofia_profile_t *sofia_glue_find_profile__(const char *file, const char *func, int line, char *key);
+sofia_profile_t *sofia_glue_find_profile__(const char *file, const char *func, int line, const char *key);
 #define sofia_glue_find_profile(x) sofia_glue_find_profile__(__FILE__, __SWITCH_FUNC__, __LINE__,  x)
 
 switch_status_t sofia_reg_add_gateway(char *key, sofia_gateway_t *gateway);
-sofia_gateway_t *sofia_reg_find_gateway__(const char *file, const char *func, int line, char *key);
+sofia_gateway_t *sofia_reg_find_gateway__(const char *file, const char *func, int line, const char *key);
 #define sofia_reg_find_gateway(x) sofia_reg_find_gateway__(__FILE__, __SWITCH_FUNC__, __LINE__,  x)
 
 void sofia_reg_release_gateway__(const char *file, const char *func, int line, sofia_gateway_t *gateway);
@@ -635,7 +665,11 @@
 void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt);
 switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt);
 void sofia_presence_event_thread_start(void);
-void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id);
+void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int reboot);
 switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt, int force);
 switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force);
-
+const char *sofia_glue_strip_proto(const char *uri);
+switch_status_t reconfig_sofia(sofia_profile_t *profile);
+void sofia_glue_del_gateway(sofia_gateway_t *gp);
+void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent);
+void sofia_glue_restart_all_profiles(void);

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c	Mon Aug  4 21:29:58 2008
@@ -142,13 +142,20 @@
 
 	if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)) {
 		switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
+	} else if (sip->sip_server && !switch_strlen_zero(sip->sip_server->g_string)) {
+		switch_channel_set_variable(channel, "sip_user_agent", sip->sip_server->g_string);
 	}
+
 	if ((tmp = sofia_glue_get_unknown_header(sip, "rtp-txstat"))) {
 		switch_channel_set_variable(channel, "sip_rtp_txstat", tmp);
 	}
 	if ((tmp = sofia_glue_get_unknown_header(sip, "rtp-rxstat"))) {
 		switch_channel_set_variable(channel, "sip_rtp_rxstat", tmp);
 	}
+	if ((tmp = sofia_glue_get_unknown_header(sip, "P-RTP-Stat"))) {
+		switch_channel_set_variable(channel, "sip_p_rtp_stat", tmp);
+	}
+
 	return;
 }
 
@@ -216,7 +223,8 @@
 
 		if (authorization) {
 			char network_ip[80];
-			get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_addr);
+			su_addrinfo_t *addrinfo = msg_addrinfo(nua_current_request(nua));
+			get_addr(network_ip, sizeof(network_ip), addrinfo->ai_addr, addrinfo->ai_addrlen);
 			auth_res = sofia_reg_parse_auth(profile, authorization, sip,
 											(char *) sip->sip_request->rq_method_name, tech_pvt->key, strlen(tech_pvt->key), network_ip, NULL, 0,
 											REG_INVITE, NULL);
@@ -378,6 +386,8 @@
 		char *user_agent = switch_event_get_header(event, "user-agent");
 		long expires = (long) switch_timestamp(NULL);
 		char *profile_name = switch_event_get_header(event, "orig-profile-name");
+		char *to_user = switch_event_get_header(event, "orig-to-user");
+		char *to_host = switch_event_get_header(event, "orig-to-host");
 		sofia_profile_t *profile = NULL;
 
 		if (exp_str) {
@@ -401,8 +411,8 @@
 		switch_mutex_lock(profile->ireg_mutex);
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 
-		sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','Registered', '%q', %ld, '%q')",
-							 call_id, from_user, from_host, contact_str, rpid, expires, user_agent);
+		sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','Registered', '%q', %ld, '%q', '%q', '%q')",
+							 call_id, from_user, from_host, contact_str, rpid, expires, user_agent, to_user, to_host);
 
 		if (sql) {
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
@@ -447,7 +457,7 @@
 
 		if (++loops >= 100) {
 			if (++ireg_loops >= IREG_SECONDS) {
-				sofia_reg_check_expire(profile, switch_timestamp(NULL));
+				sofia_reg_check_expire(profile, switch_timestamp(NULL), 0);
 				ireg_loops = 0;
 			}
 
@@ -518,20 +528,22 @@
 		tportlog = 1;
 	}
 
-	if (use_100rel && use_timer) {
-		supported = "100rel, precondition, timer";
-	} else if (use_100rel) {
-		supported = "100rel, precondition";
-	} else if (use_timer) {
-		supported = "timer, precondition";
-	} else {
-		supported = "precondition";
-	}
+	supported = switch_core_sprintf(profile->pool, "%s%sprecondition, path, replaces", 
+									use_100rel ? "100rel, " : "",
+									use_timer ? "timer, " : ""
+									);
 
 	profile->nua = nua_create(profile->s_root,	/* Event loop */
 							  sofia_event_callback,	/* Callback for processing events */
 							  profile,	/* Additional data to pass to callback */
-							  NUTAG_URL(profile->bindurl), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)), NTATAG_UDP_MTU(65536), NTATAG_SERVER_RPORT(2), TAG_IF(tportlog, TPTAG_LOG(1)), TAG_END());	/* Last tag should always finish the sequence */
+							  NUTAG_URL(profile->bindurl),
+							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)), 
+							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)), 
+							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)), 
+							  NTATAG_UDP_MTU(65536), 
+							  NTATAG_SERVER_RPORT(profile->rport_level), 
+							  TAG_IF(tportlog, TPTAG_LOG(1)), 
+							  TAG_END());	/* Last tag should always finish the sequence */
 
 	if (!profile->nua) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Creating SIP UA for profile: %s\n", profile->name);
@@ -547,6 +559,7 @@
 				   NUTAG_APPL_METHOD("INFO"),
 				   NUTAG_AUTOANSWER(0),
 				   NUTAG_AUTOALERT(0),
+				   NUTAG_ENABLEMESSENGER(1),
 				   TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
 				   TAG_IF((profile->mflags & MFLAG_REFER), NUTAG_ALLOW("REFER")),
 				   NUTAG_ALLOW("INFO"),
@@ -572,7 +585,7 @@
 		node->nua = nua_create(profile->s_root,	/* Event loop */
 							   sofia_event_callback,	/* Callback for processing events */
 							   profile,	/* Additional data to pass to callback */
-							   NTATAG_SERVER_RPORT(2), NUTAG_URL(node->url), TAG_END());	/* Last tag should always finish the sequence */
+							   NTATAG_SERVER_RPORT(profile->rport_level), NUTAG_URL(node->url), TAG_END());	/* Last tag should always finish the sequence */
 
 		nua_set_params(node->nua,
 					   NUTAG_APPL_METHOD("OPTIONS"),
@@ -755,6 +768,7 @@
 		switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 
 		if ((gateway = switch_core_alloc(profile->pool, sizeof(*gateway)))) {
+			const char *sipip, *format;
 			char *register_str = "true", *scheme = "Digest",
 				*realm = NULL,
 				*username = NULL,
@@ -899,8 +913,11 @@
 
 			gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s;transport=%s", register_proxy, register_transport);
 			gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>", from_user, from_domain, register_transport);
-			gateway->register_contact = switch_core_sprintf(gateway->pool, "<sip:%s@%s:%d%s>", extension,
-															profile->extsipip ? profile->extsipip : profile->sipip,
+
+			sipip = profile->extsipip ?  profile->extsipip : profile->sipip;
+			format = strchr(sipip, ':') ? "<sip:%s@[%s]:%d%s>" : "<sip:%s@%s:%d%s>";
+			gateway->register_contact = switch_core_sprintf(gateway->pool, format, extension,
+															sipip,
 															sofia_glue_transport_has_tls(gateway->register_transport) ? profile->tls_sip_port : profile->
 															sip_port, params);
 
@@ -953,6 +970,318 @@
 }
 
 
+switch_status_t reconfig_sofia(sofia_profile_t *profile)
+{
+	switch_xml_t cfg, xml = NULL, xprofile, profiles, gateways_tag, domain_tag, domains_tag, aliases_tag, alias_tag, settings, param;
+	char *cf = "sofia.conf";
+	switch_event_t *params = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	switch_event_create(&params, SWITCH_EVENT_MESSAGE);
+	switch_assert(params);
+	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "profile", profile->name);
+	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "reconfig", "true");
+
+	if (!(xml = switch_xml_open_cfg(cf, &cfg, params))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
+		status = SWITCH_STATUS_FALSE;
+		goto done;
+	}
+	
+	if ((profiles = switch_xml_child(cfg, "profiles"))) {
+		for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) {
+			char *xprofilename = (char *) switch_xml_attr_soft(xprofile, "name");
+
+			if (strcasecmp(profile->name, xprofilename)) {
+				continue;
+			}
+
+			/* you could change profile->foo here if it was a minor change like context or dialplan ... */
+			profile->rport_level = 1; /* default setting */
+			profile->acl_count = 0;
+			profile->pflags |= PFLAG_STUN_ENABLED;
+
+			if ((settings = switch_xml_child(xprofile, "settings"))) {
+				for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+					char *var = (char *) switch_xml_attr_soft(param, "name");
+					char *val = (char *) switch_xml_attr_soft(param, "value");
+					if (!strcasecmp(var, "debug")) {
+						profile->debug = atoi(val);
+					} else if (!strcasecmp(var, "user-agent-string")) { 
+						profile->user_agent = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "dtmf-type")) {
+						if (!strcasecmp(val, "rfc2833")) {
+							profile->dtmf_type = DTMF_2833;
+						} else if (!strcasecmp(val, "info")) {
+							profile->dtmf_type = DTMF_INFO;
+						} else {
+							profile->dtmf_type = DTMF_NONE;
+						}
+					} else if (!strcasecmp(var, "NDLB-force-rport")) {
+						if (switch_true(val)) {
+							profile->rport_level = 2;
+						}
+					} else if (!strcasecmp(var, "record-template")) {
+						profile->record_template = switch_core_strdup(profile->pool, val);;
+					} else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media"))) {
+						if (switch_true(val)) {
+							switch_set_flag(profile, TFLAG_INB_NOMEDIA);
+						} else {
+							switch_clear_flag(profile, TFLAG_INB_NOMEDIA);
+						}
+					} else if (!strcasecmp(var, "inbound-late-negotiation")) {
+						if (switch_true(val)) {
+							switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
+						} else {
+							switch_clear_flag(profile, TFLAG_LATE_NEGOTIATION);
+						}
+					} else if (!strcasecmp(var, "inbound-proxy-media")) {
+						if (switch_true(val)) { 
+							switch_set_flag(profile, TFLAG_PROXY_MEDIA);
+						} else {
+							switch_clear_flag(profile, TFLAG_PROXY_MEDIA);
+						}
+					} else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+						} else {
+							profile->pflags &= ~PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+						}
+					} else if (!strcasecmp(var, "aggressive-nat-detection")) {
+						if (switch_true(val)) { 
+							profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
+						} else {
+							profile->pflags &= ~PFLAG_AGGRESSIVE_NAT_DETECTION;
+						}
+					} else if (!strcasecmp(var, "disable-rtp-auto-adjust")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_DISABLE_RTP_AUTOADJ;
+						} else {
+							profile->pflags &= ~PFLAG_DISABLE_RTP_AUTOADJ;
+						}
+					} else if (!strcasecmp(var, "NDLB-support-asterisk-missing-srtp-auth")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_DISABLE_SRTP_AUTH; 
+						} else {
+							profile->pflags &= ~PFLAG_DISABLE_SRTP_AUTH; 
+						}
+					} else if (!strcasecmp(var, "NDLB-funny-stun")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_FUNNY_STUN; 
+						} else {
+							profile->pflags &= ~PFLAG_FUNNY_STUN; 
+						}
+					} else if (!strcasecmp(var, "stun-enabled")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_STUN_ENABLED;
+						} else {
+							profile->pflags &= ~PFLAG_STUN_ENABLED; 
+						}
+					} else if (!strcasecmp(var, "stun-auto-disable")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+						} else {
+							profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE; 
+						}
+					} else if (!strcasecmp(var, "apply-nat-acl")) {
+						if (profile->acl_count < SOFIA_MAX_ACL) {
+							profile->nat_acl[profile->nat_acl_count++] = switch_core_strdup(profile->pool, val);
+						} else {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max acl records of %d reached\n", SOFIA_MAX_ACL);
+						}
+					} else if (!strcasecmp(var, "apply-inbound-acl")) {
+						if (profile->acl_count < SOFIA_MAX_ACL) {
+							profile->acl[profile->acl_count++] = switch_core_strdup(profile->pool, val);
+						} else {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max acl records of %d reached\n", SOFIA_MAX_ACL);
+						}
+					} else if (!strcasecmp(var, "apply-register-acl")) {
+						if (profile->reg_acl_count < SOFIA_MAX_ACL) {
+							profile->reg_acl[profile->reg_acl_count++] = switch_core_strdup(profile->pool, val);
+						} else {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max acl records of %d reached\n", SOFIA_MAX_ACL);
+						}
+					} else if (!strcasecmp(var, "rfc2833-pt")) {
+						profile->te = (switch_payload_t) atoi(val);
+					} else if (!strcasecmp(var, "cng-pt")) {
+						profile->cng_pt = (switch_payload_t) atoi(val);
+					} else if (!strcasecmp(var, "vad")) {
+						if (!strcasecmp(val, "in")) {
+							switch_set_flag(profile, TFLAG_VAD_IN);
+						} else if (!strcasecmp(val, "out")) {
+							switch_set_flag(profile, TFLAG_VAD_OUT);
+						} else if (!strcasecmp(val, "both")) {
+							switch_set_flag(profile, TFLAG_VAD_IN);
+							switch_set_flag(profile, TFLAG_VAD_OUT);
+						} else {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invald option %s for VAD\n", val);
+						}
+					} else if (!strcasecmp(var, "unregister-on-options-fail")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_UNREG_OPTIONS_FAIL;
+						} else {
+							profile->pflags &= ~PFLAG_UNREG_OPTIONS_FAIL;
+						}
+					} else if (!strcasecmp(var, "require-secure-rtp")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_SECURE;
+						} else {
+							profile->pflags &= ~PFLAG_SECURE;
+						}
+					} else if (!strcasecmp(var, "multiple-registrations")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_MULTIREG;
+						} else {
+							profile->pflags &= ~PFLAG_MULTIREG;
+						}
+					} else if (!strcasecmp(var, "supress-cng")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_SUPRESS_CNG;
+						} else {
+							profile->pflags &= ~PFLAG_SUPRESS_CNG;
+						}
+					} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
+						if (switch_true(val)) {
+							profile->ndlb |= PFLAG_NDLB_TO_IN_200_CONTACT;
+						} else {
+							profile->ndlb &= ~PFLAG_NDLB_TO_IN_200_CONTACT;
+						}
+					} else if (!strcasecmp(var, "NDLB-broken-auth-hash")) {
+						if (switch_true(val)) {
+							profile->ndlb |= PFLAG_NDLB_BROKEN_AUTH_HASH;
+						} else {
+							profile->ndlb &= ~PFLAG_NDLB_BROKEN_AUTH_HASH;
+						}
+					} else if (!strcasecmp(var, "pass-rfc2833")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_PASS_RFC2833;
+						} else {
+							profile->pflags &= ~PFLAG_PASS_RFC2833;
+						}
+					} else if (!strcasecmp(var, "inbound-codec-negotiation")) {
+						if (!strcasecmp(val, "greedy")) {
+							profile->pflags |= PFLAG_GREEDY;
+						} else {
+							profile->pflags &= ~PFLAG_GREEDY;
+						}
+					} else if (!strcasecmp(var, "disable-transcoding")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_DISABLE_TRANSCODING;
+						} else {
+							profile->pflags &= ~PFLAG_DISABLE_TRANSCODING;
+						}
+					} else if (!strcasecmp(var, "rtp-rewrite-timestamps")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_REWRITE_TIMESTAMPS;
+						} else {
+							profile->pflags &= ~PFLAG_REWRITE_TIMESTAMPS;
+						}
+					} else if (!strcasecmp(var, "auth-calls")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_AUTH_CALLS;
+						} else {
+							profile->pflags &= ~PFLAG_AUTH_CALLS;
+						}
+					} else if (!strcasecmp(var, "force-register-domain")) {
+						profile->reg_domain = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "hold-music")) {
+						profile->hold_music = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "session-timeout")) {
+						int v_session_timeout = atoi(val);
+						if (v_session_timeout >= 0) {
+							profile->session_timeout = v_session_timeout;
+						}
+					} else if (!strcasecmp(var, "rtp-timeout-sec")) {
+						int v = atoi(val);
+						if (v >= 0) {
+							profile->rtp_timeout_sec = v;
+						}
+					} else if (!strcasecmp(var, "rtp-hold-timeout-sec")) {
+						int v = atoi(val);
+						if (v >= 0) {
+							profile->rtp_hold_timeout_sec = v;
+						}
+					} else if (!strcasecmp(var, "nonce-ttl")) {
+						profile->nonce_ttl = atoi(val);
+					} else if (!strcasecmp(var, "dialplan")) {
+						profile->dialplan = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "max-calls")) {
+						profile->max_calls = atoi(val);
+					} else if (!strcasecmp(var, "codec-prefs")) {
+						profile->codec_string = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "dtmf-duration")) {
+						int dur = atoi(val);
+						if (dur > 10 && dur < 8000) {
+							profile->dtmf_duration = dur;
+						} else {
+							profile->dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION;
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds, using default of %d!\n", SWITCH_DEFAULT_DTMF_DURATION);
+						}
+					}
+				}
+			}
+			
+
+			if ((gateways_tag = switch_xml_child(xprofile, "gateways"))) {
+				parse_gateways(profile, gateways_tag);
+			}
+			
+			status = SWITCH_STATUS_SUCCESS;
+
+			if ((domains_tag = switch_xml_child(xprofile, "domains"))) {
+				for (domain_tag = switch_xml_child(domains_tag, "domain"); domain_tag; domain_tag = domain_tag->next) {
+					switch_xml_t droot, x_domain_tag;
+					const char *dname = switch_xml_attr_soft(domain_tag, "name");
+					const char *parse = switch_xml_attr_soft(domain_tag, "parse");
+					const char *alias = switch_xml_attr_soft(domain_tag, "alias");
+
+					if (!switch_strlen_zero(dname)) {
+						if (!strcasecmp(dname, "all")) {
+							switch_xml_t xml_root, x_domains;
+							if (switch_xml_locate("directory", NULL, NULL, NULL, &xml_root, &x_domains, NULL) == SWITCH_STATUS_SUCCESS) {
+								for (x_domain_tag = switch_xml_child(x_domains, "domain"); x_domain_tag; x_domain_tag = x_domain_tag->next) {
+									dname = switch_xml_attr_soft(x_domain_tag, "name");
+									parse_domain_tag(profile, x_domain_tag, dname, parse, alias);
+								}
+								switch_xml_free(xml_root);
+							}
+						} else if (switch_xml_locate_domain(dname, NULL, &droot, &x_domain_tag) == SWITCH_STATUS_SUCCESS) {
+							parse_domain_tag(profile, x_domain_tag, dname, parse, alias);
+							switch_xml_free(droot);
+						}
+					}
+				}
+			}
+
+			if ((aliases_tag = switch_xml_child(xprofile, "aliases"))) {
+				for (alias_tag = switch_xml_child(aliases_tag, "alias"); alias_tag; alias_tag = alias_tag->next) {
+					char *aname = (char *) switch_xml_attr_soft(alias_tag, "name");
+					if (!switch_strlen_zero(aname)) {
+						
+						if (sofia_glue_add_profile(switch_core_strdup(profile->pool, aname), profile) == SWITCH_STATUS_SUCCESS) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Alias [%s] for profile [%s]\n", aname, profile->name);
+						} else {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Alias [%s] for profile [%s] (already exists)\n",
+											  aname, profile->name);
+						}
+					}
+				}
+			}
+		}
+	}
+
+ done:
+
+	if (xml) {
+        switch_xml_free(xml);
+    }
+
+	switch_event_destroy(&params);
+
+	return status;
+
+}
+
 switch_status_t config_sofia(int reload, char *profile_name)
 {
 	char *cf = "sofia.conf";
@@ -1052,7 +1381,9 @@
 				profile->dtmf_duration = 100;
 				profile->tls_version = 0;
 				profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
-
+				profile->rport_level = 1;
+				profile->pflags |= PFLAG_STUN_ENABLED;
+				
 				for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 					char *var = (char *) switch_xml_attr_soft(param, "name");
 					char *val = (char *) switch_xml_attr_soft(param, "value");
@@ -1076,7 +1407,7 @@
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
 #endif
 					} else if (!strcasecmp(var, "user-agent-string")) {
-						profile->user_agent = switch_core_strdup(profile->pool, val);;
+						profile->user_agent = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "dtmf-type")) {
 						if (!strcasecmp(val, "rfc2833")) {
 							profile->dtmf_type = DTMF_2833;
@@ -1085,11 +1416,13 @@
 						} else {
 							profile->dtmf_type = DTMF_NONE;
 						}
+					} else if (!strcasecmp(var, "NDLB-force-rport")) {
+						if (switch_true(val)) {
+							profile->rport_level = 2;
+						}
 					} else if (!strcasecmp(var, "record-template")) {
 						profile->record_template = switch_core_strdup(profile->pool, val);;
-					} else if (!strcasecmp(var, "inbound-no-media") && switch_true(val)) {
-						switch_set_flag(profile, TFLAG_INB_NOMEDIA);
-					} else if (!strcasecmp(var, "inbound-bypass-media") && switch_true(val)) {
+					} else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media")) && switch_true(val)) {
 						switch_set_flag(profile, TFLAG_INB_NOMEDIA);
 					} else if (!strcasecmp(var, "inbound-late-negotiation") && switch_true(val)) {
 						switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
@@ -1099,6 +1432,28 @@
 						profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
 					} else if (!strcasecmp(var, "aggressive-nat-detection") && switch_true(val)) {
 						profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
+					} else if (!strcasecmp(var, "disable-rtp-auto-adjust") && switch_true(val)) {
+						profile->pflags |= PFLAG_DISABLE_RTP_AUTOADJ;
+					} else if (!strcasecmp(var, "NDLB-support-asterisk-missing-srtp-auth") && switch_true(val)) {
+						profile->pflags |= PFLAG_DISABLE_SRTP_AUTH;
+					} else if (!strcasecmp(var, "NDLB-funny-stun")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_FUNNY_STUN; 
+						} else {
+							profile->pflags &= ~PFLAG_FUNNY_STUN; 
+						}
+					} else if (!strcasecmp(var, "stun-enabled")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_STUN_ENABLED;
+						} else {
+							profile->pflags &= ~PFLAG_STUN_ENABLED; 
+						}
+					} else if (!strcasecmp(var, "stun-auto-disable")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+						} else {
+							profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE; 
+						}
 					} else if (!strcasecmp(var, "rfc2833-pt")) {
 						profile->te = (switch_payload_t) atoi(val);
 					} else if (!strcasecmp(var, "cng-pt")) {
@@ -1154,7 +1509,7 @@
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invald IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
 						} else if (strcasecmp(val, "auto")) {
 							switch_port_t port = 0;
-							if (sofia_glue_ext_address_lookup(&myip, &port, val, profile->pool) == SWITCH_STATUS_SUCCESS) {
+							if (sofia_glue_ext_address_lookup(profile, NULL, &myip, &port, val, profile->pool) == SWITCH_STATUS_SUCCESS) {
 								ip = myip;
 							} else {
 								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get external ip.\n");
@@ -1249,6 +1604,10 @@
 						if (switch_true(val)) {
 							profile->pflags |= PFLAG_BLIND_REG;
 						}
+					} else if (!strcasecmp(var, "enable-3pcc")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_3PCC;
+						}
 					} else if (!strcasecmp(var, "accept-blind-auth")) {
 						if (switch_true(val)) {
 							profile->pflags |= PFLAG_BLIND_AUTH;
@@ -1318,7 +1677,8 @@
 						if (dur > 10 && dur < 8000) {
 							profile->dtmf_duration = dur;
 						} else {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds!\n");
+							profile->dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION;
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds, using default of %d!\n", SWITCH_DEFAULT_DTMF_DURATION);
 						}
 
 						/*
@@ -1344,7 +1704,7 @@
 					}
 				}
 
-				if (!profile->cng_pt) {
+				if ((!profile->cng_pt) && (!sofia_test_pflag(profile, PFLAG_SUPRESS_CNG))) {
 					profile->cng_pt = SWITCH_RTP_CNG_PAYLOAD;
 				}
 
@@ -1382,14 +1742,30 @@
 					profile->dialplan = switch_core_strdup(profile->pool, "XML");
 				}
 
+				if (!profile->context) {
+					profile->context = switch_core_strdup(profile->pool, "default");
+				}
+
 				if (!profile->sipdomain) {
 					profile->sipdomain = switch_core_strdup(profile->pool, profile->sipip);
 				}
 				if (profile->extsipip) {
-					profile->url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->extsipip, profile->sip_port);
+					char *ipv6 = strchr(profile->extsipip, ':');
+					profile->url = switch_core_sprintf(profile->pool,
+														"sip:mod_sofia@%s%s%s:%d",
+														ipv6 ? "[" : "",
+														profile->extsipip,
+														ipv6 ? "]" : "",
+														profile->sip_port);
 					profile->bindurl = switch_core_sprintf(profile->pool, "%s;maddr=%s", profile->url, profile->sipip);
 				} else {
-					profile->url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->sipip, profile->sip_port);
+					char *ipv6 = strchr(profile->sipip, ':');
+					profile->url = switch_core_sprintf(profile->pool,
+														"sip:mod_sofia@%s%s%s:%d",
+														ipv6 ? "[" : "",
+														profile->sipip,
+														ipv6 ? "]" : "",
+														profile->sip_port);
 					profile->bindurl = profile->url;
 				}
 
@@ -1407,12 +1783,37 @@
 					}
 
 					if (profile->extsipip) {
-						profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->extsipip, profile->tls_sip_port);
+						char *ipv6 = strchr(profile->extsipip, ':');
+						profile->tls_url = 
+							switch_core_sprintf(profile->pool,
+												"sip:mod_sofia@%s%s%s:%d",
+												ipv6 ? "[" : "",
+												profile->extsipip, ipv6 ? "]" : "",
+												profile->tls_sip_port);
 						profile->tls_bindurl =
-							switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d;maddr=%s", profile->extsipip, profile->tls_sip_port, profile->sipip);
+							switch_core_sprintf(profile->pool,
+												"sips:mod_sofia@%s%s%s:%d;maddr=%s",
+												ipv6 ? "[" : "",
+												profile->extsipip,
+												ipv6 ? "]" : "",
+												profile->tls_sip_port,
+												profile->sipip);
 					} else {
-						profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->sipip, profile->tls_sip_port);
-						profile->tls_bindurl = switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d", profile->sipip, profile->tls_sip_port);
+						char *ipv6 = strchr(profile->sipip, ':');
+						profile->tls_url = 
+							switch_core_sprintf(profile->pool,
+												"sip:mod_sofia@%s%s%s:%d",
+												ipv6 ? "[" : "",
+												profile->sipip,
+												ipv6 ? "]" : "",
+												profile->tls_sip_port);
+						profile->tls_bindurl =
+							switch_core_sprintf(profile->pool,
+												"sips:mod_sofia@%s%s%s:%d",
+												ipv6 ? "[" : "",
+												profile->sipip,
+												ipv6 ? "]" : "",
+												profile->tls_sip_port);
 					}
 
 					if (profile->tls_bind_params) {
@@ -1518,9 +1919,9 @@
 
 	if (gateway) {
 		if (status == 200 || status == 404) {
-			//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ping success %s\n", gateway->name);
 			if (gateway->state == REG_STATE_FAILED) {
 				gateway->state = REG_STATE_UNREGED;
+				gateway->retry = 0;
 			}
 			gateway->status = SOFIA_GATEWAY_UP;
 		} else {
@@ -1528,7 +1929,7 @@
 			gateway->status = SOFIA_GATEWAY_DOWN;
 			if (gateway->state == REG_STATE_REGED) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "unregister %s\n", gateway->name);
-				gateway->state = REG_STATE_UNREGISTER;
+				gateway->state = REG_STATE_FAILED;
 			}
 		}
 		gateway->ping = switch_timestamp(NULL) + gateway->ping_freq;
@@ -1560,6 +1961,14 @@
 
 		switch_channel_clear_flag(channel, CF_REQ_MEDIA);
 
+		if ((status == 180 || status == 183 || status == 200)) { 
+			if (sip->sip_user_agent && sip->sip_user_agent->g_string) {
+				switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
+			} else if (sip->sip_server && sip->sip_server->g_string) {
+				switch_channel_set_variable(channel, "sip_user_agent", sip->sip_server->g_string);
+			}
+		}
+
 		if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 
 			if (!switch_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
@@ -1596,6 +2005,7 @@
 			return;
 		}
 
+
 		if ((status == 180 || status == 183 || status == 200)) {
 			const char *astate = "early";
 			url_t *from = NULL, *to = NULL, *contact = NULL;
@@ -1660,6 +2070,28 @@
 				sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 			}
 		}
+
+		if (channel && sip && (status >= 300 || status < 399) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
+			sip_contact_t * p_contact = sip->sip_contact;
+			int i = 0;
+			char var_name[80];	
+
+			while (p_contact) {
+				if (p_contact->m_url) {
+					if (p_contact->m_url->url_user) {
+						switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_user_%d", i);
+						switch_channel_set_variable_partner(channel, var_name, p_contact->m_url->url_user);
+					}
+					if (p_contact->m_url->url_host) {
+						switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_host_%d", i);
+						switch_channel_set_variable_partner(channel, var_name, p_contact->m_url->url_host);
+					}
+					p_contact = p_contact->m_next;
+					i++;
+				}
+			}
+		}
+
 	}
 }
 
@@ -1686,6 +2118,12 @@
 			NUTAG_OFFER_SENT_REF(offer_sent),
 			NUTAG_ANSWER_SENT_REF(answer_sent),
 			SIPTAG_REPLACES_STR_REF(replaces_str), SOATAG_LOCAL_SDP_STR_REF(l_sdp), SOATAG_REMOTE_SDP_STR_REF(r_sdp), TAG_END());
+	
+	if (ss_state == nua_callstate_terminated) {
+		if (sofia_private) {
+			sofia_private->destroy_me = 1;
+		}
+	}
 
 	if (session) {
 		channel = switch_core_session_get_channel(session);
@@ -1695,7 +2133,7 @@
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %s entering state [%s]\n",
 						  switch_channel_get_name(channel), nua_callstate_name(ss_state));
-
+		
 		if (r_sdp) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote SDP:\n%s\n", r_sdp);
 			tech_pvt->remote_sdp_str = switch_core_session_strdup(session, r_sdp);
@@ -1882,15 +2320,20 @@
 				if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 					goto done;
 				} else {
-					switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
-					sofia_glue_tech_choose_port(tech_pvt, 0);
-					sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
-					switch_channel_set_state(channel, CS_HIBERNATE);
-					nua_respond(tech_pvt->nh, SIP_200_OK,
-								SIPTAG_CONTACT_STR(tech_pvt->profile->url),
-								SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-								SOATAG_REUSE_REJECTED(1),
-								SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
+					if (profile->pflags & PFLAG_3PCC) {
+						switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
+						sofia_glue_tech_choose_port(tech_pvt, 0);
+						sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+						switch_channel_set_state(channel, CS_HIBERNATE);
+						nua_respond(tech_pvt->nh, SIP_200_OK,
+									SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+									SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+									SOATAG_REUSE_REJECTED(1),
+									SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
+					} else {
+						switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "3PCC DISABLED");
+						switch_channel_hangup(channel, SWITCH_CAUSE_MANDATORY_IE_MISSING);
+					}
 					goto done;
 				}
 			}
@@ -1919,6 +2362,18 @@
 						msg.from = __FILE__;
 						msg.string_arg = (char *) r_sdp;
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Passing SDP to other leg.\n%s\n", r_sdp);
+						
+						if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+							if (!switch_stristr("sendonly", r_sdp)) {
+								switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+								switch_channel_presence(tech_pvt->channel, "unknown", "unhold");
+							}
+						} else if (switch_stristr("sendonly", r_sdp)) {
+							switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+							switch_channel_presence(tech_pvt->channel, "unknown", "hold");
+						}
+					
+
 						if (switch_core_session_receive_message(other_session, &msg) != SWITCH_STATUS_SUCCESS) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Other leg is not available\n");
 							nua_respond(tech_pvt->nh, 403, "Hangup in progress", TAG_END());
@@ -2061,7 +2516,9 @@
 		break;
 	case nua_callstate_terminating:
 		if (session) {
-			if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
+			if (status == 488 || switch_channel_get_state(channel) == CS_HIBERNATE) {
+				tech_pvt->q850_cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
+			} else if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
 				switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 			}
 		}
@@ -2084,6 +2541,9 @@
 						switch_channel_set_variable(channel, "sip_term_status", st);
 						switch_snprintf(st, sizeof(st), "sip:%d", status);
 						switch_channel_set_variable_partner(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st);
+						if (phrase) {
+							switch_channel_set_variable_partner(channel, "sip_hangup_phrase", phrase);
+						}
 					}
 					switch_snprintf(st, sizeof(st), "%d", cause);
 					switch_channel_set_variable(channel, "sip_term_cause", st);
@@ -2092,16 +2552,10 @@
 			}
 
 			if (tech_pvt->sofia_private) {
-				sofia_private = tech_pvt->sofia_private;
 				tech_pvt->sofia_private = NULL;
-				sofia_private->destroy_me = 1;
 			}
 
 			tech_pvt->nh = NULL;
-
-
-		} else if (sofia_private) {
-			sofia_private->destroy_me = 1;
 		}
 
 		if (nh) {
@@ -2599,6 +3053,7 @@
 	su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
 	int network_port = 0;
 	char *is_nat = NULL;
+	char *acl_token = NULL;
 
 	if (sess_count >= sess_max || !(profile->pflags & PFLAG_RUNNING)) {
 		nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
@@ -2611,7 +3066,7 @@
 		return;
 	}
 
-	get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
+	get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen);
 	network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
 
 	if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
@@ -2652,23 +3107,27 @@
 			}
 		}
 	}
-
+	
 	if (profile->acl_count) {
 		uint32_t x = 0;
 		int ok = 1;
 		char *last_acl = NULL;
+		const char *token = NULL;
 
 		for (x = 0; x < profile->acl_count; x++) {
 			last_acl = profile->acl[x];
-			if (!(ok = switch_check_network_list_ip(network_ip, last_acl))) {
+			if (!(ok = switch_check_network_list_ip_token(network_ip, last_acl, &token))) {
 				break;
 			}
 		}
 
 		if (ok) {
+			if (token) {
+				acl_token = strdup(token);
+			}
 			if ((profile->pflags & PFLAG_AUTH_CALLS)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl %s. Access Granted.\n",
-								  network_ip, switch_str_nil(last_acl));
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl %s[%s]. Access Granted.\n",
+								  network_ip, switch_str_nil(last_acl), switch_str_nil(acl_token));
 				is_auth = 1;
 			}
 		} else {
@@ -2724,10 +3183,35 @@
 
 	channel = tech_pvt->channel = switch_core_session_get_channel(session);
 
+	if (acl_token) {
+		switch_channel_set_variable(channel, "acl_token", acl_token);
+		if (strchr(acl_token, '@')) {
+			if (switch_ivr_set_user(session, acl_token) == SWITCH_STATUS_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Authenticating user %s\n", acl_token);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error Authenticating user %s\n", acl_token);
+			}
+		}
+		free(acl_token);
+		acl_token = NULL;
+	}
+
 	if (sip->sip_contact && sip->sip_contact->m_url) {
 		char tmp[35] = "";
-		tech_pvt->record_route = switch_core_session_sprintf(session, "sip:%s@%s:%d",
-															 sip->sip_contact->m_url->url_user, tech_pvt->remote_ip, tech_pvt->remote_port);
+
+		sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url);
+
+		const char *ipv6 = strchr(tech_pvt->remote_ip, ':');
+		tech_pvt->record_route =
+			switch_core_session_sprintf(session,
+			"sip:%s@%s%s%s:%d;transport=%s",
+			sip->sip_contact->m_url->url_user,
+			ipv6 ? "[" : "",
+			tech_pvt->remote_ip,
+			ipv6 ? "]" : "",
+			tech_pvt->remote_port,
+			sofia_glue_transport2str(transport));
+
 		switch_channel_set_variable(channel, "sip_received_ip", tech_pvt->remote_ip);
 		snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_port);
 		switch_channel_set_variable(channel, "sip_received_port", tmp);
@@ -2842,6 +3326,7 @@
 
 		url_set_chanvars(session, sip->sip_to->a_url, sip_to);
 		if (switch_channel_get_variable(channel, "sip_to_uri")) {
+			const char *ipv6;
 
 			host = switch_channel_get_variable(channel, "sip_to_host");
 			user = switch_channel_get_variable(channel, "sip_to_user");
@@ -2858,7 +3343,14 @@
 				port = sofia_glue_transport_has_tls(transport) ? profile->tls_sip_port : profile->sip_port;
 			}
 
-			tech_pvt->to_uri = switch_core_session_sprintf(session, "sip:%s@%s:%d;transport=%s", user, host, port, sofia_glue_transport2str(transport));
+			ipv6 = strchr(host, ':');
+			tech_pvt->to_uri =
+				switch_core_session_sprintf(session,
+					"sip:%s@%s%s%s:%d;transport=%s",
+					user, ipv6 ? "[" : "",
+					host, ipv6 ? "]" : "",
+					port,
+					sofia_glue_transport2str(transport));
 
 			if (profile->ndlb & PFLAG_NDLB_TO_IN_200_CONTACT) {
 				if (strchr(tech_pvt->to_uri, '>')) {
@@ -3064,13 +3556,14 @@
 				}
 			}
 		}
-
+		
 		switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
 	}
 
 	if (!(sofia_private = malloc(sizeof(*sofia_private)))) {
 		abort();
 	}
+
 	memset(sofia_private, 0, sizeof(*sofia_private));
 	tech_pvt->sofia_private = sofia_private;
 
@@ -3148,7 +3641,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "LUKE'S VOICE: Artoo, see what you can do with it. Hang on back there....\n"
 						  "Green laserfire moves past the beeping little robot as his head turns.  "
 						  "After a few beeps and a twist of his mechanical arm,\n"
-						  "Artoo reduces the max sessions to %d thus, saving the switch from certian doom.\n", sess_count - 10);
+						  "Artoo reduces the max sessions to %d thus, saving the switch from certain doom.\n", sess_count - 10);
 
 		switch_mutex_unlock(profile->flag_mutex);
 	}
@@ -3158,7 +3651,7 @@
 	}
 
 	nua_handle_bind(nh, NULL);
-	free(tech_pvt->sofia_private);
+	free(sofia_private);
 	switch_core_session_destroy(&session);
 	nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
 }
@@ -3176,6 +3669,14 @@
 	char message[256] = "";
 
 	if (aleg && bleg && switch_core_session_compare(aleg, bleg)) {
+		switch_channel_t *channel = switch_core_session_get_channel(bleg);
+		const char *ua = switch_channel_get_variable(channel, "sip_user_agent");
+		
+		if (ua && switch_stristr("cisco", ua)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "If you were using some other phone besides a Cisco, we would have updated the caller id display on your phone for you!\n");
+			return;
+		}
+
 		a_tech_pvt = (private_object_t *) switch_core_session_get_private(aleg);
 		b_tech_pvt = (private_object_t *) switch_core_session_get_private(bleg);
 
@@ -3191,7 +3692,6 @@
 		}
 	}
 }
-
 /*
  * This subroutine will take the a_params of a sip_addr_s structure and spin through them.
  * Each param will be used to create a channel variable.
@@ -3278,5 +3778,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c	Mon Aug  4 21:29:58 2008
@@ -44,6 +44,7 @@
 	uint32_t v_port;
 	int use_cng = 1;
 	const char *val;
+	const char *family;
 	const char *pass_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_video_fmtp");
 	const char *ov_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_force_video_fmtp");
 
@@ -82,13 +83,14 @@
 
 	tech_pvt->session_id++;
 
+	family = strchr(ip, ':') ? "IP6" : "IP4";
 	switch_snprintf(buf, sizeof(buf),
 					"v=0\n"
-					"o=FreeSWITCH %010u %010u IN IP4 %s\n"
+					"o=FreeSWITCH %010u %010u IN %s %s\n"
 					"s=FreeSWITCH\n"
-					"c=IN IP4 %s\n" "t=0 0\n"
+					"c=IN %s %s\n" "t=0 0\n"
 					"a=%s\n"
-					"m=audio %d RTP/%sAVP", tech_pvt->owner_id, tech_pvt->session_id, ip, ip, sr, port,
+					"m=audio %d RTP/%sAVP", tech_pvt->owner_id, tech_pvt->session_id, family, ip, family, ip, sr, port,
 					(!switch_strlen_zero(tech_pvt->local_crypto_key) && switch_test_flag(tech_pvt, TFLAG_SECURE)) ? "S" : "");
 
 
@@ -132,9 +134,9 @@
 
 	if (tech_pvt->rm_encoding) {
 		rate = tech_pvt->rm_rate;
-		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->pt, tech_pvt->rm_encoding, rate);
+		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->agreed_pt, tech_pvt->rm_encoding, rate);
 		if (tech_pvt->fmtp_out) {
-			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->pt, tech_pvt->fmtp_out);
+			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->agreed_pt, tech_pvt->fmtp_out);
 		}
 		if (tech_pvt->read_codec.implementation && !ptime) {
 			ptime = tech_pvt->read_codec.implementation->microseconds_per_frame / 1000;
@@ -225,11 +227,11 @@
 
 		if ((v_port = tech_pvt->adv_sdp_video_port)) {
 			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=video %d RTP/AVP", v_port);
-
+			
 			/*****************************/
 			if (tech_pvt->video_rm_encoding) {
 				sofia_glue_tech_set_video_codec(tech_pvt, 0);
-				switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->video_pt);
+				switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->video_agreed_pt);
 			} else if (tech_pvt->num_codecs) {
 				int i;
 				int already_did[128] = { 0 };
@@ -423,42 +425,93 @@
 	switch_channel_set_name(tech_pvt->channel, name);
 }
 
-switch_status_t sofia_glue_ext_address_lookup(char **ip, switch_port_t *port, char *sourceip, switch_memory_pool_t *pool)
+switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_object_t *tech_pvt, char **ip, switch_port_t *port, char *sourceip, switch_memory_pool_t *pool)
 {
 	char *error = "";
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	int x;
+	switch_port_t myport = *port;
+	const char *var;
+	int funny = 0;
+	switch_port_t stun_port = SWITCH_STUN_DEFAULT_PORT;
+	char *stun_ip = NULL;
 
 	if (!sourceip) {
 		return status;
 	}
 
 	if (!strncasecmp(sourceip, "stun:", 5)) {
-		char *stun_ip = sourceip + 5;
-		if (!stun_ip) {
+		char *p;
+
+		if (!(profile->pflags & PFLAG_STUN_ENABLED)) {
+			*ip = switch_core_strdup(pool, tech_pvt->profile->rtpip);
+			return SWITCH_STATUS_SUCCESS;
+		}
+		
+		stun_ip = strdup(sourceip + 5);
+
+		if ((p = strchr(stun_ip, ':'))) {
+			int iport;
+			*p++ = '\0';
+			iport = atoi(p);
+			if (iport > 0 && iport < 0xFFFF) {
+				stun_port = (switch_port_t) iport;
+			}
+		}
+
+		if (switch_strlen_zero(stun_ip)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! NO STUN SERVER\n");
-			return status;
+			goto out;
 		}
+
 		for (x = 0; x < 5; x++) {
-			if ((status = switch_stun_lookup(ip, port, stun_ip, SWITCH_STUN_DEFAULT_PORT, &error, pool)) != SWITCH_STATUS_SUCCESS) {
+			if ((profile->pflags & PFLAG_FUNNY_STUN) || 
+				(tech_pvt && (var = switch_channel_get_variable(tech_pvt->channel, "funny_stun")) && switch_true(var))) {
+				error = "funny";
+				funny++;
+			}
+			if ((status = switch_stun_lookup(ip, port, stun_ip, stun_port, &error, pool)) != SWITCH_STATUS_SUCCESS) {
 				switch_yield(100000);
 			} else {
 				break;
 			}
 		}
 		if (status != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, error);
-			return status;
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, stun_port, error);
+			goto out;
 		}
 		if (!*ip) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! No IP returned\n");
-			return SWITCH_STATUS_FALSE;
+			goto out;
 		}
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Success [%s]:[%d]\n", *ip, *port);
+		status = SWITCH_STATUS_SUCCESS;
+		if (tech_pvt) {
+			if (myport == *port && !strcmp(*ip, tech_pvt->profile->rtpip)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Not Required ip and port match. [%s]:[%d]\n", *ip, *port);
+				if (profile->pflags & PFLAG_STUN_AUTO_DISABLE) {
+					profile->pflags &= ~PFLAG_STUN_ENABLED;
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun completely disabled.\n");
+				}
+			} else {
+				tech_pvt->stun_ip = switch_core_session_strdup(tech_pvt->session, stun_ip);
+				tech_pvt->stun_port = stun_port;
+				tech_pvt->stun_flags |= STUN_FLAG_SET;
+				if (funny) {
+					tech_pvt->stun_flags |= STUN_FLAG_FUNNY;
+				}
+			}
+		}
 	} else {
 		*ip = sourceip;
+		status = SWITCH_STATUS_SUCCESS;
 	}
-	return SWITCH_STATUS_SUCCESS;
+
+ out:
+
+	switch_safe_free(stun_ip);
+
+	return status;
 }
 
 
@@ -480,6 +533,7 @@
 	char *ip = tech_pvt->profile->rtpip;
 	switch_port_t sdp_port;
 	char tmp[50];
+	const char *use_ip = NULL;
 
 	if (!force) {
 		if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) ||
@@ -500,12 +554,20 @@
 	}
 	sdp_port = tech_pvt->local_sdp_audio_port;
 
-	if (tech_pvt->profile->extrtpip) {
-		if (sofia_glue_ext_address_lookup(&ip, &sdp_port, tech_pvt->profile->extrtpip, switch_core_session_get_pool(tech_pvt->session)) !=
-			SWITCH_STATUS_SUCCESS) {
+	if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip"))) {
+		if (tech_pvt->profile->extrtpip) {
+			use_ip = tech_pvt->profile->extrtpip;
+		}
+	}
+
+	if (use_ip) {
+		tech_pvt->extrtpip = switch_core_session_strdup(tech_pvt->session, use_ip);
+		if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &ip, &sdp_port, 
+										  tech_pvt->extrtpip, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
 			return SWITCH_STATUS_FALSE;
 		}
 	}
+	
 
 	tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip);
 	tech_pvt->adv_sdp_audio_port = sdp_port;
@@ -542,7 +604,7 @@
 
 
 	if (tech_pvt->profile->extrtpip) {
-		if (sofia_glue_ext_address_lookup(&ip, &sdp_port, tech_pvt->profile->extrtpip, switch_core_session_get_pool(tech_pvt->session)) !=
+		if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &ip, &sdp_port, tech_pvt->profile->extrtpip, switch_core_session_get_pool(tech_pvt->session)) !=
 			SWITCH_STATUS_SUCCESS) {
 			return SWITCH_STATUS_FALSE;
 		}
@@ -669,8 +731,15 @@
 {
 	char *stripped = switch_core_session_strdup(session, uri);
 	char *new_uri = NULL;
+	char *p;
 
 	stripped = sofia_glue_get_url_from_contact(stripped, 0);
+
+	/* remove our params so we don't make any whiny moronic device piss it's pants and forget who it is for a half-hour */
+	if ((p = (char *)switch_stristr(";fs_", stripped))) {
+		*p = '\0'; 
+	}
+
 	if (transport && transport != SOFIA_TRANSPORT_UDP) {
 
 		if (switch_stristr("port=", stripped)) {
@@ -697,9 +766,13 @@
 		}
 	} else {
 		if (params) {
-			new_uri = switch_core_session_sprintf(session, "%s;%s", stripped, params);
+			new_uri = switch_core_session_sprintf(session, "%s%s;%s%s", uri_only ? "" : "<", stripped, params, uri_only ? "" : ">");
 		} else {
-			new_uri = stripped;
+			if (uri_only) {
+				new_uri = stripped;
+			} else {
+				new_uri = switch_core_session_sprintf(session, "<%s>", stripped);
+			}
 		}
 	}
 
@@ -714,12 +787,14 @@
 	char rvp[128] = "";
 	char *p, *ip_ptr = NULL, *port_ptr = NULL, *vid_port_ptr = NULL;
 	int x;
+	const char *val;
 
 	if (switch_strlen_zero(tech_pvt->remote_sdp_str)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if ((p = (char *) switch_stristr("c=IN IP4 ", tech_pvt->remote_sdp_str))) {
+	if ((p = (char *) switch_stristr("c=IN IP4 ", tech_pvt->remote_sdp_str)) ||
+		(p = (char *) switch_stristr("c=IN IP6 ", tech_pvt->remote_sdp_str))) {
 		ip_ptr = p + 9;
 	}
 
@@ -737,7 +812,7 @@
 
 	p = ip_ptr;
 	x = 0;
-	while (x < sizeof(rip) && p && *p && ((*p >= '0' && *p <= '9') || *p == '.')) {
+	while (x < sizeof(rip) && p && *p && ((*p >= '0' && *p <= '9') || *p == '.' || *p == ':' || (*p >= 'a' && *p <= 'f') || (*p >= 'A' && *p <= 'F'))) {
 		rip[x++] = *p;
 		p++;
 	}
@@ -781,8 +856,11 @@
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VIDEO RTP CHANGING DEST TO: [%s:%d]\n",
 									  tech_pvt->remote_sdp_video_ip, tech_pvt->remote_sdp_video_port);
-					/* Reactivate the NAT buster flag. */
-					switch_rtp_set_flag(tech_pvt->video_rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+					if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+						!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
+						/* Reactivate the NAT buster flag. */
+						switch_rtp_set_flag(tech_pvt->video_rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+					}
 				}
 			}
 		}
@@ -801,8 +879,11 @@
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP CHANGING DEST TO: [%s:%d]\n",
 							  tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
-			/* Reactivate the NAT buster flag. */
-			switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+			if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+				!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
+				/* Reactivate the NAT buster flag. */
+				switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);	
+			}
 		}
 	}
 
@@ -813,8 +894,10 @@
 void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt)
 {
 	switch_size_t len;
-	char *p, *q, *ip_ptr = NULL, *port_ptr = NULL, *vport_ptr = NULL;
-	int x;
+	char *p, *q;
+	int has_video=0,has_audio=0,has_ip=0;
+	char port_buf[25] = "";
+	char vport_buf[25] = "";
 
 	if (switch_strlen_zero(tech_pvt->local_sdp_str)) {
 		return;
@@ -822,38 +905,13 @@
 
 	len = strlen(tech_pvt->local_sdp_str) + 384;
 
-	if ((p = (char *) switch_stristr("c=IN IP4 ", tech_pvt->local_sdp_str))) {
-		ip_ptr = p + 9;
-	}
-
-	if ((ip_ptr && !strncmp(ip_ptr, "0.0.0.0", 7)) || switch_stristr("sendonly", tech_pvt->local_sdp_str)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Skip patch on hold SDP\n");
-		return;
-	}
-
-	if ((p = (char *) switch_stristr("m=audio ", tech_pvt->local_sdp_str))) {
-		port_ptr = p + 8;
-	}
-
-	if ((p = (char *) switch_stristr("m=video ", tech_pvt->local_sdp_str))) {
-		vport_ptr = p + 8;
-	}
-
-	if (!(ip_ptr && port_ptr)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SDP has no audio in it.\n%s\n",
-						  switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str);
-		return;
-	}
-
-	if (vport_ptr) {
-		sofia_glue_tech_choose_video_port(tech_pvt, 1);
-		tech_pvt->video_rm_encoding = "PROXY-VID";
-		tech_pvt->video_rm_rate = 90000;
-		tech_pvt->video_codec_ms = 0;
+	if (switch_stristr("sendonly", tech_pvt->local_sdp_str) || switch_stristr("0.0.0.0", tech_pvt->local_sdp_str)) {
+	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Skip patch on hold SDP\n");
+	    return;
 	}
-
+	
 	if (switch_strlen_zero(tech_pvt->adv_sdp_audio_ip) || !tech_pvt->adv_sdp_audio_port) {
-		if (sofia_glue_tech_choose_port(tech_pvt, 1) != SWITCH_STATUS_SUCCESS) {
+	    if (sofia_glue_tech_choose_port(tech_pvt, 1) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s I/O Error\n", switch_channel_get_name(tech_pvt->channel));
 			return;
 		}
@@ -861,47 +919,77 @@
 		tech_pvt->rm_rate = 8000;
 		tech_pvt->codec_ms = 20;
 	}
-
+	
+	switch_snprintf(port_buf, sizeof(port_buf), "%u", tech_pvt->adv_sdp_audio_port);
 	tech_pvt->orig_local_sdp_str = tech_pvt->local_sdp_str;
 	tech_pvt->local_sdp_str = switch_core_session_alloc(tech_pvt->session, len);
 
-	q = tech_pvt->local_sdp_str;
 	p = tech_pvt->orig_local_sdp_str;
+	q = tech_pvt->local_sdp_str;
 
-	while (p && *p) {
-		if (p == ip_ptr) {
+	while(p && *p) {
+	    if (tech_pvt->adv_sdp_audio_ip && !strncmp("c=IN IP", p, 7)) {
+			strncpy(q, p, 9);
+			p += 9;
+			q += 9;
 			strncpy(q, tech_pvt->adv_sdp_audio_ip, strlen(tech_pvt->adv_sdp_audio_ip));
 			q += strlen(tech_pvt->adv_sdp_audio_ip);
-			x = 0;
-			while (p && *p && ((*p >= '0' && *p <= '9') || *p == '.')) {
+
+			while(p && *p && ((*p >= '0' && *p <= '9') || *p == '.' || *p == ':' || (*p >= 'A' && *p <= 'F') || (*p >= 'a' && *p <= 'f'))) {
 				p++;
 			}
 
-		} else if (p == port_ptr) {
-			char port_buf[25] = "";
+	    	has_ip++;
 
-			switch_snprintf(port_buf, sizeof(port_buf), "%u", tech_pvt->adv_sdp_audio_port);
+		} else if (!strncmp("m=audio ", p, 8)) {
+			strncpy(q,p,8);
+			p += 8;
+			q += 8;
 			strncpy(q, port_buf, strlen(port_buf));
 			q += strlen(port_buf);
-			x = 0;
+
 			while (p && *p && (*p >= '0' && *p <= '9')) {
 				p++;
 			}
-		} else if (vport_ptr && tech_pvt->adv_sdp_video_port && p == vport_ptr) {
-			char port_buf[25] = "";
 
-			switch_snprintf(port_buf, sizeof(port_buf), "%u", tech_pvt->adv_sdp_video_port);
-			strncpy(q, port_buf, strlen(port_buf));
-			q += strlen(port_buf);
-			x = 0;
+			has_audio++;		
+
+	    } else if (!strncmp("m=video ", p, 8)) {
+			if (!has_video) {
+				sofia_glue_tech_choose_video_port(tech_pvt, 1);
+				tech_pvt->video_rm_encoding = "PROXY-VID";
+				tech_pvt->video_rm_rate = 90000;
+				tech_pvt->video_codec_ms = 0;
+				switch_snprintf(vport_buf, sizeof(vport_buf), "%u", tech_pvt->adv_sdp_video_port);
+			}
+
+			strncpy(q, p, 8);
+			p += 8;
+			q += 8;
+			strncpy(q, vport_buf, strlen(vport_buf));
+			q += strlen(vport_buf);
+
 			while (p && *p && (*p >= '0' && *p <= '9')) {
 				p++;
 			}
-		}
 
-		*q++ = *p++;
+			has_video++;
+	    }
+	    
+	    while (p && *p && *p != '\n') {
+			*q++ = *p++;
+	    }
+
+	    *q++ = *p++;
 	}
 
+	if (!has_ip && !has_audio) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SDP has no audio in it.\n%s\n",
+						  switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str);
+		tech_pvt->local_sdp_str = tech_pvt->orig_local_sdp_str;
+		return;
+	}
+	
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Patched SDP\n---\n%s\n+++\n%s\n",
 					  switch_channel_get_name(tech_pvt->channel), tech_pvt->orig_local_sdp_str, tech_pvt->local_sdp_str);
 }
@@ -925,7 +1013,9 @@
 	uint32_t session_timeout = 0;
 	const char *val;
 	const char *rep;
-	char *sticky = NULL;
+	const char *call_id = NULL;
+	char *route = NULL;
+	char *route_uri = NULL;
 
 	rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
 
@@ -943,11 +1033,21 @@
 	check_decode(cid_num, session);
 
 	if (!tech_pvt->from_str) {
-		tech_pvt->from_str = switch_core_session_sprintf(tech_pvt->session, "\"%s\" <sip:%s%s%s>",
-														 cid_name,
-														 cid_num,
-														 !switch_strlen_zero(cid_num) ? "@" : "",
-														 tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip);
+		const char* sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip;
+		const char* format = strchr(sipip, ':') ? "\"%s\" <sip:%s%s[%s]>" : "\"%s\" <sip:%s%s%s>";
+		const char *alt = NULL;
+
+		if ((alt = switch_channel_get_variable(channel, "sip_invite_domain"))) {
+			sipip = alt;
+		}
+			
+		tech_pvt->from_str = 
+			switch_core_session_sprintf(tech_pvt->session,
+										format,
+										cid_name,
+										cid_num,
+										!switch_strlen_zero(cid_num) ? "@" : "",
+										sipip);
 	}
 
 	if ((alertbuf = switch_channel_get_variable(channel, "alert_info"))) {
@@ -1040,7 +1140,7 @@
 
 		url_str = sofia_overcome_sip_uri_weakness(session, url, tech_pvt->transport, SWITCH_TRUE, invite_params);
 		invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, tech_pvt->transport, SWITCH_FALSE, NULL);
-		from_str = sofia_overcome_sip_uri_weakness(session, use_from_str, 0, SWITCH_FALSE, NULL);
+		from_str = sofia_overcome_sip_uri_weakness(session, use_from_str, 0, SWITCH_TRUE, NULL);
 		to_str = sofia_overcome_sip_uri_weakness(session, tech_pvt->dest_to, 0, SWITCH_FALSE, invite_params);
 
 
@@ -1050,15 +1150,21 @@
 		 */
 		use_from_str = from_str;
 		from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", tech_pvt->caller_profile->caller_id_name, use_from_str);
+		
 
 		tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL,
-								  NUTAG_URL(url_str), SIPTAG_TO_STR(to_str), SIPTAG_FROM_STR(from_str), SIPTAG_CONTACT_STR(invite_contact), TAG_END());
-
+								  NUTAG_URL(url_str),
+								  SIPTAG_TO_STR(to_str), 
+								  SIPTAG_FROM_STR(from_str),
+								  SIPTAG_CONTACT_STR(invite_contact),
+								  TAG_END());
+		
 
-		if (strstr(tech_pvt->dest, ";nat") || ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
+		if (tech_pvt->dest && (strstr(tech_pvt->dest, ";fs_nat") || strstr(tech_pvt->dest, ";received") 
+							   || ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val)))) {
 			switch_set_flag(tech_pvt, TFLAG_NAT);
 			tech_pvt->record_route = switch_core_session_strdup(tech_pvt->session, url_str);
-			sticky = tech_pvt->record_route;
+			route_uri = tech_pvt->record_route;
 			session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
 			switch_channel_set_variable(channel, "sip_nat_detected", "true");
 		}
@@ -1151,6 +1257,34 @@
 		sofia_glue_tech_patch_sdp(tech_pvt);
 	}
 
+	call_id = switch_channel_get_variable(channel, "sip_outgoing_call_id");
+
+	if (tech_pvt->dest && (route = strstr(tech_pvt->dest, ";fs_path="))) {
+		char *p;
+
+		route = switch_core_session_strdup(tech_pvt->session, route + 9);
+		switch_assert(route);
+
+		for (p = route; p && *p ; p++) {
+			if (*p == '>' || *p == ';') {
+				*p = '\0';
+				break;
+			}
+		}
+		switch_url_decode(route);
+		route_uri = switch_core_session_strdup(tech_pvt->session, route);
+		if ((p = strchr(route_uri, ','))) {
+			while (*(p-1) == ' ') {
+				p--;
+			}
+			if (*p) {
+				*p = '\0';
+			}
+		}
+		
+		route_uri = sofia_overcome_sip_uri_weakness(tech_pvt->session, route_uri, 0, SWITCH_TRUE, NULL);
+	}
+
 	nua_invite(tech_pvt->nh,
 			   NUTAG_AUTOANSWER(0),
 			   NUTAG_SESSION_TIMER(session_timeout),
@@ -1158,7 +1292,9 @@
 			   TAG_IF(!switch_strlen_zero(alert_info), SIPTAG_HEADER_STR(alert_info)),
 			   TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
 			   TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)),
-			   TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
+			   TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)),
+			   TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
+			   TAG_IF(route, SIPTAG_ROUTE_STR(route)),
 			   SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
 			   SOATAG_REUSE_REJECTED(1),
 			   SOATAG_ORDERED_USER(1),
@@ -1175,15 +1311,17 @@
 	private_object_t *tech_pvt = switch_core_session_get_private(session);
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_caller_profile_t *caller_profile;
+	const char *sipip, *format; 
 
 	switch_assert(tech_pvt != NULL);
 
 	caller_profile = switch_channel_get_caller_profile(channel);
 
-	if ((tech_pvt->from_str = switch_core_session_sprintf(session, "\"%s\" <sip:%s@%s>",
-														  caller_profile->caller_id_name,
-														  caller_profile->caller_id_number,
-														  tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip))) {
+	sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip;
+	format = strchr(sipip, ':') ? "\"%s\" <sip:%s@[%s]>" : "\"%s\" <sip:%s@%s>";
+	if ((tech_pvt->from_str = switch_core_session_sprintf(session, format,
+															caller_profile->caller_id_name,
+															caller_profile->caller_id_number, sipip))) {
 
 		const char *rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
 
@@ -1414,6 +1552,7 @@
 	unsigned char b64_key[512] = "";
 	const char *type_str;
 	unsigned char *key;
+	const char *val;
 
 	char *p;
 
@@ -1440,8 +1579,13 @@
 
 	tech_pvt->local_crypto_key = switch_core_session_sprintf(tech_pvt->session, "%d %s inline:%s", index, type_str, b64_key);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Local Key [%s]\n", tech_pvt->local_crypto_key);
-	tech_pvt->crypto_type = type;
 
+	if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_SRTP_AUTH) &&
+		!((val = switch_channel_get_variable(tech_pvt->channel, "NDLB_support_asterisk_missing_srtp_auth")) && switch_true(val))) {
+		tech_pvt->crypto_type = type;
+	} else {
+		tech_pvt->crypto_type = AES_CM_128_NULL_AUTH;
+	}
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -1546,8 +1690,11 @@
 
 	if (myflags) {
 		flags = myflags;
-	} else {
+	} else if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+				!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
 		flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
+    } else {
+		flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT);
 	}
 
 	if (switch_test_flag(tech_pvt, TFLAG_BUGGY_2833)) {
@@ -1589,7 +1736,7 @@
 	}
 
 	if (!switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP [%s] %s port %d -> %s port %d codec: %u ms: %d\n",
 						  switch_channel_get_name(tech_pvt->channel),
 						  tech_pvt->local_sdp_audio_ip,
 						  tech_pvt->local_sdp_audio_port,
@@ -1610,8 +1757,11 @@
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP CHANGING DEST TO: [%s:%d]\n",
 							  tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
-			/* Reactivate the NAT buster flag. */
-			switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+			if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+				!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
+				/* Reactivate the NAT buster flag. */
+				switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+			}
 		}
 		goto video;
 	}
@@ -1620,7 +1770,12 @@
 		if ((status = sofia_glue_tech_proxy_remote_addr(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
 			goto end;
 		}
-		flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_PROXY_MEDIA | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
+		if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+			!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
+			flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_PROXY_MEDIA | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
+		} else {
+			flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_PROXY_MEDIA | SWITCH_RTP_FLAG_DATAWAIT);
+		}
 		timer_name = NULL;
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PROXY AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
@@ -1647,7 +1802,8 @@
 		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;
-
+		uint32_t stun_ping = 0;
+		
 		if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_enable_vad_in")) && switch_true(val)) {
 			vad_in = 1;
 		}
@@ -1662,6 +1818,18 @@
 			vad_out = 0;
 		}
 
+		if ((tech_pvt->stun_flags & STUN_FLAG_SET) && (val = switch_channel_get_variable(tech_pvt->channel, "rtp_stun_ping"))) {
+			int ival = atoi(val);
+			
+			if (ival <= 0) {
+				if (switch_true(val)) {
+					ival = 6;
+				}
+			}
+
+			stun_ping = (ival * tech_pvt->read_codec.implementation->samples_per_second) / tech_pvt->read_codec.implementation->samples_per_frame;
+		}
+
 		tech_pvt->ssrc = switch_rtp_get_ssrc(tech_pvt->rtp_session);
 		switch_set_flag(tech_pvt, TFLAG_RTP);
 		switch_set_flag(tech_pvt, TFLAG_IO);
@@ -1673,6 +1841,12 @@
 							  switch_channel_get_name(switch_core_session_get_channel(tech_pvt->session)), vad_in ? "in" : "", vad_out ? "out" : "");
 		}
 
+		if (stun_ping) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting stun ping to %s:%d\n", tech_pvt->stun_ip, stun_ping);
+			switch_rtp_activate_stun_ping(tech_pvt->rtp_session, tech_pvt->stun_ip, tech_pvt->stun_port, 
+										  stun_ping, (tech_pvt->stun_flags & STUN_FLAG_FUNNY) ? 1 : 0);
+		}
+
 		if ((val = switch_channel_get_variable(tech_pvt->channel, "jitterbuffer_msec"))) {
 			int len = atoi(val);
 
@@ -1742,8 +1916,13 @@
 				sofia_glue_tech_choose_video_port(tech_pvt, 1);
 			}
 
-			flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ |
-										 SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_NOBLOCK | SWITCH_RTP_FLAG_RAW_WRITE);
+			if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+				!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
+				flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ |
+		 									 SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_NOBLOCK | SWITCH_RTP_FLAG_RAW_WRITE);
+			} else {
+				flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_NOBLOCK | SWITCH_RTP_FLAG_RAW_WRITE);
+			}
 
 			if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
 				flags |= SWITCH_RTP_FLAG_PROXY_MEDIA;
@@ -1868,7 +2047,7 @@
 		}
 	}
 
-	if (((m = sdp->sdp_media)) && m->m_mode == sdp_sendonly) {
+	if ((m = sdp->sdp_media) && (m->m_mode == sdp_sendonly || m->m_mode == sdp_inactive)) {
 		sendonly = 2;			/* global sendonly always wins */
 	}
 
@@ -1877,7 +2056,7 @@
 			continue;
 		}
 
-		if ((!strcasecmp(attr->a_name, "sendonly")) || (!strcasecmp(attr->a_name, "inactive"))) {
+		if (!strcasecmp(attr->a_name, "sendonly") || !strcasecmp(attr->a_name, "inactive")) {
 			sendonly = 1;
 		} else if (sendonly < 2 && !strcasecmp(attr->a_name, "sendrecv")) {
 			sendonly = 0;
@@ -1886,7 +2065,7 @@
 		}
 	}
 
-	if (sendonly) {
+	if (sendonly && switch_channel_test_flag(channel, CF_ANSWERED)) {
 		if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 			const char *stream;
 
@@ -1908,6 +2087,7 @@
 					switch_ivr_hold_uuid(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), NULL, 0);
 				} else {
 					switch_ivr_broadcast(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), stream, SMF_ECHO_ALEG | SMF_LOOP);
+					switch_yield(250000);
 				}
 			}
 		}
@@ -1916,6 +2096,8 @@
 			const char *uuid;
 			switch_core_session_t *b_session;
 
+			switch_yield(250000);
+
 			if (tech_pvt->max_missed_packets) {
 				switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
 			}
@@ -2367,7 +2549,7 @@
 	return url;
 }
 
-sofia_profile_t *sofia_glue_find_profile__(const char *file, const char *func, int line, char *key)
+sofia_profile_t *sofia_glue_find_profile__(const char *file, const char *func, int line, const char *key)
 {
 	sofia_profile_t *profile;
 
@@ -2426,6 +2608,46 @@
 	return status;
 }
 
+void sofia_glue_del_gateway(sofia_gateway_t *gp)
+{
+	if (!gp->deleted) {
+		if (gp->state != REG_STATE_NOREG) {
+			gp->retry = 0;
+			gp->state = REG_STATE_UNREGISTER;
+		}
+
+		gp->deleted = 1;
+	}
+}
+
+void sofia_glue_restart_all_profiles(void) 
+{
+	switch_hash_index_t *hi;
+	const void *var;
+    void *val;
+    sofia_profile_t *pptr;
+	switch_xml_t xml_root;
+	const char *err;
+
+	if ((xml_root = switch_xml_open_root(1, &err))) {
+		switch_xml_free(xml_root);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Reload XML [%s]\n", err);
+	}
+
+	switch_mutex_lock(mod_sofia_globals.hash_mutex);
+	if (mod_sofia_globals.profile_hash) {
+        for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+			switch_hash_this(hi, &var, NULL, &val);
+            if ((pptr = (sofia_profile_t *) val)) {
+				sofia_set_pflag_locked(pptr, PFLAG_RESPAWN);
+				sofia_clear_pflag_locked(pptr, PFLAG_RUNNING);
+			}
+		}
+	}
+	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
+
+}
+
 void sofia_glue_del_profile(sofia_profile_t *profile)
 {
 	sofia_gateway_t *gp;
@@ -2457,6 +2679,8 @@
 			switch_core_hash_delete(mod_sofia_globals.gateway_hash, gp->name);
 			switch_core_hash_delete(mod_sofia_globals.gateway_hash, gp->register_from);
 			switch_core_hash_delete(mod_sofia_globals.gateway_hash, gp->register_contact);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "deleted gateway %s\n", gp->name);
+			profile->gateways = NULL;
 		}
 	}
 	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
@@ -2471,7 +2695,11 @@
 		"   sip_host        VARCHAR(255),\n"
 		"   contact         VARCHAR(1024),\n"
 		"   status          VARCHAR(255),\n"
-		"   rpid            VARCHAR(255),\n" "   expires         INTEGER,\n" "   user_agent      VARCHAR(255)\n" ");\n";
+		"   rpid            VARCHAR(255),\n" 
+		"   expires         INTEGER,\n" 
+		"   user_agent      VARCHAR(255),\n" 
+		"   server_user        VARCHAR(255),\n"
+		"   server_host        VARCHAR(255)\n" ");\n";
 
 	char dialog_sql[] =
 		"CREATE TABLE sip_dialogs (\n"
@@ -2483,7 +2711,10 @@
 		"   sip_from_host   VARCHAR(255),\n"
 		"   contact_user    VARCHAR(255),\n"
 		"   contact_host    VARCHAR(255),\n"
-		"   state           VARCHAR(255),\n" "   direction       VARCHAR(255),\n" "   user_agent      VARCHAR(255)\n" ");\n";
+		"   state           VARCHAR(255),\n" 
+		"   direction       VARCHAR(255),\n" 
+		"   user_agent      VARCHAR(255)\n" 
+		");\n";
 
 	char sub_sql[] =
 		"CREATE TABLE sip_subscriptions (\n"
@@ -2497,10 +2728,15 @@
 		"   call_id         VARCHAR(255),\n"
 		"   full_from       VARCHAR(255),\n"
 		"   full_via        VARCHAR(255),\n"
-		"   expires         INTEGER,\n" "   user_agent      VARCHAR(255),\n" "   accept          VARCHAR(255)\n" ");\n";
-
-
-	char auth_sql[] = "CREATE TABLE sip_authentication (\n" "   nonce           VARCHAR(255),\n" "   expires         INTEGER" ");\n";
+		"   expires         INTEGER,\n" 
+		"   user_agent      VARCHAR(255),\n" 
+		"   accept          VARCHAR(255)\n" 
+		");\n";
+
+	char auth_sql[] = 
+		"CREATE TABLE sip_authentication (\n" 
+		"   nonce           VARCHAR(255),\n" 
+		"   expires         INTEGER" ");\n";
 
 	if (profile->odbc_dsn) {
 #ifdef SWITCH_HAVE_ODBC
@@ -2514,7 +2750,7 @@
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", profile->odbc_dsn);
 
-		if (switch_odbc_handle_exec(profile->master_odbc, "select sip_user,user_agent from sip_registrations", NULL) != SWITCH_ODBC_SUCCESS) {
+		if (switch_odbc_handle_exec(profile->master_odbc, "select sip_user,user_agent,server_host from sip_registrations", NULL) != SWITCH_ODBC_SUCCESS) {
 			switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_registrations", NULL);
 			switch_odbc_handle_exec(profile->master_odbc, reg_sql, NULL);
 		}
@@ -2542,7 +2778,7 @@
 			return 0;
 		}
 
-		switch_core_db_test_reactive(profile->master_db, "select sip_user,user_agent from sip_registrations", "DROP TABLE sip_registrations", reg_sql);
+		switch_core_db_test_reactive(profile->master_db, "select sip_user,user_agent,server_host from sip_registrations", "DROP TABLE sip_registrations", reg_sql);
 		switch_core_db_test_reactive(profile->master_db, "delete from sip_subscriptions where sip_user != '' or accept != ''",
 									 "DROP TABLE sip_subscriptions", sub_sql);
 		switch_core_db_test_reactive(profile->master_db, "delete from sip_dialogs", "DROP TABLE sip_dialogs", dialog_sql);
@@ -2819,6 +3055,18 @@
 	return 1;
 }
 
+const char *sofia_glue_strip_proto(const char *uri)
+{
+	char *p;
+
+	if ((p = strchr(uri, ':'))) {
+		return p+1;
+	}
+
+	return uri;
+}
+
+
 /* For Emacs:
  * Local Variables:
  * mode:c
@@ -2827,5 +3075,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c	Mon Aug  4 21:29:58 2008
@@ -52,14 +52,21 @@
 switch_status_t sofia_presence_chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint)
 {
 	char buf[256];
-	char *user, *host;
+	char *user = NULL, *host = NULL;
 	sofia_profile_t *profile = NULL;
 	char *ffrom = NULL;
 	nua_handle_t *msg_nh;
 	char *contact;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	const char *ct = "text/html";
+
+	if (subject && strchr(subject, '/')) {
+		ct = subject;
+	}
 
 	if (!to) {
-		return SWITCH_STATUS_SUCCESS;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To: header.\n");
+		goto end;
 	}
 
 	user = strdup(to);
@@ -73,21 +80,22 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
 						  "Chat proto [%s]\nfrom [%s]\nto [%s]\n%s\nInvalid Profile %s\n", proto, from, to,
 						  body ? body : "[no body]", host ? host : "NULL");
-		return SWITCH_STATUS_FALSE;
+		goto end;
 	}
 
 	if (!sofia_reg_find_reg_url(profile, user, host, buf, sizeof(buf))) {
-		return SWITCH_STATUS_FALSE;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find user. [%s][%s]\n", user, host);
+		goto end;
 	}
 
-	if (!strcmp(proto, SOFIA_CHAT_PROTO)) {
+	if (!strcasecmp(proto, SOFIA_CHAT_PROTO)) {
 		from = hint;
 	} else {
 		char *fp, *p, *fu = NULL;
 		fp = strdup(from);
 		if (!fp) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-			return SWITCH_STATUS_FALSE;
+			goto end;
 		}
 
 		if ((p = strchr(fp, '@'))) {
@@ -96,27 +104,33 @@
 			*p = '+';
 		}
 
-		ffrom = switch_mprintf("\"%s\" <sip:%s+%s@%s>", fu, proto, fp, profile->name);
+		ffrom = switch_mprintf("\"%s\" <sip:%s+%s@%s>", fu, proto, fp, profile->domain_name);
 		from = ffrom;
 		switch_safe_free(fu);
 		switch_safe_free(fp);
 	}
 
+	status = SWITCH_STATUS_SUCCESS;
 	contact = sofia_glue_get_url_from_contact(buf, 1);
-	msg_nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(from), NUTAG_URL(contact), SIPTAG_TO_STR(buf),	// if this cries, add contact here too, change the 1 to 0 and omit the safe_free
+	// if this cries, add contact here too, change the 1 to 0 and omit the safe_free
+	msg_nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(from), NUTAG_URL(contact), SIPTAG_TO_STR(buf),	
 						SIPTAG_CONTACT_STR(profile->url), TAG_END());
 
 	switch_safe_free(contact);
-	nua_message(msg_nh, SIPTAG_CONTENT_TYPE_STR("text/html"), SIPTAG_PAYLOAD_STR(body), TAG_END());
+	nua_message(msg_nh, SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(body), TAG_END());
+
+
+ end:
 
 	switch_safe_free(ffrom);
-	free(user);
+	switch_safe_free(user);
+
 
 	if (profile) {
 		switch_thread_rwlock_unlock(profile->rwlock);
 	}
 
-	return SWITCH_STATUS_SUCCESS;
+	return status;
 }
 
 void sofia_presence_cancel(void)
@@ -413,7 +427,8 @@
 
 			if (probe_euser && probe_host && (profile = sofia_glue_find_profile(probe_host))) {
 				sql = switch_mprintf("select sip_registrations.sip_user, sip_registrations.sip_host, sip_registrations.status, "
-									 "sip_registrations.rpid,'', sip_dialogs.uuid, sip_dialogs.state, sip_dialogs.direction "
+									 "sip_registrations.rpid,'', sip_dialogs.uuid, sip_dialogs.state, sip_dialogs.direction, "
+									 "sip_dialogs.sip_to_user, sip_dialogs.sip_to_host "
 									 "from sip_registrations left join sip_dialogs on "
 									 "(sip_dialogs.sip_from_user = sip_registrations.sip_user) "
 									 "and sip_dialogs.sip_from_host = sip_registrations.sip_host "
@@ -426,6 +441,7 @@
 			}
 
 			switch_safe_free(user);
+			switch_safe_free(probe_user);
 		}
 		return;
 	case SWITCH_EVENT_PRESENCE_IN:
@@ -668,15 +684,22 @@
 	char *status = argv[2];
 	char *rpid = argv[3];
 	char *proto = argv[4];
+	char *to_user = NULL;
 	char *uuid = NULL;
 	char *state = NULL;
 	char *direction = NULL;
 	switch_event_t *event;
+	char to_buf[128] = "";
 
 	if (argc > 5) {
 		uuid = switch_str_nil(argv[5]);
 		state = switch_str_nil(argv[6]);
 		direction = switch_str_nil(argv[7]);
+		if (argc > 8) {
+			switch_set_string(to_buf, argv[8]);
+			switch_url_decode(to_buf);
+			to_user = to_buf;
+		}
 	}
 
 	if (switch_strlen_zero(proto)) {
@@ -693,6 +716,10 @@
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", 0);
 
+		if (!switch_strlen_zero(to_user)) {
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "to-user", "%s", to_user);
+		}
+
 		if (switch_strlen_zero(state)) {
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "unique-id", "%s", SOFIA_CHAT_PROTO);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-state", "%s", "CS_HANGUP");
@@ -743,12 +770,57 @@
 }
 
 
+static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *rpid, char *prpid, char *status, const char **ct)
+{
+	if (switch_stristr("polycom", user_agent)) {
+		*ct = "application/xpidf+xml";
+		return switch_mprintf(
+							  "<?xml version=\"1.0\"?>\n"
+							  "<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
+							  "<presence>\n"
+							  " <status>\n"
+							  "  <note>%s</note>\n"
+							  " </status>\n"
+							  " <presentity uri=\"%s;method=SUBSCRIBE\" />\n"
+							  " <atom id=\"%s\">\n"
+							  "  <address uri=\"%s;user=ip\" priority=\"0.800000\">\n"
+							  "   <status status=\"%s\" />\n"
+							  "   <msnsubstatus substatus=\"%s\" />\n"
+							  "  </address>\n"
+							  " </atom>\n"
+							  "</presence>\n", status, id, id, url, open, prpid
+							  );
+	} else {
+		*ct = "application/pidf+xml";
+		return switch_mprintf(
+							  "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \n"
+							  "<presence xmlns='urn:ietf:params:xml:ns:pidf' \n"
+							  "xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' \n"
+							  "xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid' \n"
+							  "xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='%s'>\n"
+							  
+							  " <tuple id='t6a5ed77e'>\n"
+							  "  <status>\r\n"
+							  "   <basic>%s</basic>\n"
+							  "  </status>\n"
+							  " </tuple>\n"
+							  " <dm:person id='p06360c4a'>\n"
+							  "  <rpid:activities>\r\n" 
+							  "   <rpid:%s/>\n"
+							  "  </rpid:activities>\n"
+							  "  <dm:note>%s</dm:note>"
+							  " </dm:person>\n"
+							  "</presence>", id, prpid, rpid, status);
+	}
+}
+
+
 static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
 	struct presence_helper *helper = (struct presence_helper *) pArg;
 	sofia_profile_t *profile = helper->profile;
 	char *pl = NULL;
-	char *clean_id = NULL, *id = NULL, *note = NULL;
+	char *clean_id = NULL, *id = NULL;
 	uint32_t in = atoi(argv[13]);
 	char *status = argv[14];
 	char *rpid = argv[15];
@@ -761,6 +833,7 @@
 	char *event = argv[5];
 	char *call_id = argv[7];
 	char *expires = argv[10];
+	char *user_agent = argv[11];
 	//char *accept = argv[12];
 	nua_handle_t *nh;
 	char *to = NULL;
@@ -829,7 +902,14 @@
 		const char *from_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_from_user"));
 		const char *clean_to_user = NULL;
 		const char *clean_from_user = NULL;
-
+		const char *p_to_user = switch_str_nil(switch_event_get_header(helper->event, "to-user"));
+#if 0
+		char *buf;
+		switch_event_serialize(helper->event, &buf, SWITCH_FALSE);
+		switch_assert(buf);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf);
+		free(buf);
+#endif
 
 		if (is_dialog) {
 			SWITCH_STANDARD_STREAM(stream);
@@ -867,7 +947,11 @@
 			} else if (switch_strlen_zero(astate)) {
 				astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
 				if (switch_strlen_zero(astate)) {
-					astate = dft_state;
+					if (is_dialog) {
+						astate = dft_state;
+					} else {
+						astate = "terminated";
+					}
 				}
 			}
 
@@ -944,11 +1028,10 @@
 
 
 		if (!is_dialog) {
+			char status_line[256] = "";
 			if (in) {
-				char status_line[256] = "";
-
 				if (!strcmp(astate, "early")) {
-					switch_snprintf(status_line, sizeof(status_line), "R %s", switch_str_nil(from_id));
+					switch_snprintf(status_line, sizeof(status_line), "Ring %s", switch_str_nil(from_id));
 					rpid = "on-the-phone";
 				} else if (!strcmp(astate, "confirmed")) {
 					char *dest = switch_event_get_header(helper->event, "Caller-Destination-Number");
@@ -957,93 +1040,56 @@
 					}
 
 					if (switch_strlen_zero(from_id)) {
-						switch_snprintf(status_line, sizeof(status_line), "Available");
+						from_id = p_to_user;
+					}
+					
+					if (switch_strlen_zero(from_id)) {
+						switch_snprintf(status_line, sizeof(status_line), "On The Phone");
 					} else {
-						switch_snprintf(status_line, sizeof(status_line), "T %s", switch_str_nil(from_id));
-						rpid = "on-the-phone";
+						switch_snprintf(status_line, sizeof(status_line), "Talk %s", switch_str_nil(from_id));
 					}
+					rpid = "on-the-phone";
 				} else if (!strcmp(astate, "terminated")) {
-					switch_snprintf(status_line, sizeof(status_line), "Available");
+					if (!strcasecmp(rpid, "on-the-phone")) {
+						switch_snprintf(status_line, sizeof(status_line), "Dialing");
+					} else {
+						switch_snprintf(status_line, sizeof(status_line), "Available");
+					}
+				} else {
+					switch_set_string(status_line, status);
 				}
 
-				note = switch_mprintf("<dm:note>%s</dm:note>", status_line);
 				open = "open";
 			} else {
-				note = NULL;
 				open = "closed";
 			}
+			
+			if (!strncasecmp(status_line, "registered", 10)) {
+				switch_snprintf(status_line, sizeof(status_line), "Available");
+			}
 
 			prpid = translate_rpid(rpid);
-			pl = switch_mprintf("<?xml version='1.0' encoding='UTF-8'?>\r\n"
-								"<presence xmlns='urn:ietf:params:xml:ns:pidf'\r\n"
-								"xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model'\r\n"
-								"xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid'\r\n"
-								"xmlns:c='urn:ietf:params:xml:ns:pidf:cipid'\r\n"
-								"entity='pres:%s'>\r\n"
-								"<presentity uri=\"%s;method=SUBSCRIBE\"/>\r\n"
-								"<atom id=\"1002\">\r\n"
-								"<address uri=\"%s\" priority=\"0.800000\">\r\n"
-								"<status status=\"%s\">\r\n"
-								"<note>%s</note>\r\n"
-								"</status>\r\n"
-								"<msnsubstatus substatus=\"%s\"/>\r\n"
-								"</address>\r\n"
-								"</atom>\r\n"
-								"<tuple id='t6a5ed77e'>\r\n"
-								"<status>\r\n"
-								"<basic>%s</basic>\r\n"
-								"</status>\r\n"
-								"</tuple>\r\n"
-								"<dm:person id='p06360c4a'>\r\n"
-								"<rpid:activities>\r\n" "<rpid:%s/>\r\n"
-								"</rpid:activities>%s</dm:person>\r\n" "</presence>", id, id, profile->url, open, status, prpid, open, rpid, note);
-			ct = "application/pidf+xml";
+			pl = gen_pidf(user_agent, clean_id, profile->url, open, rpid, prpid, status_line, &ct);
 		}
 
 	} else {
 		if (in) {
-			note = switch_mprintf("<dm:note>%s</dm:note>", status);
 			open = "open";
 		} else {
-			note = NULL;
 			open = "closed";
 		}
-
-		pl = switch_mprintf("<?xml version='1.0' encoding='UTF-8'?>\r\n"
-							"<presence xmlns='urn:ietf:params:xml:ns:pidf'\r\n"
-							"xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model'\r\n"
-							"xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid'\r\n"
-							"xmlns:c='urn:ietf:params:xml:ns:pidf:cipid'\r\n"
-							"entity='pres:%s'>\r\n"
-							"<presentity uri=\"%s;method=SUBSCRIBE\"/>\r\n"
-							"<atom id=\"1002\">\r\n"
-							"<address uri=\"%s\" priority=\"0.800000\">\r\n"
-							"<status status=\"%s\">\r\n"
-							"<note>%s</note>\r\n"
-							"</status>\r\n"
-							"<msnsubstatus substatus=\"%s\"/>\r\n"
-							"</address>\r\n"
-							"</atom>\r\n"
-							"<tuple id='t6a5ed77e'>\r\n"
-							"<status>\r\n"
-							"<basic>%s</basic>\r\n"
-							"</status>\r\n"
-							"</tuple>\r\n"
-							"<dm:person id='p06360c4a'>\r\n"
-							"<rpid:activities>\r\n" "<rpid:%s/>\r\n"
-							"</rpid:activities>%s</dm:person>\r\n" "</presence>", id, id, profile->url, open, status, prpid, open, rpid, note);
-		ct = "application/pidf+xml";
+		prpid = translate_rpid(rpid);
+		pl = gen_pidf(user_agent, clean_id, profile->url, open, rpid, prpid, status, &ct);
 	}
-
+	
 	switch_snprintf(exp, sizeof(exp), "active;expires=%ld", (long) exptime);
 	nua_handle_bind(nh, &mod_sofia_globals.keep_private);
 	nua_notify(nh, SIPTAG_SUBSCRIPTION_STATE_STR(exp), SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(pl), TAG_END());
-
+	
   end:
 
 	switch_safe_free(id);
 	switch_safe_free(clean_id);
-	switch_safe_free(note);
 	switch_safe_free(pl);
 	switch_safe_free(to);
 
@@ -1119,7 +1165,7 @@
 
 	nua_notify(nh,
 			   NUTAG_NEWSUB(1),
-			   TAG_IF(strstr(o_contact, ";nat"), NUTAG_PROXY(contact)),
+			   TAG_IF(strstr(o_contact, ";fs_nat"), NUTAG_PROXY(contact)),
 			   SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END());
 
 	switch_safe_free(contact);
@@ -1162,13 +1208,14 @@
 		char *port;
 		char new_port[25] = "";
 		char *is_nat = NULL;
+		const char *ipv6;
 
 		if (!(contact && sip->sip_contact->m_url)) {
 			nua_respond(nh, 481, "INVALID SUBSCRIPTION", TAG_END());
 			return;
 		}
 
-		get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
+		get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen);
 		network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
 
 		tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END());
@@ -1238,11 +1285,25 @@
 			switch_snprintf(new_port, sizeof(new_port), ":%s", port);
 		}
 
+		ipv6 = strchr(contact_host, ':');
 		if (contact->m_url->url_params) {
-			contact_str = switch_mprintf("%s <sip:%s@%s%s;%s>%s",
-										 display, contact->m_url->url_user, contact_host, new_port, contact->m_url->url_params, is_nat ? ";nat" : "");
+			contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s;%s>%s",
+										display, contact->m_url->url_user,
+										ipv6 ? "[" : "",
+										contact_host,
+										ipv6 ? "]" : "",
+										new_port,
+										contact->m_url->url_params,
+										is_nat ? ";nat" : "");
 		} else {
-			contact_str = switch_mprintf("%s <sip:%s@%s%s>%s", display, contact->m_url->url_user, contact_host, new_port, is_nat ? ";nat" : "");
+			contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s>%s",
+										display,
+										contact->m_url->url_user,
+										ipv6 ? "[" : "",
+										contact_host,
+										ipv6 ? "]" : "",
+										new_port,
+										is_nat ?  ";nat" : "");
 		}
 
 
@@ -1357,7 +1418,13 @@
 			char *sticky = NULL;
 
 			if (is_nat) {
-				sticky = switch_mprintf("sip:%s@%s:%d", contact_user, network_ip, network_port);
+				ipv6 = strchr(network_ip, ':');
+				sticky = switch_mprintf("sip:%s@%s%s%s:%d",
+										contact_user,
+										ipv6 ? "[" : "",
+										network_ip,
+										ipv6 ? "]" : "",
+										network_port);
 			}
 
 			nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS(nua), SIPTAG_SUBSCRIPTION_STATE_STR(sstr), TAG_IF(sticky, NUTAG_PROXY(sticky)),
@@ -1639,7 +1706,8 @@
 	char buf[512];
 	su_home_t *home = NULL;
 
-	if (tech_pvt->hash_key || !sip || !sip->sip_from || !sip->sip_from->a_url || !sip->sip_from->a_url->url_user || !sip->sip_from->a_url->url_host) {
+	if (!tech_pvt || tech_pvt->hash_key || !sip || !sip->sip_from || !sip->sip_from->a_url || 
+		!sip->sip_from->a_url->url_user || !sip->sip_from->a_url->url_host) {
 		return;
 	}
 
@@ -1668,5 +1736,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c	Mon Aug  4 21:29:58 2008
@@ -70,7 +70,25 @@
 
 void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
 {
-	sofia_gateway_t *gateway_ptr;
+	sofia_gateway_t *gateway_ptr, *last = NULL;
+
+	for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
+		if (gateway_ptr->deleted && gateway_ptr->state == REG_STATE_NOREG) {
+			if (last) {
+				last->next = gateway_ptr->next;
+			} else {
+				profile->gateways = gateway_ptr->next;
+			}
+
+			switch_core_hash_delete(mod_sofia_globals.gateway_hash, gateway_ptr->name);
+			switch_core_hash_delete(mod_sofia_globals.gateway_hash, gateway_ptr->register_from);
+			switch_core_hash_delete(mod_sofia_globals.gateway_hash, gateway_ptr->register_contact);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "deleted gateway %s\n", gateway_ptr->name);
+		} else {
+			last = gateway_ptr;
+		}
+	}
+
 	for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
 		int ss_state = nua_callstate_authenticating;
 		reg_state_t ostate = gateway_ptr->state;
@@ -112,7 +130,7 @@
 			break;
 		case REG_STATE_UNREGED:
 			gateway_ptr->status = SOFIA_GATEWAY_DOWN;
-			sofia_reg_kill_reg(gateway_ptr, 1);
+			sofia_reg_kill_reg(gateway_ptr, 0);
 
 			if ((gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
 											  NUTAG_URL(gateway_ptr->register_proxy),
@@ -219,40 +237,106 @@
 	return 0;
 }
 
+void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent)
+{
+	const char *event = "check-sync";
+	nua_handle_t *nh;
+	char *contact_url = NULL;
+	char *id = NULL;
+
+	if (switch_stristr("snom", user_agent)) {
+		event = "check-sync;reboot=true";
+	} else if (switch_stristr("linksys", user_agent)) {
+		event = "reboot_now";
+	}
+
+	if ((contact_url = sofia_glue_get_url_from_contact((char *)contact, 1))) {
+		char *p;
+		id = switch_mprintf("sip:%s@%s", user, host);
+
+		if ((p = strstr(contact_url, ";fs_"))) {
+			*p = '\0';
+		}
+		
+		nh = nua_handle(profile->nua, NULL, 
+						NUTAG_URL(contact_url), 
+						SIPTAG_FROM_STR(id), 
+						SIPTAG_TO_STR(id), 
+						SIPTAG_CONTACT_STR(profile->url), 
+						TAG_END());
+
+		nua_notify(nh,
+				   NUTAG_NEWSUB(1),
+				   SIPTAG_EVENT_STR(event), 
+				   SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"),
+				   SIPTAG_PAYLOAD_STR(""),
+				   TAG_END());
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Sending reboot command to %s\n", contact_url);
+		free(contact_url);
+	}
+
+	switch_safe_free(id);
+}
+
+
 int sofia_reg_del_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
 	switch_event_t *s_event;
+	sofia_profile_t *profile = (sofia_profile_t *) pArg;
+	
+	if (argc > 10 && atoi(argv[10]) == 1) {
+		sofia_reg_send_reboot(profile, argv[1], argv[2], argv[3], argv[7]);
+	}
 
 	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, "profile-name", "%s", argv[6]);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", argv[8]);
 			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "call-id", "%s", argv[0]);
 			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "user", "%s", argv[1]);
 			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "host", "%s", argv[2]);
 			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s", argv[3]);
-			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%s", argv[4]);
-			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "user-agent", "%s", argv[5]);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%s", argv[6]);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "user-agent", "%s", argv[7]);
 			switch_event_fire(&s_event);
 		}
 	}
 	return 0;
 }
 
-void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id)
+void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int reboot)
 {
 	char sql[1024];
 	char *psql = sql;
+	char *user = strdup(call_id);
+	char *host = NULL;
 
-	switch_snprintf(sql, sizeof(sql), "select *,'%s' from sip_registrations where call_id='%s'", profile->name, call_id);
+	switch_assert(user);
+
+	if ((host = strchr(user, '@'))) {
+		*host++ = '\0';
+	}
+	
+	if (!host) {
+		host = "none";
+	}
+
+	switch_snprintf(sql, sizeof(sql), "select *,%d from sip_registrations where call_id='%s' or (sip_user='%s' and sip_host='%s')", 
+					reboot, call_id, user, host);
+	
 	switch_mutex_lock(profile->ireg_mutex);
-	sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_del_callback, NULL);
+	sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_del_callback, profile);
 	switch_mutex_unlock(profile->ireg_mutex);
 
-	switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where call_id='%s'", call_id);
+	switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where call_id='%s' or (sip_user='%s' and sip_host='%s')", 
+					call_id, user, host);
 	sofia_glue_execute_sql(profile, &psql, SWITCH_FALSE);
+
+	switch_safe_free(user);
+
 }
 
-void sofia_reg_check_expire(sofia_profile_t *profile, time_t now)
+void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot)
 {
 	char sql[1024];
 
@@ -276,12 +360,12 @@
 	switch_mutex_lock(profile->ireg_mutex);
 
 	if (now) {
-		switch_snprintf(sql, sizeof(sql), "select *,'%s' from sip_registrations where expires > 0 and expires <= %ld", profile->name, (long) now);
+		switch_snprintf(sql, sizeof(sql), "select *,%d from sip_registrations where expires > 0 and expires <= %ld", reboot, (long) now);
 	} else {
-		switch_snprintf(sql, sizeof(sql), "select *,'%s' from sip_registrations where expires > 0", profile->name);
+		switch_snprintf(sql, sizeof(sql), "select *,%d from sip_registrations where expires > 0", reboot);
 	}
 
-	sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_del_callback, NULL);
+	sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_del_callback, profile);
 	if (now) {
 		switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires <= %ld", (long) now);
 	} else {
@@ -318,7 +402,7 @@
 
 
 	if (now) {
-		switch_snprintf(sql, sizeof(sql), "select * from sip_registrations where status like '%%AUTO-NAT%%'");
+		switch_snprintf(sql, sizeof(sql), "select * from sip_registrations where status like '%%AUTO-NAT%%' or status like '%%UDP-NAT%%'");
 		sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_nat_callback, profile);
 	}
 
@@ -386,6 +470,7 @@
 								  uint32_t keylen, switch_event_t **v_event, const char *is_nat)
 {
 	sip_to_t const *to = NULL;
+	sip_from_t const *from = NULL;
 	sip_expires_t const *expires = NULL;
 	sip_authorization_t const *authorization = NULL;
 	sip_contact_t const *contact = NULL;
@@ -393,8 +478,11 @@
 	switch_event_t *s_event;
 	const char *to_user = NULL;
 	const char *to_host = NULL;
+	const char *from_user = NULL;
+	const char *from_host = NULL;
 	char contact_str[1024] = "";
 	int nat_hack = 0;
+	uint8_t multi_reg = 0, avoid_multi_reg = 0;
 	//char buf[512];
 	uint8_t stale = 0, forbidden = 0;
 	auth_res_t auth_res;
@@ -403,18 +491,23 @@
 	const char *rpid = "unknown";
 	const char *display = "\"user\"";
 	char network_ip[80];
+	char url_ip[80];
 	char *register_gateway = NULL;
 	int network_port;
 	const char *reg_desc = "Registered";
 	const char *call_id = NULL;
 	char *force_user;
 	char received_data[128] = "";
+	char *path_val = NULL;
+	su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
 
 	/* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */
 	switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL);
 
-	get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_addr);
-	network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
+	get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr,my_addrinfo->ai_addrlen);
+	network_port = get_port(my_addrinfo->ai_addr);
+
+	snprintf(url_ip, sizeof(url_ip), my_addrinfo->ai_addr->sa_family == AF_INET6 ? "[%s]" : "%s", network_ip);
 
 	expires = sip->sip_expires;
 	authorization = sip->sip_authorization;
@@ -432,17 +525,57 @@
 		return 1;
 	}
 
+	from = sip->sip_from;
+
+	if (from) {
+		from_user = from->a_url->url_user;
+		from_host = from->a_url->url_host;
+	}
+
 	if (contact->m_url) {
 		const char *port = contact->m_url->url_port;
 		char new_port[25] = "";
 		const char *contact_host = contact->m_url->url_host;
+		char *path_encoded = NULL;
+		int path_encoded_len = 0;
+		const char *proto = "sip";
+		int is_tls = 0, is_tcp = 0;
+
+
+		if (switch_stristr("transport=tls", sip->sip_contact->m_url->url_params)) {
+			is_tls += 1;
+		}
+		
+		if (sip->sip_contact->m_url->url_type == url_sips) {
+			proto = "sips";
+			is_tls += 2;
+		}
+		
+		if (switch_stristr("transport=tcp", sip->sip_contact->m_url->url_params)) {
+			is_tcp = 1;
+		}
+		
 		display = contact->m_display;
 
 		if (is_nat) {
-			reg_desc = "Registered(AUTO-NAT)";
-			contact_host = network_ip;
+			if (is_tls) {
+				reg_desc = "Registered(TLS-NAT)";
+			} else if (is_tcp) {
+				reg_desc = "Registered(TCP-NAT)";
+			} else {
+				reg_desc = "Registered(UDP-NAT)";
+			}
+			contact_host = url_ip;
 			switch_snprintf(new_port, sizeof(new_port), ":%d", network_port);
 			port = NULL;
+		} else {
+			if (is_tls) {
+				reg_desc = "Registered(TLS)";
+			} else if (is_tcp) {
+				reg_desc = "Registered(TCP)";
+			} else {
+				reg_desc = "Registered(UDP)";
+			}
 		}
 
 		if (switch_strlen_zero(display)) {
@@ -454,21 +587,32 @@
 			}
 		}
 
+		if (sip->sip_path) {
+			path_val = sip_header_as_string(nh->nh_home, (void *) sip->sip_path);
+			path_encoded_len = (strlen(path_val) * 3) + 1;
+			switch_zmalloc(path_encoded, path_encoded_len);
+			switch_copy_string(path_encoded, ";fs_path=", 10);
+			switch_url_encode(path_val, path_encoded + 9, path_encoded_len - 9);
+		}
+
 		if (port) {
 			switch_snprintf(new_port, sizeof(new_port), ":%s", port);
 		}
 
 		if (is_nat && (profile->pflags & PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
-			switch_snprintf(received_data, sizeof(received_data), ";received=\"%s:%d\"", network_ip, network_port);
+			switch_snprintf(received_data, sizeof(received_data), ";received=\"%s:%d\"", url_ip, network_port);
 		}
 
 		if (contact->m_url->url_params) {
-			switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s;%s>%s%s",
-							display, contact->m_url->url_user, contact_host, new_port, contact->m_url->url_params, received_data, is_nat ? ";nat" : "");
+			switch_snprintf(contact_str, sizeof(contact_str), "%s <%s:%s@%s%s;%s%s%s%s>",
+							display, proto, contact->m_url->url_user, contact_host, new_port, 
+							contact->m_url->url_params, received_data, is_nat ? ";fs_nat=yes" : "", path_encoded ? path_encoded : "");
 		} else {
-			switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s>%s%s", display, contact->m_url->url_user, contact_host, new_port,
-							received_data, is_nat ? ";nat" : "");
+			switch_snprintf(contact_str, sizeof(contact_str), "%s <%s:%s@%s%s%s%s%s>", display, proto, contact->m_url->url_user, contact_host, new_port,
+							received_data, is_nat ? ";fs_nat=yes" : "", path_encoded ? path_encoded : "");
 		}
+
+		switch_safe_free(path_encoded);
 	}
 
 	if (expires) {
@@ -497,6 +641,12 @@
 
 		if (exptime && v_event && *v_event) {
 			char *exp_var;
+			char *allow_multireg = NULL;
+
+			allow_multireg = switch_event_get_header(*v_event, "sip-allow-multiple-registrations");
+			if ( allow_multireg && switch_false(allow_multireg) ) {
+				avoid_multi_reg = 1;
+			}
 
 			register_gateway = switch_event_get_header(*v_event, "sip-register-gateway");
 
@@ -511,16 +661,16 @@
 			if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) {
 
 				if (*received_data && (profile->pflags & PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
-					switch_snprintf(received_data, sizeof(received_data), ";received=\"%s:%d\"", network_ip, network_port);
+					switch_snprintf(received_data, sizeof(received_data), ";received=\"%s:%d\"", url_ip, network_port);
 				}
 
 				if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") ||
 					!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-tls-connectile-dysfunction")) {
 					if (contact->m_url->url_params) {
-						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>%s;nat",
-										display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params, received_data);
+						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s%s;fs_nat=yes>",
+										display, contact->m_url->url_user, url_ip, network_port, contact->m_url->url_params, received_data);
 					} else {
-						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>%s;nat", display, contact->m_url->url_user, network_ip,
+						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d%s;fs_nat=yes>", display, contact->m_url->url_user, url_ip,
 										network_port, received_data);
 					}
 					if (strstr(v_contact_str, "tls")) {
@@ -576,6 +726,16 @@
 	call_id = sip->sip_call_id->i_id;	//sip_header_as_string(profile->home, (void *) sip->sip_call_id);
 	switch_assert(call_id);
 
+	/* Does this profile supports multiple registrations ? */
+	multi_reg = ( sofia_test_pflag(profile, PFLAG_MULTIREG) ) ? 1 : 0;
+
+	if ( multi_reg && avoid_multi_reg ) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+					"Disabling multiple registrations on a per-user basis for %s@%s\n", 
+					switch_str_nil(to_user), switch_str_nil(to_host) );
+		multi_reg = 0;
+	}
+
 	if (exptime) {
 		const char *agent = "dunno";
 
@@ -583,7 +743,7 @@
 			agent = sip->sip_user_agent->g_string;
 		}
 
-		if (sofia_test_pflag(profile, PFLAG_MULTIREG)) {
+		if (multi_reg) {
 			sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id);
 		} else {
 			sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, to_host);
@@ -591,8 +751,8 @@
 		switch_mutex_lock(profile->ireg_mutex);
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 
-		sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','%q', '%q', %ld, '%q')", call_id,
-							 to_user, to_host, contact_str, reg_desc, rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, agent);
+		sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q')", call_id,
+							 to_user, to_host, contact_str, reg_desc, rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, agent, from_user, from_host);
 		if (sql) {
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 		}
@@ -606,6 +766,8 @@
 			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "call-id", "%s", call_id);
 			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
 			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", (long) exptime);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "to-user", "%s", from_user);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "to-host", "%s", from_host);
 			switch_event_fire(&s_event);
 		}
 
@@ -616,17 +778,19 @@
 							  "Register:\nFrom:    [%s@%s]\nContact: [%s]\nExpires: [%ld]\n", to_user, to_host, contact_str, (long) exptime);
 		}
 
-		if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+		if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "sip");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->url);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, to_host);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Registered");
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_subtype", "probe");
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
 			switch_event_fire(&event);
 		}
 	} else {
-		if (sofia_test_pflag(profile, PFLAG_MULTIREG)) {
+		if (multi_reg) {
 			char *icontact, *p;
 			icontact = sofia_glue_get_url_from_contact(contact_str, 1);
 			if ((p = strchr(icontact, ';'))) {
@@ -665,62 +829,35 @@
 	}
 
 
-	if (switch_event_create(&event, SWITCH_EVENT_ROSTER) == SWITCH_STATUS_SUCCESS) {
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "sip");
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host);
-		switch_event_fire(&event);
-	}
-
-
-	/*
-	   if (call_id) {
-	   su_free(profile->home, call_id);
-	   }
-	 */
-
 	if (regtype == REG_REGISTER) {
-		char *new_contact = NULL;
-		char new_port[30] = "";
 		char exp_param[128] = "";
+		s_event = NULL;
 
 		if (exptime) {
-			switch_snprintf(exp_param, sizeof(exp_param), ";expires=%ld", exptime);
-		}
-
+			switch_snprintf(exp_param, sizeof(exp_param), "expires=%ld", exptime);
+			sip_contact_add_param(nh->nh_home, sip->sip_contact, exp_param);
 
-		if (contact->m_url->url_port) {
-			switch_snprintf(new_port, sizeof(new_port), ":%s", contact->m_url->url_port);
-		}
-
-		if (contact->m_url->url_params) {
-			new_contact = switch_mprintf("%s <sip:%s@%s%s;%s>%s",
-										 display, contact->m_url->url_user, contact->m_url->url_host, new_port, contact->m_url->url_params, exp_param);
+			if (switch_event_create(&s_event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", to_user, to_host);
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", "%s", profile->name);
+			}
 		} else {
-			new_contact = switch_mprintf("%s <sip:%s@%s%s>%s", display, contact->m_url->url_user, contact->m_url->url_host, new_port, exp_param);
-		}
-
-		nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
-		switch_safe_free(new_contact);
-
-		if (exptime) {
-			if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", to_user, to_host);
-				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", "%s", profile->name);
-				switch_event_fire(&event);
-			} else {
-				if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
-					switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", profile->name);
-					switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-user", "%s", to_user);
-					switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-host", "%s", to_host);
-					switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s", contact_str);
-					switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "call-id", "%s", call_id);
-					switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
-					switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", (long) exptime);
-					switch_event_fire(&s_event);
-				}
+			if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", profile->name);
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-user", "%s", to_user);
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-host", "%s", to_host);
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s", contact_str);
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "call-id", "%s", call_id);
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", (long) exptime);
 			}
 		}
+		
+		nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT(sip->sip_contact), TAG_IF(path_val, SIPTAG_PATH_STR(path_val)), NUTAG_WITH_THIS(nua), TAG_END());
 
+		if (s_event) {
+			switch_event_fire(&s_event);
+		}
 
 		return 1;
 	}
@@ -741,8 +878,9 @@
 	int network_port = 0;
 	char *is_nat = NULL;
 
-	get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
-	network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
+
+	get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen);
+	network_port = get_port(msg_addrinfo(nua_current_request(nua))->ai_addr);
 
 
 	if (!(sip->sip_contact && sip->sip_contact->m_url)) {
@@ -760,7 +898,7 @@
 		if (sip && sip->sip_via) {
 			const char *port = sip->sip_via->v_port;
 			const char *host = sip->sip_via->v_host;
-
+					
 			if (host && sip->sip_via->v_received) {
 				is_nat = "via received";
 			} else if (host && strcmp(network_ip, host)) {
@@ -788,13 +926,13 @@
 					break;
 				}
 			}
-
+				
 			if (ok) {
 				is_nat = last_acl;
 			}
 		}
 	}
-
+			
 	if (profile->reg_acl_count) {
 		uint32_t x = 0;
 		int ok = 1;
@@ -810,8 +948,8 @@
 		if (ok && !(profile->pflags & PFLAG_BLIND_REG)) {
 			type = REG_AUTO_REGISTER;
 		} else if (!ok) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip, profile->reg_acl[x]);
-			nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip, profile->reg_acl[x]);
+            nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
 			goto end;
 		}
 	}
@@ -823,7 +961,7 @@
 	}
 
 	sofia_reg_handle_register(nua, profile, nh, sip, type, key, sizeof(key), &v_event, is_nat);
-
+	
 	if (v_event) {
 		switch_event_fire(&v_event);
 	}
@@ -878,13 +1016,19 @@
 	char *cur;
 	char authentication[256] = "";
 	int ss_state;
+	sofia_gateway_t *var_gateway = NULL;
+	const char *gw_name = NULL;
 
 	if (session) {
 		private_object_t *tech_pvt;
+		switch_channel_t *channel = switch_core_session_get_channel(session);
+
 		if ((tech_pvt = switch_core_session_get_private(session)) && switch_test_flag(tech_pvt, TFLAG_REFER)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "received reply from refer\n");
-			return;
+			goto end;
 		}
+
+		gw_name = switch_channel_get_variable(channel, "sip_use_gateway");
 	}
 
 
@@ -894,7 +1038,7 @@
 		authenticate = sip->sip_proxy_authenticate;
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Missing Authenticate Header!\n");
-		return;
+		goto end;
 	}
 	scheme = (char const *) authenticate->au_scheme;
 	if (authenticate->au_params) {
@@ -906,9 +1050,39 @@
 		}
 	}
 
+	if (!gateway) {
+		if (gw_name) {
+			var_gateway = sofia_reg_find_gateway((char *)gw_name);
+		}
+
+
+		if (!var_gateway && realm) {
+			char rb[512] = "";
+			char *p = (char *) realm;
+			while((*p == '"')) {
+				p++;
+			}
+			switch_set_string(rb, p);
+			if ((p = strchr(rb, '"'))) {
+				*p = '\0';
+			}
+			var_gateway = sofia_reg_find_gateway(rb);
+		}
+
+		if (!var_gateway && sip && sip->sip_to) {
+			var_gateway = sofia_reg_find_gateway(sip->sip_to->a_url->url_host);
+		}
+		
+		if (var_gateway) {
+			gateway = var_gateway;
+		}
+	}
+
+
+
 	if (!(scheme && realm)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No scheme and realm!\n");
-		return;
+		goto end;
 	}
 
 	if (!gateway) {
@@ -927,7 +1101,7 @@
 
 	nua_authenticate(nh, SIPTAG_EXPIRES_STR(gateway->expires_str), NUTAG_AUTH(authentication), TAG_END());
 
-	return;
+	goto end;
 
   cancel:
 
@@ -937,6 +1111,16 @@
 		nua_cancel(nh, TAG_END());
 	}
 
+ end:
+
+	if (var_gateway) {
+		sofia_reg_release_gateway(var_gateway);
+	}
+
+	return;
+
+
+
 }
 
 auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr,
@@ -958,6 +1142,7 @@
 	char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1] = "";
 	char *domain_name = NULL;
 	switch_event_t *params = NULL;
+	const char *auth_acl = NULL;
 
 	username = realm = nonce = uri = qop = cnonce = nc = response = NULL;
 
@@ -1057,14 +1242,19 @@
 		domain_name = realm;
 	}
 
-	if (switch_xml_locate_user("id", username, domain_name, ip, &xml, &domain, &user, params) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", username, domain_name);
+	if (switch_xml_locate_user("id", switch_strlen_zero(username) ? "nobody" : username, 
+							   domain_name, ip, &xml, &domain, &user, params) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n"
+						  "You must define a domain called '%s' in your directory and add a user with the id=\"%s\" attribute\n"
+						  "and you must configure your device to use the proper domain in it's authentication credentials.\n"
+						  , username, domain_name, domain_name, username);
+
 		ret = AUTH_FORBIDDEN;
 		goto end;
 	}
-
+	
 	if (!(mailbox = (char *) switch_xml_attr(user, "mailbox"))) {
-		mailbox = username;
+		mailbox = switch_strlen_zero(username) ? "nobody" : username;
 	}
 
 	dparams = switch_xml_child(domain, "params");
@@ -1084,6 +1274,10 @@
 				passwd = val;
 			}
 
+			if (!strcasecmp(var, "auth-acl")) {
+				auth_acl = val;
+			}
+
 			if (!strcasecmp(var, "a1-hash")) {
 				a1_hash = val;
 			}
@@ -1099,12 +1293,24 @@
 				passwd = val;
 			}
 
+			if (!strcasecmp(var, "auth-acl")) {
+				auth_acl = val;
+			}
+
 			if (!strcasecmp(var, "a1-hash")) {
 				a1_hash = val;
 			}
 		}
 	}
 
+	if (auth_acl) {
+		if (!switch_check_network_list_ip(ip, auth_acl)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by user acl %s\n", ip, auth_acl);
+			ret = AUTH_FORBIDDEN;
+			goto end;
+		}
+	}
+
 	if (switch_strlen_zero(passwd) && switch_strlen_zero(a1_hash)) {
 		ret = AUTH_OK;
 		goto skip_auth;
@@ -1276,13 +1482,13 @@
 }
 
 
-sofia_gateway_t *sofia_reg_find_gateway__(const char *file, const char *func, int line, char *key)
+sofia_gateway_t *sofia_reg_find_gateway__(const char *file, const char *func, int line, const char *key)
 {
 	sofia_gateway_t *gateway = NULL;
 
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);
 	if ((gateway = (sofia_gateway_t *) switch_core_hash_find(mod_sofia_globals.gateway_hash, key))) {
-		if (!(gateway->profile->pflags & PFLAG_RUNNING)) {
+		if (!(gateway->profile->pflags & PFLAG_RUNNING) || gateway->deleted) {
 			gateway = NULL;
 			goto done;
 		}
@@ -1320,6 +1526,10 @@
 	}
 	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 
+	if (status == SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Added gateway '%s' to profile '%s'\n", gateway->name, gateway->profile->name);
+	}
+
 	return status;
 }
 
@@ -1331,5 +1541,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c	Mon Aug  4 21:29:58 2008
@@ -1260,5 +1260,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	Mon Aug  4 21:29:58 2008
@@ -29,6 +29,11 @@
 #include <sys/stat.h>
 #include <switch.h>
 
+typedef enum {
+	CDR_LEG_A = (1 << 0),
+	CDR_LEG_B = (1 << 1)
+} cdr_leg_t;
+
 struct cdr_fd {
 	int fd;
 	char *path;
@@ -50,6 +55,7 @@
 	int shutdown;
 	int rotate;
 	int debug;
+	cdr_leg_t legs;
 } globals;
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_csv_load);
@@ -166,8 +172,16 @@
 	const char *log_dir = NULL, *accountcode = NULL, *a_template_str = NULL, *g_template_str = NULL;
 	char *log_line, *path = NULL;
 
-	if (switch_channel_get_originator_caller_profile(channel)) {
-		return SWITCH_STATUS_SUCCESS;
+	if (!((globals.legs & CDR_LEG_A) && (globals.legs & CDR_LEG_B))) {
+		if ((globals.legs & CDR_LEG_A)) {
+			if (switch_channel_get_originator_caller_profile(channel)) {
+				return SWITCH_STATUS_SUCCESS;
+			}
+		} else {
+			if (switch_channel_get_originatee_caller_profile(channel)) {
+				return SWITCH_STATUS_SUCCESS;
+			}
+		}
 	}
 
 	if (!(log_dir = switch_channel_get_variable(channel, "cdr_csv_base"))) {
@@ -212,13 +226,16 @@
 	}
 
 	if (g_template_str != a_template_str) {
-		if (log_line && log_line != a_template_str) {
+		if (log_line != a_template_str) {
 			switch_safe_free(log_line);
 		}
 		log_line = switch_channel_expand_variables(channel, g_template_str);
 	}
 
-
+	if (!log_line) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating cdr\n");
+		return SWITCH_STATUS_FALSE;
+	}
 
 	path = switch_mprintf("%s%sMaster.csv", log_dir, SWITCH_PATH_SEPARATOR);
 	assert(path);
@@ -226,7 +243,7 @@
 	free(path);
 
 
-	if (log_line && log_line != g_template_str) {
+	if (log_line != g_template_str) {
 		free(log_line);
 	}
 
@@ -275,10 +292,11 @@
 	switch_core_hash_init(&globals.template_hash, pool);
 
 	globals.pool = pool;
-
+	
 	switch_core_hash_insert(globals.template_hash, "default", default_template);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding default template.\n");
-
+	globals.legs = CDR_LEG_A;
+	
 	if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 
 		if ((settings = switch_xml_child(cfg, "settings"))) {
@@ -287,6 +305,16 @@
 				char *val = (char *) switch_xml_attr_soft(param, "value");
 				if (!strcasecmp(var, "debug")) {
 					globals.debug = switch_true(val);
+				} else if (!strcasecmp(var, "legs")) {
+					globals.legs = 0;
+
+					if (strchr(val, 'a')) {
+						globals.legs |= CDR_LEG_A;
+					}
+
+					if (strchr(val, 'b')) {
+						globals.legs |= CDR_LEG_B;
+					}
 				} else if (!strcasecmp(var, "log-base")) {
 					globals.log_dir = switch_core_sprintf(pool, "%s%scdr-csv", val, SWITCH_PATH_SEPARATOR);
 				} else if (!strcasecmp(var, "rotate-on-hup")) {
@@ -335,7 +363,7 @@
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
@@ -370,5 +398,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	Mon Aug  4 21:29:58 2008
@@ -54,6 +54,7 @@
 	switch_hash_t *event_hash;
 	uint8_t event_list[SWITCH_EVENT_ALL + 1];
 	int running;
+	switch_event_node_t *node;
 } globals;
 
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_address, globals.address);
@@ -147,7 +148,7 @@
 		return;
 	}
 
-	if (event->subclass && !strcmp(event->subclass->name, MULTICAST_EVENT)) {
+	if (event->subclass_name && !strcmp(event->subclass_name, MULTICAST_EVENT)) {
 		/* ignore our own events to avoid ping pong */
 		return;
 	}
@@ -155,7 +156,7 @@
 	if (globals.event_list[(uint8_t) SWITCH_EVENT_ALL]) {
 		send = 1;
 	} else if ((globals.event_list[(uint8_t) event->event_id])) {
-		if (event->event_id != SWITCH_EVENT_CUSTOM || (event->subclass && switch_core_hash_find(globals.event_hash, event->subclass->name))) {
+		if (event->event_id != SWITCH_EVENT_CUSTOM || (event->subclass_name && switch_core_hash_find(globals.event_hash, event->subclass_name))) {
 			send = 1;
 		}
 	}
@@ -231,7 +232,7 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind(modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		switch_socket_close(globals.udp_socket);
 		return SWITCH_STATUS_GENERR;
@@ -261,6 +262,9 @@
 		globals.udp_socket = NULL;
 	}
 
+	switch_event_unbind(&globals.node);
+	switch_event_free_subclass(MULTICAST_EVENT);
+
 	switch_core_hash_destroy(&globals.event_hash);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -350,5 +354,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	Mon Aug  4 21:29:58 2008
@@ -106,6 +106,11 @@
 static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj);
 static void launch_listener_thread(listener_t *listener);
 
+static struct {
+	switch_event_node_t *node;
+} globals;
+
+
 static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_level_t level)
 {
 	listener_t *l;
@@ -162,7 +167,7 @@
 		if (l->event_list[SWITCH_EVENT_ALL]) {
 			send = 1;
 		} else if ((l->event_list[event->event_id])) {
-			if (event->event_id != SWITCH_EVENT_CUSTOM || !event->subclass || (switch_core_hash_find(l->event_hash, event->subclass->name))) {
+			if (event->event_id != SWITCH_EVENT_CUSTOM || !event->subclass_name || (switch_core_hash_find(l->event_hash, event->subclass_name))) {
 				send = 1;
 			}
 		}
@@ -318,6 +323,8 @@
 
 	prefs.done = 1;
 
+	switch_log_unbind_logger(socket_logger);
+
 	close_socket(&listen_list.sock);
 
 	while (prefs.threads) {
@@ -326,6 +333,7 @@
 			break;
 		}
 	}
+	switch_event_unbind(&globals.node);
 
 	switch_mutex_lock(listen_list.mutex);
 	for (l = listen_list.listeners; l; l = l->next) {
@@ -400,6 +408,8 @@
 	uint8_t crcount = 0;
 	uint32_t max_len = sizeof(mbuf);
 	switch_channel_t *channel = NULL;
+	int clen = 0;
+	
 	*event = NULL;
 	start = switch_timestamp(NULL);
 	ptr = mbuf;
@@ -472,16 +482,51 @@
 							}
 							if (var && val) {
 								switch_event_add_header(*event, SWITCH_STACK_BOTTOM, var, "%s", val);
+								if (!strcasecmp(var, "content-length")) {
+									clen = atoi(val);
+									
+									if (clen > 0) {
+										char *body;
+										char *p;
+										
+										switch_zmalloc(body, clen + 1);
+
+										p = body;
+										while(clen > 0) {
+											mlen = clen;
+											
+											status = switch_socket_recv(listener->sock, p, &mlen);
+
+											if (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS) {
+												return SWITCH_STATUS_FALSE;
+											}
+				
+											if (channel && !switch_channel_ready(channel)) {
+												status = SWITCH_STATUS_FALSE;
+												break;
+											}
+
+											clen -= (int) mlen;
+											p += mlen;
+										}
+
+										switch_event_add_body(*event, "%s", body);
+										free(body);
+									}
+
+
+
+								}
 							}
 						}
 					}
-
+					
 					cur = next;
 				}
 				break;
 			}
 		}
-
+		
 		if (timeout) {
 			elapsed = (uint32_t) (switch_timestamp(NULL) - start);
 			if (elapsed >= timeout) {
@@ -532,6 +577,11 @@
 						}
 					}
 
+					if (!listener->ebuf) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No event data (allocation error?)\n");
+						goto endloop;
+					}
+
 					len = strlen(listener->ebuf);
 
 					switch_snprintf(hbuf, sizeof(hbuf), "Content-Length: %" SWITCH_SSIZE_T_FMT "\n" "Content-Type: text/event-%s\n" "\n", len, etype);
@@ -577,6 +627,11 @@
 	char *reply, *freply = NULL;
 	switch_status_t status;
 
+	if (!acs) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Internal error.\n");
+		return NULL;
+	}
+
 	if (!acs->listener || !acs->listener->rwlock || switch_thread_rwlock_tryrdlock(acs->listener->rwlock) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! cannot get read lock.\n");
 		goto done;
@@ -631,7 +686,7 @@
 	}
 
   done:
-	if (acs && acs->bg) {
+	if (acs->bg) {
 		switch_memory_pool_t *pool = acs->pool;
 		acs = NULL;
 		switch_core_destroy_memory_pool(&pool);
@@ -863,8 +918,7 @@
 			switch_uuid_get(&uuid);
 			switch_uuid_format(acs->uuid_str, &uuid);
 		}
-		switch_snprintf(reply, reply_len, "+OK Job-UUID: %s", acs->uuid_str);
-
+		switch_snprintf(reply, reply_len, "~Reply-Text: +OK Job-UUID: %s\nJob-UUID: %s\n\n", acs->uuid_str, acs->uuid_str);
 		switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool);
 
 		return SWITCH_STATUS_SUCCESS;
@@ -1133,7 +1187,7 @@
 		switch_caller_profile_event_set_data(switch_channel_get_caller_profile(channel), "Channel", call_event);
 		switch_channel_event_set_data(channel, call_event);
 		switch_event_add_header(call_event, SWITCH_STACK_BOTTOM, "Content-Type", "command/reply");
-
+		switch_event_add_header(call_event, SWITCH_STACK_BOTTOM, "Reply-Text", "+OK\n");
 		switch_event_add_header(call_event, SWITCH_STACK_BOTTOM, "Socket-Mode", switch_test_flag(listener, LFLAG_ASYNC) ? "async" : "static");
 		switch_event_add_header(call_event, SWITCH_STACK_BOTTOM, "Control", switch_test_flag(listener, LFLAG_FULL) ? "full" : "single-channel");
 
@@ -1167,7 +1221,11 @@
 				goto done;
 			}
 			if (*reply != '\0') {
-				switch_snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
+				if (*reply == '~') {
+					switch_snprintf(buf, sizeof(buf), "Content-Type: command/reply\n%s", reply + 1);
+				} else {
+					switch_snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
+				}
 				len = strlen(buf);
 				switch_socket_send(listener->sock, buf, &len);
 			}
@@ -1196,7 +1254,11 @@
 		}
 
 		if (*reply != '\0') {
-			switch_snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
+			if (*reply == '~') {
+				switch_snprintf(buf, sizeof(buf), "Content-Type: command/reply\n%s", reply + 1);
+			} else {
+				switch_snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
+			}
 			len = strlen(buf);
 			switch_socket_send(listener->sock, buf, &len);
 		}
@@ -1340,12 +1402,12 @@
 
 	listen_list.ready = 1;
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	switch_log_bind_logger(socket_logger, SWITCH_LOG_DEBUG);
+	switch_log_bind_logger(socket_logger, SWITCH_LOG_DEBUG, SWITCH_FALSE);
 
 
 	for (;;) {
@@ -1412,5 +1474,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	Mon Aug  4 21:29:58 2008
@@ -48,6 +48,7 @@
 
 static rc_handle *my_radius_init(void)
 {
+	int i = 0;
 	rc_handle *rad_config;
 
 	rad_config = rc_new();
@@ -81,7 +82,7 @@
 
 	/* Add the module configs to initialize rad_config */
 
-	for (int i = 0; i < SERVER_MAX && my_servers[i][0] != '\0'; i++) {
+	for (i = 0; i < SERVER_MAX && my_servers[i][0] != '\0'; i++) {
 		if (rc_add_config(rad_config, "acctserver", my_servers[i], cf, 0) != 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting acctserver = %s failed\n", my_servers[i]);
 			rc_destroy(rad_config);
@@ -604,6 +605,7 @@
 	switch_xml_t cfg, xml, settings, param;
 
 	int num_servers = 0;
+	int i = 0;
 
 	my_timeout = "5";
 	my_retries = "3";
@@ -611,7 +613,7 @@
 	strncpy(my_seqfile, "/var/run/radius.seq", PATH_MAX - 1);
 	strncpy(my_dictionary, "/usr/local/freeswitch/conf/radius/dictionary", PATH_MAX - 1);
 
-	for (int i = 0; i < SERVER_MAX; i++) {
+	for (i = 0; i < SERVER_MAX; i++) {
 		my_servers[i][0] = '\0';
 	}
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c	Mon Aug  4 21:29:58 2008
@@ -46,6 +46,8 @@
 	sw_discovery discovery;
 	sw_discovery_publish_id disc_id;
 	switch_mutex_t *zc_lock;
+	switch_event_node_t *publish_node;
+	switch_event_node_t *unpublish_node;
 } globals;
 
 
@@ -218,12 +220,12 @@
 					return SWITCH_STATUS_MEMERR;
 				}
 			} else if (!strcasecmp(var, "publish") && !strcasecmp(val, "yes")) {
-				if (switch_event_bind((char *) modname, SWITCH_EVENT_PUBLISH, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+				if (switch_event_bind_removable(modname, SWITCH_EVENT_PUBLISH, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL, &globals.publish_node) != SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 					return SWITCH_STATUS_GENERR;
 				}
 
-				if (switch_event_bind((char *) modname, SWITCH_EVENT_UNPUBLISH, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+				if (switch_event_bind_removable(modname, SWITCH_EVENT_UNPUBLISH, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL, &globals.unpublish_node) != SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 					return SWITCH_STATUS_GENERR;
 				}
@@ -248,6 +250,12 @@
 		RUNNING = -1;
 		switch_yield(100000);
 	}
+
+	switch_event_unbind(&globals.publish_node);
+	switch_event_unbind(&globals.unpublish_node);
+	switch_event_free_subclass(MY_EVENT_PUBLISH);
+	switch_event_free_subclass(MY_EVENT_UNPUBLISH);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -265,10 +273,6 @@
 		return SWITCH_STATUS_TERM;
 	}
 
-	if (load_config() != SWITCH_STATUS_SUCCESS) {
-		return SWITCH_STATUS_TERM;
-	}
-
 	if (switch_event_reserve_subclass(MY_EVENT_PUBLISH) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");
 		return SWITCH_STATUS_GENERR;
@@ -279,6 +283,10 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
+	if (load_config() != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_TERM;
+	}
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -309,5 +317,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c	Mon Aug  4 21:29:58 2008
@@ -75,6 +75,8 @@
 	switch_mutex_t *mutex;
 	switch_memory_pool_t *pool;
 	int shuffle;
+	switch_thread_rwlock_t *rwlock;
+	int ready;
 };
 
 typedef struct local_stream_source local_stream_source_t;
@@ -115,9 +117,18 @@
 		skip = do_rand();
 	}
 
+	switch_thread_rwlock_create(&source->rwlock, source->pool);
+	
+	if (RUNNING) {
+		switch_mutex_lock(globals.mutex);
+		switch_core_hash_insert(globals.source_hash, source->name, source);
+		switch_mutex_unlock(globals.mutex);
+		source->ready = 1;
+	}
+
 	while (RUNNING) {
 		const char *fname;
-
+		
 		if (switch_dir_open(&source->dir_handle, source->location, source->pool) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", source->location);
 			goto done;
@@ -229,6 +240,14 @@
 	}
 
   done:
+	source->ready = 0;
+	switch_mutex_lock(globals.mutex);
+	switch_core_hash_delete(globals.source_hash, source->name);
+	switch_mutex_unlock(globals.mutex);
+
+	switch_thread_rwlock_wrlock(source->rwlock);
+	switch_thread_rwlock_unlock(source->rwlock);
+	
 	switch_buffer_destroy(&audio_buffer);
 
 	if (fd > -1) {
@@ -260,6 +279,11 @@
 	} else {
 		source = switch_core_hash_find(globals.source_hash, path);
 	}
+	if (source) {
+		if (switch_thread_rwlock_tryrdlock(source->rwlock) != SWITCH_STATUS_SUCCESS) {
+			source = NULL;
+		}
+	}
 	switch_mutex_unlock(globals.mutex);
 
 	if (!source) {
@@ -326,7 +350,8 @@
 	context->source->total--;
 	switch_mutex_unlock(context->source->mutex);
 	switch_buffer_destroy(&context->audio_buffer);
-
+	switch_thread_rwlock_unlock(context->source->rwlock);
+	
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -336,6 +361,11 @@
 	switch_size_t bytes = 0;
 	size_t need = *len * 2;
 
+	if (!context->source->ready) {
+		*len = 0;
+		return SWITCH_STATUS_FALSE;
+	}
+
 	switch_mutex_lock(context->audio_mutex);
 	if ((bytes = switch_buffer_read(context->audio_buffer, data, need))) {
 		*len = bytes / 2;
@@ -431,8 +461,6 @@
 
 		source->samples = switch_samples_per_frame(source->rate, source->interval);
 
-		switch_core_hash_insert(globals.source_hash, source->name, source);
-
 		switch_mutex_init(&source->mutex, SWITCH_MUTEX_NESTED, source->pool);
 
 		switch_threadattr_create(&thd_attr, source->pool);
@@ -482,5 +510,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_native_file/mod_native_file.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_native_file/mod_native_file.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_native_file/mod_native_file.c	Mon Aug  4 21:29:58 2008
@@ -132,7 +132,7 @@
 
 /* Registration */
 
-static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
+static char *supported_formats[SWITCH_MAX_CODECS + 1] = { 0 };
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_native_file_load)
 {
@@ -170,5 +170,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/decode_i386.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/decode_i386.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/decode_i386.c	Mon Aug  4 21:29:58 2008
@@ -81,7 +81,7 @@
 
 	{
 		register int j;
-		real *window = decwin + 16 - bo1;
+		real *window = (mp->decwin) + 16 - bo1;
 
 		for (j = 16; j; j--, b0 += 0x10, window += 0x20, samples += step) {
 			real sum;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/interface.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/interface.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/interface.c	Mon Aug  4 21:29:58 2008
@@ -13,7 +13,7 @@
 }
 
 
-BOOL InitMP3(struct mpstr *mp, long outscale, int samplerate)
+MPGLIB_BOOL InitMP3(struct mpstr *mp, long outscale, int samplerate)
 {
 	/* quiet 4096 med 8192 */
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/layer3.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/layer3.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/layer3.c	Mon Aug  4 21:29:58 2008
@@ -32,8 +32,11 @@
 	short shortDiff[13];
 };
 
-
+#ifndef _WIN32
 static inline real find_pow(int i)
+#else
+static real find_pow(int i)
+#endif
 {
 
 	return (i > 0 && i < 8207) ? __ispow[i] : 1;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c	Mon Aug  4 21:29:58 2008
@@ -85,8 +85,15 @@
 		}
 
 		if (context->fp) {
-			unsigned char mp3buffer[1024];
+			unsigned char mp3buffer[8192];
 			int len;
+			int16_t blank[2048] = {0}, *r = NULL;
+			
+			len = lame_encode_buffer(context->gfp, blank, r, sizeof(blank) / 2, mp3buffer, sizeof(mp3buffer));
+
+			if (len) {
+				ret = fwrite(mp3buffer, 1, len, context->fp);
+			}
 
 			while ((len = lame_encode_flush(context->gfp, mp3buffer, sizeof(mp3buffer))) > 0) {
 				ret = fwrite(mp3buffer, 1, len, context->fp);
@@ -94,7 +101,7 @@
 					break;
 				}
 			}
-
+			
 			lame_mp3_tags_fid(context->gfp, context->fp);
 
 			fclose(context->fp);
@@ -241,6 +248,7 @@
 		x = 0;
 
 		if (inlen < bytes) {
+			bytes = inlen;
 			done = 1;
 		}
 
@@ -471,6 +479,12 @@
 {
 	shout_context_t *context = (shout_context_t *) obj;
 
+	if (!context->lame_ready) {
+		lame_init_params(context->gfp);
+		lame_print_config(context->gfp);
+		context->lame_ready = 1;
+	}
+
 	while (!context->err && context->thread_running) {
 		unsigned char mp3buf[8192] = "";
 		unsigned char audio[8192] = "";

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mpg123.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mpg123.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mpg123.h	Mon Aug  4 21:29:58 2008
@@ -1,3 +1,6 @@
+#ifndef MPG123_DEFINED
+#define MPG123_DEFINED
+
 #include        <stdio.h>
 #include        <string.h>
 #include        <signal.h>
@@ -127,3 +130,5 @@
 extern long freqs[9];
 extern struct parameter param;
 extern real *pnts[5];
+
+#endif

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mpglib.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mpglib.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mpglib.h	Mon Aug  4 21:29:58 2008
@@ -5,6 +5,10 @@
 #endif
 #define NTOM_MUL (32768)
 
+#ifdef _WIN32
+#include "mpg123.h"
+#endif
+
 struct buf {
 	unsigned char *pnt;
 	long size;
@@ -44,7 +48,7 @@
 	unsigned long ntom_step;
 };
 
-#define BOOL int
+#define MPGLIB_BOOL int
 
 #define MP3_ERR -1
 #define MP3_OK  0
@@ -52,7 +56,7 @@
 #define MP3_TOOSMALL 2
 
 void InitMP3Constants(void);
-BOOL InitMP3(struct mpstr *mp, long outscale, int samplerate);
+MPGLIB_BOOL InitMP3(struct mpstr *mp, long outscale, int samplerate);
 int decodeMP3(struct mpstr *mp, char *inmemory, int inmemsize, char *outmemory, int outmemsize, int *done);
 void ExitMP3(struct mpstr *mp);
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c	Mon Aug  4 21:29:58 2008
@@ -420,5 +420,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_tone_stream/mod_tone_stream.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_tone_stream/mod_tone_stream.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_tone_stream/mod_tone_stream.c	Mon Aug  4 21:29:58 2008
@@ -35,6 +35,72 @@
 SWITCH_MODULE_DEFINITION(mod_tone_stream, mod_tone_stream_load, NULL, NULL);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_tone_stream_shutdown);
 
+struct silence_handle {
+	int32_t samples;
+	int silence;
+};
+
+static switch_status_t silence_stream_file_open(switch_file_handle_t *handle, const char *path)
+{
+
+	struct silence_handle *sh;
+	int ms;
+
+	sh = switch_core_alloc(handle->memory_pool, sizeof(*sh));
+
+	ms = atoi(path);
+
+	if (ms > 0) {
+		char *p;
+
+		sh->samples = (handle->samplerate / 1000) * ms;
+		
+		if ((p = strchr(path, ','))) {
+			p++;
+			ms = atoi(p);
+			if (ms > 0) {
+				sh->silence = ms;
+			}
+		}
+
+		handle->private_info = sh;
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid format!\n");
+	
+	return SWITCH_STATUS_GENERR;
+}
+
+static switch_status_t silence_stream_file_close(switch_file_handle_t *handle)
+{
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t silence_stream_file_read(switch_file_handle_t *handle, void *data, size_t *len)
+{
+	struct silence_handle *sh = handle->private_info;
+	
+	if (sh->samples <= 0) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (*len > (size_t)sh->samples) {
+		*len = sh->samples;
+	}
+
+	sh->samples -= *len;
+	
+	if (sh->silence) {
+		switch_generate_sln_silence((int16_t *) data, *len, sh->silence);
+	} else {
+		memset(data, 0, *len);
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
 static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map)
 {
 	switch_buffer_t *audio_buffer = ts->user_data;
@@ -130,11 +196,13 @@
 /* Registration */
 
 static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
+static char *silence_supported_formats[SWITCH_MAX_CODECS] = { 0 };
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_tone_stream_load)
 {
 	switch_file_interface_t *file_interface;
 	supported_formats[0] = "tone_stream";
+	silence_supported_formats[0] = "silence_stream";
 
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
@@ -144,6 +212,13 @@
 	file_interface->file_close = tone_stream_file_close;
 	file_interface->file_read = tone_stream_file_read;
 
+	file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
+	file_interface->interface_name = modname;
+	file_interface->extens = silence_supported_formats;
+	file_interface->file_open = silence_stream_file_open;
+	file_interface->file_close = silence_stream_file_close;
+	file_interface->file_read = silence_stream_file_read;
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -161,5 +236,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java	Mon Aug  4 21:29:58 2008
@@ -84,6 +84,30 @@
     return new SWIGTYPE_p_switch_channel_state_t(freeswitchJNI.CoreSession_hook_state_get(swigCPtr, this), true);
   }
 
+  public void setUuid(String value) {
+    freeswitchJNI.CoreSession_uuid_set(swigCPtr, this, value);
+  }
+
+  public String getUuid() {
+    return freeswitchJNI.CoreSession_uuid_get(swigCPtr, this);
+  }
+
+  public void setTts_name(String value) {
+    freeswitchJNI.CoreSession_tts_name_set(swigCPtr, this, value);
+  }
+
+  public String getTts_name() {
+    return freeswitchJNI.CoreSession_tts_name_get(swigCPtr, this);
+  }
+
+  public void setVoice_name(String value) {
+    freeswitchJNI.CoreSession_voice_name_set(swigCPtr, this, value);
+  }
+
+  public String getVoice_name() {
+    return freeswitchJNI.CoreSession_voice_name_get(swigCPtr, this);
+  }
+
   public int answer() {
     return freeswitchJNI.CoreSession_answer(swigCPtr, this);
   }
@@ -182,7 +206,11 @@
   }
 
   public String getDigits(int maxdigits, String terminators, int timeout) {
-    return freeswitchJNI.CoreSession_getDigits(swigCPtr, this, maxdigits, terminators, timeout);
+    return freeswitchJNI.CoreSession_getDigits__SWIG_0(swigCPtr, this, maxdigits, terminators, timeout);
+  }
+
+  public String getDigits(int maxdigits, String terminators, int timeout, int interdigit) {
+    return freeswitchJNI.CoreSession_getDigits__SWIG_1(swigCPtr, this, maxdigits, terminators, timeout, interdigit);
   }
 
   public int transfer(String extensions, String dialplan, String context) {
@@ -205,6 +233,10 @@
     return freeswitchJNI.CoreSession_streamFile__SWIG_1(swigCPtr, this, file);
   }
 
+  public int sleep(int ms) {
+    return freeswitchJNI.CoreSession_sleep(swigCPtr, this, ms);
+  }
+
   public int flushEvents() {
     return freeswitchJNI.CoreSession_flushEvents(swigCPtr, this);
   }
@@ -225,6 +257,18 @@
     return freeswitchJNI.CoreSession_ready(swigCPtr, this);
   }
 
+  public boolean answered() {
+    return freeswitchJNI.CoreSession_answered(swigCPtr, this);
+  }
+
+  public boolean mediaReady() {
+    return freeswitchJNI.CoreSession_mediaReady(swigCPtr, this);
+  }
+
+  public void waitForAnswer(CoreSession calling_session) {
+    freeswitchJNI.CoreSession_waitForAnswer(swigCPtr, this, CoreSession.getCPtr(calling_session), calling_session);
+  }
+
   public void execute(String app, String data) {
     freeswitchJNI.CoreSession_execute__SWIG_0(swigCPtr, this, app, data);
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java	Mon Aug  4 21:29:58 2008
@@ -32,6 +32,13 @@
   public final static native int S_HUP_get();
   public final static native int S_FREE_get();
   public final static native int S_RDLOCK_get();
+  public final static native void DTMF_digit_set(long jarg1, DTMF jarg1_, char jarg2);
+  public final static native char DTMF_digit_get(long jarg1, DTMF jarg1_);
+  public final static native void DTMF_duration_set(long jarg1, DTMF jarg1_, long jarg2);
+  public final static native long DTMF_duration_get(long jarg1, DTMF jarg1_);
+  public final static native long new_DTMF__SWIG_0(char jarg1, long jarg2);
+  public final static native long new_DTMF__SWIG_1(char jarg1);
+  public final static native void delete_DTMF(long jarg1);
   public final static native long new_Stream__SWIG_0();
   public final static native long new_Stream__SWIG_1(long jarg1);
   public final static native void delete_Stream(long jarg1);
@@ -59,6 +66,23 @@
   public final static native boolean Event_addHeader(long jarg1, Event jarg1_, String jarg2, String jarg3);
   public final static native boolean Event_delHeader(long jarg1, Event jarg1_, String jarg2);
   public final static native boolean Event_fire(long jarg1, Event jarg1_);
+  public final static native void EventConsumer_events_set(long jarg1, EventConsumer jarg1_, long jarg2);
+  public final static native long EventConsumer_events_get(long jarg1, EventConsumer jarg1_);
+  public final static native void EventConsumer_e_event_id_set(long jarg1, EventConsumer jarg1_, long jarg2);
+  public final static native long EventConsumer_e_event_id_get(long jarg1, EventConsumer jarg1_);
+  public final static native void EventConsumer_node_set(long jarg1, EventConsumer jarg1_, long jarg2);
+  public final static native long EventConsumer_node_get(long jarg1, EventConsumer jarg1_);
+  public final static native void EventConsumer_e_callback_set(long jarg1, EventConsumer jarg1_, String jarg2);
+  public final static native String EventConsumer_e_callback_get(long jarg1, EventConsumer jarg1_);
+  public final static native void EventConsumer_e_subclass_name_set(long jarg1, EventConsumer jarg1_, String jarg2);
+  public final static native String EventConsumer_e_subclass_name_get(long jarg1, EventConsumer jarg1_);
+  public final static native void EventConsumer_e_cb_arg_set(long jarg1, EventConsumer jarg1_, String jarg2);
+  public final static native String EventConsumer_e_cb_arg_get(long jarg1, EventConsumer jarg1_);
+  public final static native long new_EventConsumer__SWIG_0(String jarg1, String jarg2);
+  public final static native long new_EventConsumer__SWIG_1(String jarg1);
+  public final static native void delete_EventConsumer(long jarg1);
+  public final static native long EventConsumer_pop__SWIG_0(long jarg1, EventConsumer jarg1_, int jarg2);
+  public final static native long EventConsumer_pop__SWIG_1(long jarg1, EventConsumer jarg1_);
   public final static native void delete_CoreSession(long jarg1);
   public final static native void CoreSession_session_set(long jarg1, CoreSession jarg1_, long jarg2);
   public final static native long CoreSession_session_get(long jarg1, CoreSession jarg1_);
@@ -72,6 +96,12 @@
   public final static native long CoreSession_cb_state_get(long jarg1, CoreSession jarg1_);
   public final static native void CoreSession_hook_state_set(long jarg1, CoreSession jarg1_, long jarg2);
   public final static native long CoreSession_hook_state_get(long jarg1, CoreSession jarg1_);
+  public final static native void CoreSession_uuid_set(long jarg1, CoreSession jarg1_, String jarg2);
+  public final static native String CoreSession_uuid_get(long jarg1, CoreSession jarg1_);
+  public final static native void CoreSession_tts_name_set(long jarg1, CoreSession jarg1_, String jarg2);
+  public final static native String CoreSession_tts_name_get(long jarg1, CoreSession jarg1_);
+  public final static native void CoreSession_voice_name_set(long jarg1, CoreSession jarg1_, String jarg2);
+  public final static native String CoreSession_voice_name_get(long jarg1, CoreSession jarg1_);
   public final static native int CoreSession_answer(long jarg1, CoreSession jarg1_);
   public final static native int CoreSession_preAnswer(long jarg1, CoreSession jarg1_);
   public final static native void CoreSession_hangup__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2);
@@ -96,17 +126,22 @@
   public final static native int CoreSession_speak(long jarg1, CoreSession jarg1_, String jarg2);
   public final static native void CoreSession_set_tts_parms(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
   public final static native int CoreSession_collectDigits(long jarg1, CoreSession jarg1_, int jarg2);
-  public final static native String CoreSession_getDigits(long jarg1, CoreSession jarg1_, int jarg2, String jarg3, int jarg4);
+  public final static native String CoreSession_getDigits__SWIG_0(long jarg1, CoreSession jarg1_, int jarg2, String jarg3, int jarg4);
+  public final static native String CoreSession_getDigits__SWIG_1(long jarg1, CoreSession jarg1_, int jarg2, String jarg3, int jarg4, int jarg5);
   public final static native int CoreSession_transfer(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, String jarg4);
   public final static native String CoreSession_read(long jarg1, CoreSession jarg1_, int jarg2, int jarg3, String jarg4, int jarg5, String jarg6);
   public final static native String CoreSession_playAndGetDigits(long jarg1, CoreSession jarg1_, int jarg2, int jarg3, int jarg4, int jarg5, String jarg6, String jarg7, String jarg8, String jarg9);
   public final static native int CoreSession_streamFile__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2, int jarg3);
   public final static native int CoreSession_streamFile__SWIG_1(long jarg1, CoreSession jarg1_, String jarg2);
+  public final static native int CoreSession_sleep(long jarg1, CoreSession jarg1_, int jarg2);
   public final static native int CoreSession_flushEvents(long jarg1, CoreSession jarg1_);
   public final static native int CoreSession_flushDigits(long jarg1, CoreSession jarg1_);
   public final static native int CoreSession_setAutoHangup(long jarg1, CoreSession jarg1_, boolean jarg2);
   public final static native void CoreSession_setHangupHook(long jarg1, CoreSession jarg1_, long jarg2);
   public final static native boolean CoreSession_ready(long jarg1, CoreSession jarg1_);
+  public final static native boolean CoreSession_answered(long jarg1, CoreSession jarg1_);
+  public final static native boolean CoreSession_mediaReady(long jarg1, CoreSession jarg1_);
+  public final static native void CoreSession_waitForAnswer(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_);
   public final static native void CoreSession_execute__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
   public final static native void CoreSession_execute__SWIG_1(long jarg1, CoreSession jarg1_, String jarg2);
   public final static native void CoreSession_sendEvent(long jarg1, CoreSession jarg1_, long jarg2, Event jarg2_);

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/switch_swig_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/switch_swig_wrap.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/switch_swig_wrap.cpp	Mon Aug  4 21:29:58 2008
@@ -643,6 +643,117 @@
 }
 
 
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_DTMF_1digit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jchar jarg2) {
+  DTMF *arg1 = (DTMF *) 0 ;
+  char arg2 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(DTMF **)&jarg1; 
+  arg2 = (char)jarg2; 
+  if (arg1) (arg1)->digit = arg2;
+  
+}
+
+
+SWIGEXPORT jchar JNICALL Java_org_freeswitch_swig_freeswitchJNI_DTMF_1digit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jchar jresult = 0 ;
+  DTMF *arg1 = (DTMF *) 0 ;
+  char result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(DTMF **)&jarg1; 
+  result = (char) ((arg1)->digit);
+  jresult = (jchar)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_DTMF_1duration_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t arg2 ;
+  uint32_t *argp2 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(DTMF **)&jarg1; 
+  argp2 = *(uint32_t **)&jarg2; 
+  if (!argp2) {
+    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null uint32_t");
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->duration = arg2;
+  
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_DTMF_1duration_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jlong jresult = 0 ;
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(DTMF **)&jarg1; 
+  result =  ((arg1)->duration);
+  *(uint32_t **)&jresult = new uint32_t((uint32_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1DTMF_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jchar jarg1, jlong jarg2) {
+  jlong jresult = 0 ;
+  char arg1 ;
+  uint32_t arg2 ;
+  DTMF *result = 0 ;
+  uint32_t *argp2 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = (char)jarg1; 
+  argp2 = *(uint32_t **)&jarg2; 
+  if (!argp2) {
+    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null uint32_t");
+    return 0;
+  }
+  arg2 = *argp2; 
+  result = (DTMF *)new DTMF(arg1,arg2);
+  *(DTMF **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1DTMF_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jchar jarg1) {
+  jlong jresult = 0 ;
+  char arg1 ;
+  DTMF *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = (char)jarg1; 
+  result = (DTMF *)new DTMF(arg1);
+  *(DTMF **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1DTMF(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+  DTMF *arg1 = (DTMF *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = *(DTMF **)&jarg1; 
+  delete arg1;
+  
+}
+
+
 SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1Stream_1_1SWIG_10(JNIEnv *jenv, jclass jcls) {
   jlong jresult = 0 ;
   Stream *result = 0 ;
@@ -1113,6 +1224,310 @@
 }
 
 
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1events_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_queue_t *arg2 = (switch_queue_t *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  arg2 = *(switch_queue_t **)&jarg2; 
+  if (arg1) (arg1)->events = arg2;
+  
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1events_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jlong jresult = 0 ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_queue_t *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  result = (switch_queue_t *) ((arg1)->events);
+  *(switch_queue_t **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1event_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_types_t arg2 ;
+  switch_event_types_t *argp2 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  argp2 = *(switch_event_types_t **)&jarg2; 
+  if (!argp2) {
+    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null switch_event_types_t");
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->e_event_id = arg2;
+  
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1event_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jlong jresult = 0 ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_types_t result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  result =  ((arg1)->e_event_id);
+  *(switch_event_types_t **)&jresult = new switch_event_types_t((switch_event_types_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1node_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_node_t *arg2 = (switch_event_node_t *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  arg2 = *(switch_event_node_t **)&jarg2; 
+  if (arg1) (arg1)->node = arg2;
+  
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1node_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jlong jresult = 0 ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_node_t *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  result = (switch_event_node_t *) ((arg1)->node);
+  *(switch_event_node_t **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1callback_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return ;
+  }
+  {
+    if (arg1->e_callback) delete [] arg1->e_callback;
+    if (arg2) {
+      arg1->e_callback = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->e_callback, (const char *)arg2);
+    } else {
+      arg1->e_callback = 0;
+    }
+  }
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1callback_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  result = (char *) ((arg1)->e_callback);
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1subclass_1name_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return ;
+  }
+  {
+    if (arg1->e_subclass_name) delete [] arg1->e_subclass_name;
+    if (arg2) {
+      arg1->e_subclass_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->e_subclass_name, (const char *)arg2);
+    } else {
+      arg1->e_subclass_name = 0;
+    }
+  }
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1subclass_1name_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  result = (char *) ((arg1)->e_subclass_name);
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1cb_1arg_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return ;
+  }
+  {
+    if (arg1->e_cb_arg) delete [] arg1->e_cb_arg;
+    if (arg2) {
+      arg1->e_cb_arg = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->e_cb_arg, (const char *)arg2);
+    } else {
+      arg1->e_cb_arg = 0;
+    }
+  }
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1cb_1arg_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  result = (char *) ((arg1)->e_cb_arg);
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1EventConsumer_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2) {
+  jlong jresult = 0 ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  EventConsumer *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = 0;
+  if (jarg1) {
+    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+    if (!arg1) return 0;
+  }
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2);
+  *(EventConsumer **)&jresult = result; 
+  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1EventConsumer_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jstring jarg1) {
+  jlong jresult = 0 ;
+  char *arg1 = (char *) 0 ;
+  EventConsumer *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = 0;
+  if (jarg1) {
+    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+    if (!arg1) return 0;
+  }
+  result = (EventConsumer *)new EventConsumer((char const *)arg1);
+  *(EventConsumer **)&jresult = result; 
+  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1EventConsumer(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = *(EventConsumer **)&jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1pop_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
+  jlong jresult = 0 ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  int arg2 ;
+  Event *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  arg2 = (int)jarg2; 
+  result = (Event *)(arg1)->pop(arg2);
+  *(Event **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1pop_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jlong jresult = 0 ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  Event *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(EventConsumer **)&jarg1; 
+  result = (Event *)(arg1)->pop();
+  *(Event **)&jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1CoreSession(JNIEnv *jenv, jclass jcls, jlong jarg1) {
   CoreSession *arg1 = (CoreSession *) 0 ;
   
@@ -1305,6 +1720,129 @@
 }
 
 
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1uuid_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return ;
+  }
+  {
+    if (arg1->uuid) delete [] arg1->uuid;
+    if (arg2) {
+      arg1->uuid = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->uuid, (const char *)arg2);
+    } else {
+      arg1->uuid = 0;
+    }
+  }
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1uuid_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  result = (char *) ((arg1)->uuid);
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1tts_1name_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return ;
+  }
+  {
+    if (arg1->tts_name) delete [] arg1->tts_name;
+    if (arg2) {
+      arg1->tts_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->tts_name, (const char *)arg2);
+    } else {
+      arg1->tts_name = 0;
+    }
+  }
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1tts_1name_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  result = (char *) ((arg1)->tts_name);
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1voice_1name_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return ;
+  }
+  {
+    if (arg1->voice_name) delete [] arg1->voice_name;
+    if (arg2) {
+      arg1->voice_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->voice_name, (const char *)arg2);
+    } else {
+      arg1->voice_name = 0;
+    }
+  }
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1voice_1name_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jstring jresult = 0 ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  result = (char *) ((arg1)->voice_name);
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  return jresult;
+}
+
+
 SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1answer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
   jint jresult = 0 ;
   CoreSession *arg1 = (CoreSession *) 0 ;
@@ -1850,7 +2388,7 @@
 }
 
 
-SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1getDigits(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3, jint jarg4) {
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1getDigits_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3, jint jarg4) {
   jstring jresult = 0 ;
   CoreSession *arg1 = (CoreSession *) 0 ;
   int arg2 ;
@@ -1876,6 +2414,34 @@
 }
 
 
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1getDigits_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3, jint jarg4, jint jarg5) {
+  jstring jresult = 0 ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  int arg5 ;
+  char *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return 0;
+  }
+  arg4 = (int)jarg4; 
+  arg5 = (int)jarg5; 
+  result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5);
+  if(result) jresult = jenv->NewStringUTF((const char *)result);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  return jresult;
+}
+
+
 SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1transfer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
   jint jresult = 0 ;
   CoreSession *arg1 = (CoreSession *) 0 ;
@@ -2044,6 +2610,23 @@
 }
 
 
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1sleep(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
+  jint jresult = 0 ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  arg2 = (int)jarg2; 
+  result = (int)(arg1)->sleep(arg2);
+  jresult = (jint)result; 
+  return jresult;
+}
+
+
 SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1flushEvents(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
   jint jresult = 0 ;
   CoreSession *arg1 = (CoreSession *) 0 ;
@@ -2119,6 +2702,50 @@
 }
 
 
+SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1answered(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jboolean jresult = 0 ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  result = (bool)(arg1)->answered();
+  jresult = (jboolean)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1mediaReady(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jboolean jresult = 0 ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  result = (bool)(arg1)->mediaReady();
+  jresult = (jboolean)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1waitForAnswer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  (void)jarg2_;
+  arg1 = *(CoreSession **)&jarg1; 
+  arg2 = *(CoreSession **)&jarg2; 
+  (arg1)->waitForAnswer(arg2);
+}
+
+
 SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1execute_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
   CoreSession *arg1 = (CoreSession *) 0 ;
   char *arg2 = (char *) 0 ;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/Makefile	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/Makefile	Mon Aug  4 21:29:58 2008
@@ -13,6 +13,8 @@
 $(LIBLUA_A):
 	cd lua && $(MAKE) CC="$(CC)" CFLAGS="$(ALL_CFLAGS) -DLUA_USE_LINUX -w" liblua.a
 
+reswig: swigclean mod_lua_wrap.cpp
+
 luaclean:
 	cd lua && $(MAKE) clean
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.cpp	Mon Aug  4 21:29:58 2008
@@ -9,7 +9,7 @@
 	hh = mark = 0;
 }
 
-Session::Session(char *uuid):CoreSession(uuid)
+Session::Session(char *nuuid, CoreSession *a_leg):CoreSession(nuuid, a_leg)
 {
 	cb_function = cb_arg = hangup_func_str = hangup_func_arg = NULL;
 	hh = mark = 0;
@@ -50,7 +50,14 @@
 
 void Session::setLUA(lua_State * state)
 {
+	sanity_check_noreturn;
+
 	L = state;
+	if (uuid) {
+		lua_setglobal(L, uuid);
+		lua_getfield(L, LUA_GLOBALSINDEX, uuid);
+	}
+
 }
 
 lua_State *Session::getLUA()
@@ -84,7 +91,7 @@
 {
 	if (hh && !mark) {
 		const char *err = NULL;
-		int arg_count = 1;
+		int arg_count = 2;
 		mark++;
 
 		if (!getLUA()) {
@@ -92,6 +99,7 @@
 		}
 
 		lua_getfield(L, LUA_GLOBALSINDEX, (char *) hangup_func_str);
+		lua_getfield(L, LUA_GLOBALSINDEX, uuid);
 
 		lua_pushstring(L, hook_state == CS_HANGUP ? "hangup" : "transfer");
 
@@ -180,9 +188,11 @@
 		{
 			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
 			char str[2] = "";
-			int arg_count = 2;
+			int arg_count = 3;
 
 			lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_function);
+			lua_getfield(L, LUA_GLOBALSINDEX, uuid);
+
 			lua_pushstring(L, "dtmf");
 
 			lua_newtable(L);
@@ -210,9 +220,11 @@
 	case SWITCH_INPUT_TYPE_EVENT:
 		{
 			switch_event_t *event = (switch_event_t *) input;
-			int arg_count = 2;
+			int arg_count = 3;
+
 
 			lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_function);
+			lua_getfield(L, LUA_GLOBALSINDEX, uuid);
 			lua_pushstring(L, "event");
 			mod_lua_conjure_event(L, event, "__Input_Event__", 1);
 			lua_getfield(L, LUA_GLOBALSINDEX, "__Input_Event__");
@@ -222,8 +234,7 @@
 				arg_count++;
 			}
 
-			lua_call(L, 2, 1);
-
+			lua_call(L, arg_count, 1);
 			ret = lua_tostring(L, -1);
 			lua_pop(L, 1);
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.h	Mon Aug  4 21:29:58 2008
@@ -20,7 +20,7 @@
 	int mark;
  public:
     Session();
-    Session(char *uuid);
+    Session(char *uuid, CoreSession *a_leg = NULL);
     Session(switch_core_session_t *session);
     ~Session();        
 	
@@ -29,7 +29,7 @@
 	virtual void check_hangup_hook();
 
 	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
-	void setInputCallback(char *cbfunc, char *funcargs);
+	void setInputCallback(char *cbfunc, char *funcargs = NULL);
 	void setHangupHook(char *func, char *arg = NULL);
 	bool ready();
 	

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/hack.diff
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/hack.diff	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/hack.diff	Mon Aug  4 21:29:58 2008
@@ -1,6 +1,6 @@
---- mod_lua_wrap.cpp	2008-05-11 20:03:58.000000000 -0400
-+++ mod_lua_wrap2.cpp	2008-05-11 20:05:08.000000000 -0400
-@@ -5158,7 +5158,7 @@
+--- mod_lua_wrap.cpp	2008-07-16 16:58:58.000000000 -0400
++++ old.cpp	2008-07-16 16:58:42.000000000 -0400
+@@ -6731,7 +6731,7 @@
    SWIG_check_num_args("LUA::Session",0,0)
    result = (LUA::Session *)new LUA::Session();
    SWIG_arg=0;
@@ -9,7 +9,16 @@
    return SWIG_arg;
    
    if(0) SWIG_fail;
-@@ -5179,7 +5179,7 @@
+@@ -6759,7 +6759,7 @@
+   
+   result = (LUA::Session *)new LUA::Session(arg1,arg2);
+   SWIG_arg=0;
+-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; 
++  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
+   return SWIG_arg;
+   
+   if(0) SWIG_fail;
+@@ -6780,7 +6780,7 @@
    arg1 = (char *)lua_tostring(L, 1);
    result = (LUA::Session *)new LUA::Session(arg1);
    SWIG_arg=0;
@@ -18,7 +27,7 @@
    return SWIG_arg;
    
    if(0) SWIG_fail;
-@@ -5204,7 +5204,7 @@
+@@ -6805,7 +6805,7 @@
    
    result = (LUA::Session *)new LUA::Session(arg1);
    SWIG_arg=0;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp	Mon Aug  4 21:29:58 2008
@@ -38,14 +38,18 @@
 #include <lualib.h>
 #include "mod_lua_extra.h"
 SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load);
-SWITCH_MODULE_DEFINITION(mod_lua, mod_lua_load, NULL, NULL);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lua_shutdown);
+
+SWITCH_MODULE_DEFINITION(mod_lua, mod_lua_load, mod_lua_shutdown, NULL);
 
 static struct {
 	switch_memory_pool_t *pool;
 	char *xml_handler;
+	switch_event_node_t *node;
 } globals;
 
 int luaopen_freeswitch(lua_State * L);
+int lua_thread(const char *text);
 
 static int panic(lua_State * L)
 {
@@ -251,7 +255,7 @@
 
 static switch_status_t do_config(void)
 {
-	char *cf = "lua.conf";
+	const char *cf = "lua.conf";
 	switch_xml_t cfg, xml, settings, param;
 
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
@@ -271,6 +275,10 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, val);
 					switch_xml_bind_search_function(lua_fetch, switch_xml_parse_section_string(val), NULL);
 				}
+			} else if (!strcmp(var, "startup-script")) {
+				if (val) {
+					lua_thread(val);
+				}
 			}
 		}
 	}
@@ -363,11 +371,38 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static void message_query_handler(switch_event_t *event)
+{
+	char *account = switch_event_get_header(event, "message-account");
+
+	if (account) {
+		char *path, *cmd;
+
+		path = switch_mprintf("%s%smwi.lua", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
+		switch_assert(path != NULL);
+
+		if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
+			cmd = switch_mprintf("%s %s", path, account);
+			switch_assert(cmd != NULL);
+			lua_thread(cmd);
+			switch_safe_free(cmd);
+		}
+
+		switch_safe_free(path);
+	}
+}
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
 {
 	switch_api_interface_t *api_interface;
 	switch_application_interface_t *app_interface;
 
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL, &globals.node)
+		!= SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -384,6 +419,13 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lua_shutdown)
+{
+	switch_event_unbind(&globals.node);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
 SWITCH_END_EXTERN_C
 /* For Emacs:
  * Local Variables:
@@ -393,5 +435,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp	Mon Aug  4 21:29:58 2008
@@ -10,35 +10,22 @@
 
 
 #ifdef __cplusplus
-template < typename T > class SwigValueWrapper {
-	T *tt;
-  public:
-  SwigValueWrapper():tt(0) {
-	}
-  SwigValueWrapper(const SwigValueWrapper < T > &rhs):tt(new T(*rhs.tt)) {
-	}
-	SwigValueWrapper(const T & t):tt(new T(t)) {
-	}
-	~SwigValueWrapper() {
-		delete tt;
-	}
-	SwigValueWrapper & operator=(const T & t) {
-		delete tt;
-		tt = new T(t);
-		return *this;
-	}
-	operator  T & () const {
-		return *tt;
-	} T *operator&() {
-		return tt;
-	}
-  private:
-	SwigValueWrapper & operator=(const SwigValueWrapper < T > &rhs);
+template<typename T> class SwigValueWrapper {
+    T *tt;
+public:
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
 };
 
-template < typename T > T SwigValueInit()
-{
-	return T();
+template <typename T> T SwigValueInit() {
+  return T();
 }
 #endif
 
@@ -73,14 +60,14 @@
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__))
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
 # else
-#   define SWIGUNUSED
+#   define SWIGUNUSED 
 # endif
 #endif
 
@@ -88,7 +75,7 @@
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
 # endif
 #endif
 
@@ -131,7 +118,7 @@
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif
+# endif 
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -275,10 +262,10 @@
 
 
  */
-#define SWIG_OK                    (0)
+#define SWIG_OK                    (0) 
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
 
 /* The CastRankLimit says how many bits are used for the cast rank */
 #define SWIG_CASTRANKLIMIT         (1 << 8)
@@ -305,18 +292,16 @@
 #  ifndef SWIG_TypeRank
 #    define SWIG_TypeRank             unsigned long
 #  endif
-#  ifndef SWIG_MAXCASTRANK		/* Default cast allowed */
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
 #    define SWIG_MAXCASTRANK          (2)
 #  endif
 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r)
-{
-	return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 }
-SWIGINTERNINLINE int SWIG_CheckState(int r)
-{
-	return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
 }
 #else /* no cast-rank mode */
 #  define SWIG_AddCast
@@ -332,38 +317,38 @@
 extern "C" {
 #endif
 
-	typedef void *(*swig_converter_func) (void *, int *);
-	typedef struct swig_type_info *(*swig_dycast_func) (void **);
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
 /* Structure to store information on one type */
-	typedef struct swig_type_info {
-		const char *name;		/* mangled name of this type */
-		const char *str;		/* human readable name of this type */
-		swig_dycast_func dcast;	/* dynamic cast function down a hierarchy */
-		struct swig_cast_info *cast;	/* linked list of types that can cast into this type */
-		void *clientdata;		/* language specific type data */
-		int owndata;			/* flag if the structure owns the clientdata */
-	} swig_type_info;
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
 
 /* Structure to store a type and conversion function used for casting */
-	typedef struct swig_cast_info {
-		swig_type_info *type;	/* pointer to type that is equivalent to this type */
-		swig_converter_func converter;	/* function to cast the void pointers */
-		struct swig_cast_info *next;	/* pointer to next cast in linked list */
-		struct swig_cast_info *prev;	/* pointer to the previous cast */
-	} swig_cast_info;
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
 
 /* Structure used to store module information
  * Each module generates one structure like this, and the runtime collects
  * all of these structures and stores them in a circularly linked list.*/
-	typedef struct swig_module_info {
-		swig_type_info **types;	/* Array of pointers to swig_type_info structures that are in this module */
-		size_t size;			/* Number of types in this module */
-		struct swig_module_info *next;	/* Pointer to next element in circularly linked list */
-		swig_type_info **type_initial;	/* Array of initially generated type structures */
-		swig_cast_info **cast_initial;	/* Array of initially generated casting structures */
-		void *clientdata;		/* Language specific module data */
-	} swig_module_info;
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
 
 /* 
   Compare two type names skipping the space characters, therefore
@@ -372,56 +357,54 @@
   Return 0 when the two name types are equivalent, as in
   strncmp, but skipping ' '.
 */
-	SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) {
-		for (; (f1 != l1) && (f2 != l2); ++f1, ++f2) {
-			while ((*f1 == ' ') && (f1 != l1))
-				++f1;
-			while ((*f2 == ' ') && (f2 != l2))
-				++f2;
-			if (*f1 != *f2)
-				return (*f1 > *f2) ? 1 : -1;
-		} return (int) ((l1 - f1) - (l2 - f2));
-	}
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if not equal, 1 if equal
 */
-	SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) {
-		int equiv = 0;
-		const char *te = tb + strlen(tb);
-		const char *ne = nb;
-		while (!equiv && *ne) {
-			for (nb = ne; *ne; ++ne) {
-				if (*ne == '|')
-					break;
-			}
-			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-			if (*ne)
-				++ne;
-		}
-		return equiv;
-	}
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 */
-	SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) {
-		int equiv = 0;
-		const char *te = tb + strlen(tb);
-		const char *ne = nb;
-		while (!equiv && *ne) {
-			for (nb = ne; *ne; ++ne) {
-				if (*ne == '|')
-					break;
-			}
-			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-			if (*ne)
-				++ne;
-		}
-		return equiv;
-	}
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
 
 
 /* think of this as a c++ template<> or a scheme macro */
@@ -449,89 +432,94 @@
 /*
   Check the typename
 */
-	SWIGRUNTIME swig_cast_info *SWIG_TypeCheck(const char *c, swig_type_info * ty) {
-		SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-	}
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
 
 /* Same as previous function, except strcmp is replaced with a pointer comparison */
-	SWIGRUNTIME swig_cast_info *SWIG_TypeCheckStruct(swig_type_info * from, swig_type_info * into) {
-		SWIG_TypeCheck_Template(iter->type == from, into);
-	}
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
 
 /*
   Cast a pointer up an inheritance hierarchy
 */
-	SWIGRUNTIMEINLINE void *SWIG_TypeCast(swig_cast_info * ty, void *ptr, int *newmemory) {
-		return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter) (ptr, newmemory);
-	}
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
 
 /* 
    Dynamic pointer casting. Down an inheritance hierarchy
 */
-	SWIGRUNTIME swig_type_info *SWIG_TypeDynamicCast(swig_type_info * ty, void **ptr) {
-		swig_type_info *lastty = ty;
-		if (!ty || !ty->dcast)
-			return ty;
-		while (ty && (ty->dcast)) {
-			ty = (*ty->dcast) (ptr);
-			if (ty)
-				lastty = ty;
-		}
-		return lastty;
-	}
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
 
 /*
   Return the name associated with this type
 */
-	SWIGRUNTIMEINLINE const char *SWIG_TypeName(const swig_type_info * ty) {
-		return ty->name;
-	}
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
 
 /*
   Return the pretty name associated with this type,
   that is an unmangled type name in a form presentable to the user.
 */
-	SWIGRUNTIME const char *SWIG_TypePrettyName(const swig_type_info * type) {
-		/* The "str" field contains the equivalent pretty names of the
-		   type, separated by vertical-bar characters.  We choose
-		   to print the last name, as it is often (?) the most
-		   specific. */
-		if (!type)
-			return NULL;
-		if (type->str != NULL) {
-			const char *last_name = type->str;
-			const char *s;
-			for (s = type->str; *s; s++)
-				if (*s == '|')
-					last_name = s + 1;
-			return last_name;
-		} else
-			return type->name;
-	}
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
 
 /* 
    Set the clientdata field for a type
 */
-	SWIGRUNTIME void SWIG_TypeClientData(swig_type_info * ti, void *clientdata) {
-		swig_cast_info *cast = ti->cast;
-		/* if (ti->clientdata == clientdata) return; */
-		ti->clientdata = clientdata;
-
-		while (cast) {
-			if (!cast->converter) {
-				swig_type_info *tc = cast->type;
-				if (!tc->clientdata) {
-					SWIG_TypeClientData(tc, clientdata);
-				}
-			}
-			cast = cast->next;
-		}
-	}
-	SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info * ti, void *clientdata) {
-		SWIG_TypeClientData(ti, clientdata);
-		ti->owndata = 1;
-	}
-
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
 /*
   Search for a swig_type_info structure only by mangled name
   Search is a O(log #types)
@@ -540,38 +528,41 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-	SWIGRUNTIME swig_type_info *SWIG_MangledTypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
-		swig_module_info *iter = start;
-		do {
-			if (iter->size) {
-				register size_t l = 0;
-				register size_t r = iter->size - 1;
-				do {
-					/* since l+r >= 0, we can (>> 1) instead (/ 2) */
-					register size_t i = (l + r) >> 1;
-					const char *iname = iter->types[i]->name;
-					if (iname) {
-						register int compare = strcmp(name, iname);
-						if (compare == 0) {
-							return iter->types[i];
-						} else if (compare < 0) {
-							if (i) {
-								r = i - 1;
-							} else {
-								break;
-							}
-						} else if (compare > 0) {
-							l = i + 1;
-						}
-					} else {
-						break;	/* should never happen */
-					}
-				} while (l <= r);
-			}
-			iter = iter->next;
-		} while (iter != end);
-		return 0;
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1; 
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {	    
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
 	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
 
 /*
   Search for a swig_type_info structure for either a mangled name or a human readable name.
@@ -582,124 +573,130 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-	SWIGRUNTIME swig_type_info *SWIG_TypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
-		/* STEP 1: Search the name field using binary search */
-		swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
-		if (ret) {
-			return ret;
-		} else {
-			/* STEP 2: If the type hasn't been found, do a complete search
-			   of the str field (the human readable name) */
-			swig_module_info *iter = start;
-			do {
-				register size_t i = 0;
-				for (; i < iter->size; ++i) {
-					if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
-						return iter->types[i];
-				}
-				iter = iter->next;
-			} while (iter != end);
-		}
-
-		/* neither found a match */
-		return 0;
-	}
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
 
 /* 
    Pack binary data into a string
 */
-	SWIGRUNTIME char *SWIG_PackData(char *c, void *ptr, size_t sz) {
-		static const char hex[17] = "0123456789abcdef";
-		register const unsigned char *u = (unsigned char *) ptr;
-		register const unsigned char *eu = u + sz;
-		for (; u != eu; ++u) {
-			register unsigned char uu = *u;
-			*(c++) = hex[(uu & 0xf0) >> 4];
-			*(c++) = hex[uu & 0xf];
-		}
-		return c;
-	}
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
 
 /* 
    Unpack binary data from a string
 */
-	SWIGRUNTIME const char *SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
-		register unsigned char *u = (unsigned char *) ptr;
-		register const unsigned char *eu = u + sz;
-		for (; u != eu; ++u) {
-			register char d = *(c++);
-			register unsigned char uu;
-			if ((d >= '0') && (d <= '9'))
-				uu = ((d - '0') << 4);
-			else if ((d >= 'a') && (d <= 'f'))
-				uu = ((d - ('a' - 10)) << 4);
-			else
-				return (char *) 0;
-			d = *(c++);
-			if ((d >= '0') && (d <= '9'))
-				uu |= (d - '0');
-			else if ((d >= 'a') && (d <= 'f'))
-				uu |= (d - ('a' - 10));
-			else
-				return (char *) 0;
-			*u = uu;
-		}
-		return c;
-	}
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
 
 /* 
    Pack 'void *' into a string buffer.
 */
-	SWIGRUNTIME char *SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
-		char *r = buff;
-		if ((2 * sizeof(void *) + 2) > bsz)
-			return 0;
-		*(r++) = '_';
-		r = SWIG_PackData(r, &ptr, sizeof(void *));
-		if (strlen(name) + 1 > (bsz - (r - buff)))
-			return 0;
-		strcpy(r, name);
-		return buff;
-	}
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
 
-	SWIGRUNTIME const char *SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
-		if (*c != '_') {
-			if (strcmp(c, "NULL") == 0) {
-				*ptr = (void *) 0;
-				return name;
-			} else {
-				return 0;
-			}
-		}
-		return SWIG_UnpackData(++c, ptr, sizeof(void *));
-	}
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
 
-	SWIGRUNTIME char *SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
-		char *r = buff;
-		size_t lname = (name ? strlen(name) : 0);
-		if ((2 * sz + 2 + lname) > bsz)
-			return 0;
-		*(r++) = '_';
-		r = SWIG_PackData(r, ptr, sz);
-		if (lname) {
-			strncpy(r, name, lname + 1);
-		} else {
-			*r = 0;
-		}
-		return buff;
-	}
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
 
-	SWIGRUNTIME const char *SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
-		if (*c != '_') {
-			if (strcmp(c, "NULL") == 0) {
-				memset(ptr, 0, sz);
-				return name;
-			} else {
-				return 0;
-			}
-		}
-		return SWIG_UnpackData(++c, ptr, sz);
-	}
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
 
 #ifdef __cplusplus
 }
@@ -722,8 +719,8 @@
 
 #include "lua.h"
 #include "lauxlib.h"
-#include <stdlib.h>				/* for malloc */
-#include <assert.h>				/* for a few sanity tests */
+#include <stdlib.h>  /* for malloc */
+#include <assert.h>  /* for a few sanity tests */
 
 /* -----------------------------------------------------------------------------
  * global swig types
@@ -737,62 +734,62 @@
 #define SWIG_LUA_CHAR    6
 
 /* Structure for variable linking table */
-	typedef struct {
-		const char *name;
-		lua_CFunction get;
-		lua_CFunction set;
-	} swig_lua_var_info;
+typedef struct {
+  const char *name;
+  lua_CFunction get;
+  lua_CFunction set;
+} swig_lua_var_info;
 
 /* Constant information structure */
-	typedef struct {
-		int type;
-		char *name;
-		long lvalue;
-		double dvalue;
-		void *pvalue;
-		swig_type_info **ptype;
-	} swig_lua_const_info;
-
-	typedef struct {
-		const char *name;
-		lua_CFunction method;
-	} swig_lua_method;
-
-	typedef struct {
-		const char *name;
-		lua_CFunction getmethod;
-		lua_CFunction setmethod;
-	} swig_lua_attribute;
-
-	typedef struct swig_lua_class {
-		const char *name;
-		swig_type_info **type;
-		lua_CFunction constructor;
-		void (*destructor) (void *);
-		swig_lua_method *methods;
-		swig_lua_attribute *attributes;
-		struct swig_lua_class **bases;
-		const char **base_names;
-	} swig_lua_class;
+typedef struct {
+    int type;
+    char *name;
+    long lvalue;
+    double dvalue;
+    void   *pvalue;
+    swig_type_info **ptype;
+} swig_lua_const_info;
+
+typedef struct {
+  const char     *name;
+  lua_CFunction   method;
+} swig_lua_method;
+
+typedef struct {
+  const char     *name;
+  lua_CFunction   getmethod;
+  lua_CFunction   setmethod;
+} swig_lua_attribute;
+
+typedef struct swig_lua_class {
+  const char    *name;
+  swig_type_info   **type;
+  lua_CFunction  constructor;
+  void    (*destructor)(void *);
+  swig_lua_method   *methods;
+  swig_lua_attribute     *attributes;
+  struct swig_lua_class **bases;
+  const char **base_names;
+} swig_lua_class;
 
 /* this is the struct for wrappering all pointers in SwigLua
 */
-	typedef struct {
-		swig_type_info *type;
-		int own;				/* 1 if owned & must be destroyed */
-		void *ptr;
-	} swig_lua_userdata;
+typedef struct {
+  swig_type_info   *type;
+  int     own;  /* 1 if owned & must be destroyed */
+  void        *ptr;
+} swig_lua_userdata;
 
 /* this is the struct for wrapping arbitary packed binary data
 (currently it is only used for member function pointers)
 the data ordering is similar to swig_lua_userdata, but it is currently not possible
 to tell the two structures apart within Swig, other than by looking at the type
 */
-	typedef struct {
-		swig_type_info *type;
-		int own;				/* 1 if owned & must be destroyed */
-		char data[1];			/* arbitary amount of data */
-	} swig_lua_rawdata;
+typedef struct {
+  swig_type_info   *type;
+  int     own;  /* 1 if owned & must be destroyed */
+  char data[1];       /* arbitary amount of data */    
+} swig_lua_rawdata;
 
 /* Common SWIG API */
 #define SWIG_NewPointerObj(L, ptr, type, owner)       SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
@@ -843,20 +840,24 @@
 #endif
 
 /* storing/access of swig_module_info */
-	SWIGRUNTIME swig_module_info *SWIG_Lua_GetModule(lua_State * L) {
-		swig_module_info *ret = 0;
-		                 lua_pushstring(L, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
-		                 lua_rawget(L, LUA_REGISTRYINDEX);
-		if               (lua_islightuserdata(L, -1))
-			                 ret = (swig_module_info *) lua_touserdata(L, -1);
-		                 lua_pop(L, 1);	/* tidy */
-		                 return ret;
-	} SWIGRUNTIME void SWIG_Lua_SetModule(lua_State * L, swig_module_info * module) {
-		/* add this all into the Lua registry: */
-		lua_pushstring(L, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
-		lua_pushlightuserdata(L, (void *) module);
-		lua_rawset(L, LUA_REGISTRYINDEX);
-	}
+SWIGRUNTIME swig_module_info *
+SWIG_Lua_GetModule(lua_State* L) {
+  swig_module_info *ret = 0;
+  lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+  lua_rawget(L,LUA_REGISTRYINDEX);
+  if (lua_islightuserdata(L,-1))
+    ret=(swig_module_info*)lua_touserdata(L,-1);
+  lua_pop(L,1);  /* tidy */
+  return ret;
+}
+
+SWIGRUNTIME void
+SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) {
+  /* add this all into the Lua registry: */
+  lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+  lua_pushlightuserdata(L,(void*)module);
+  lua_rawset(L,LUA_REGISTRYINDEX);
+}
 
 /* -----------------------------------------------------------------------------
  * global variable support code: modules
@@ -865,18 +866,20 @@
 /* this function is called when trying to set an immutable.
 default value is to print an error.
 This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
-	SWIGINTERN int SWIG_Lua_set_immutable(lua_State * L) {
+SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L)
+{
 /*  there should be 1 param passed in: the new value */
 #ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
-		lua_pop(L, 1);			/* remove it */
-		lua_pushstring(L, "This variable is immutable");
-		lua_error(L);
+  lua_pop(L,1);  /* remove it */
+  lua_pushstring(L,"This variable is immutable");
+  lua_error(L);
 #endif
-		return 0;				/* should not return anything */
-	}
+    return 0;   /* should not return anything */
+}
 
 /* the module.get method used for getting linked data */
-	SWIGINTERN int SWIG_Lua_module_get(lua_State * L) {
+SWIGINTERN int SWIG_Lua_module_get(lua_State* L)
+{
 /*  there should be 2 params passed in
   (1) table (not the meta table)
   (2) string name of the attribute
@@ -884,158 +887,173 @@
    lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
    lua_tostring(L,2));
 */
-		/* get the metatable */
-		assert(lua_istable(L, 1));	/* just in case */
-		lua_getmetatable(L, 1);	/* get the metatable */
-		assert(lua_istable(L, -1));	/* just in case */
-		SWIG_Lua_get_table(L, ".get");	/* get the .get table */
-		lua_remove(L, 3);		/* remove metatable */
-		if (lua_istable(L, -1)) {
-			/* look for the key in the .get table */
-			lua_pushvalue(L, 2);	/* key */
-			lua_rawget(L, -2);
-			lua_remove(L, 3);	/* remove .get */
-			if (lua_iscfunction(L, -1)) {	/* found it so call the fn & return its value */
-				lua_call(L, 0, 1);
-				return 1;
-			}
-			lua_pop(L, 1);		/* remove the top */
-		}
-		lua_pop(L, 1);			/* remove the .get */
-		lua_pushnil(L);			/* return a nil */
-		return 1;
-	}
+  /* get the metatable */
+  assert(lua_istable(L,1));  /* just in case */
+  lua_getmetatable(L,1);  /* get the metatable */
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_get_table(L,".get");  /* get the .get table */
+  lua_remove(L,3);  /* remove metatable */
+  if (lua_istable(L,-1))
+  {
+    /* look for the key in the .get table */
+    lua_pushvalue(L,2);  /* key */
+    lua_rawget(L,-2);
+    lua_remove(L,3);  /* remove .get */
+    if (lua_iscfunction(L,-1))
+    {  /* found it so call the fn & return its value */
+      lua_call(L,0,1);
+      return 1;
+    }
+    lua_pop(L,1);  /* remove the top */
+  }
+  lua_pop(L,1);  /* remove the .get */
+  lua_pushnil(L);  /* return a nil */
+    return 1;
+}
 
 /* the module.set method used for setting linked data */
-	SWIGINTERN int SWIG_Lua_module_set(lua_State * L) {
+SWIGINTERN int SWIG_Lua_module_set(lua_State* L)
+{
 /*  there should be 3 params passed in
   (1) table (not the meta table)
   (2) string name of the attribute
   (3) any for the new value
 */
-		/* get the metatable */
-		assert(lua_istable(L, 1));	/* just in case */
-		lua_getmetatable(L, 1);	/* get the metatable */
-		assert(lua_istable(L, -1));	/* just in case */
-		SWIG_Lua_get_table(L, ".set");	/* get the .set table */
-		lua_remove(L, 4);		/* remove metatable */
-		if (lua_istable(L, -1)) {
-			/* look for the key in the .set table */
-			lua_pushvalue(L, 2);	/* key */
-			lua_rawget(L, -2);
-			lua_remove(L, 4);	/* remove .set */
-			if (lua_iscfunction(L, -1)) {	/* found it so call the fn & return its value */
-				lua_pushvalue(L, 3);	/* value */
-				lua_call(L, 1, 0);
-				return 0;
-			}
-		}
-		lua_settop(L, 3);		/* reset back to start */
-		/* we now have the table, key & new value, so just set directly */
-		lua_rawset(L, 1);		/* add direct */
-		return 0;
-	}
+  /* get the metatable */
+  assert(lua_istable(L,1));  /* just in case */
+  lua_getmetatable(L,1);  /* get the metatable */
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_get_table(L,".set");  /* get the .set table */
+  lua_remove(L,4);  /* remove metatable */
+  if (lua_istable(L,-1))
+  {
+    /* look for the key in the .set table */
+    lua_pushvalue(L,2);  /* key */
+    lua_rawget(L,-2);
+    lua_remove(L,4);  /* remove .set */
+    if (lua_iscfunction(L,-1))
+    {  /* found it so call the fn & return its value */
+      lua_pushvalue(L,3);  /* value */
+      lua_call(L,1,0);
+      return 0;
+    }
+  }
+  lua_settop(L,3);  /* reset back to start */
+  /* we now have the table, key & new value, so just set directly */
+  lua_rawset(L,1);  /* add direct */
+  return 0;
+}
 
 /* registering a module in lua */
-	SWIGINTERN void SWIG_Lua_module_begin(lua_State * L, const char *name) {
-		assert(lua_istable(L, -1));	/* just in case */
-		lua_pushstring(L, name);
-		lua_newtable(L);		/* the table */
-		/* add meta table */
-		lua_newtable(L);		/* the meta table */
-		SWIG_Lua_add_function(L, "__index", SWIG_Lua_module_get);
-		SWIG_Lua_add_function(L, "__newindex", SWIG_Lua_module_set);
-		lua_pushstring(L, ".get");
-		lua_newtable(L);		/* the .get table */
-		lua_rawset(L, -3);		/* add .get into metatable */
-		lua_pushstring(L, ".set");
-		lua_newtable(L);		/* the .set table */
-		lua_rawset(L, -3);		/* add .set into metatable */
-		lua_setmetatable(L, -2);	/* sets meta table in module */
-		lua_rawset(L, -3);		/* add module into parent */
-		SWIG_Lua_get_table(L, name);	/* get the table back out */
-	}
+SWIGINTERN void  SWIG_Lua_module_begin(lua_State* L,const char* name)
+{
+  assert(lua_istable(L,-1));  /* just in case */
+  lua_pushstring(L,name);
+  lua_newtable(L);   /* the table */
+  /* add meta table */
+  lua_newtable(L);    /* the meta table */
+  SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get);
+  SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set);
+  lua_pushstring(L,".get");
+  lua_newtable(L);    /* the .get table */
+  lua_rawset(L,-3);  /* add .get into metatable */
+  lua_pushstring(L,".set");
+  lua_newtable(L);    /* the .set table */
+  lua_rawset(L,-3);  /* add .set into metatable */
+  lua_setmetatable(L,-2);  /* sets meta table in module */
+  lua_rawset(L,-3);        /* add module into parent */
+  SWIG_Lua_get_table(L,name);   /* get the table back out */
+}
 
 /* ending the register */
-	SWIGINTERN void SWIG_Lua_module_end(lua_State * L) {
-		lua_pop(L, 1);			/* tidy stack (remove module) */
-	}
+SWIGINTERN void  SWIG_Lua_module_end(lua_State* L)
+{
+  lua_pop(L,1);       /* tidy stack (remove module) */
+}
 
 /* adding a linked variable to the module */
-	SWIGINTERN void SWIG_Lua_module_add_variable(lua_State * L, const char *name, lua_CFunction getFn, lua_CFunction setFn) {
-		assert(lua_istable(L, -1));	/* just in case */
-		lua_getmetatable(L, -1);	/* get the metatable */
-		assert(lua_istable(L, -1));	/* just in case */
-		SWIG_Lua_get_table(L, ".get");	/* find the .get table */
-		assert(lua_istable(L, -1));	/* should be a table: */
-		SWIG_Lua_add_function(L, name, getFn);
-		lua_pop(L, 1);			/* tidy stack (remove table) */
-		if (setFn) {			/* if there is a set fn */
-			SWIG_Lua_get_table(L, ".set");	/* find the .set table */
-			assert(lua_istable(L, -1));	/* should be a table: */
-			SWIG_Lua_add_function(L, name, setFn);
-			lua_pop(L, 1);		/* tidy stack (remove table) */
-		}
-		lua_pop(L, 1);			/* tidy stack (remove meta) */
-	}
+SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
+{
+  assert(lua_istable(L,-1));  /* just in case */
+  lua_getmetatable(L,-1);  /* get the metatable */
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_get_table(L,".get"); /* find the .get table */
+  assert(lua_istable(L,-1));  /* should be a table: */
+  SWIG_Lua_add_function(L,name,getFn);
+  lua_pop(L,1);       /* tidy stack (remove table) */
+  if (setFn)  /* if there is a set fn */
+  {
+    SWIG_Lua_get_table(L,".set"); /* find the .set table */
+    assert(lua_istable(L,-1));  /* should be a table: */
+    SWIG_Lua_add_function(L,name,setFn);
+    lua_pop(L,1);       /* tidy stack (remove table) */
+  }
+  lua_pop(L,1);       /* tidy stack (remove meta) */
+}
 
 /* adding a function module */
-	SWIGINTERN void SWIG_Lua_module_add_function(lua_State * L, const char *name, lua_CFunction fn) {
-		SWIG_Lua_add_function(L, name, fn);
-	}
+SWIGINTERN void  SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn)
+{
+  SWIG_Lua_add_function(L,name,fn);
+}
 
 /* -----------------------------------------------------------------------------
  * global variable support code: classes
  * ----------------------------------------------------------------------------- */
 
 /* the class.get method, performs the lookup of class attributes */
-	SWIGINTERN int SWIG_Lua_class_get(lua_State * L) {
+SWIGINTERN int  SWIG_Lua_class_get(lua_State* L)
+{
 /*  there should be 2 params passed in
   (1) userdata (not the meta table)
   (2) string name of the attribute
 */
-		assert(lua_isuserdata(L, -2));	/* just in case */
-		lua_getmetatable(L, -2);	/* get the meta table */
-		assert(lua_istable(L, -1));	/* just in case */
-		SWIG_Lua_get_table(L, ".get");	/* find the .get table */
-		assert(lua_istable(L, -1));	/* just in case */
-		/* look for the key in the .get table */
-		lua_pushvalue(L, 2);	/* key */
-		lua_rawget(L, -2);
-		lua_remove(L, -2);		/* stack tidy, remove .get table */
-		if (lua_iscfunction(L, -1)) {	/* found it so call the fn & return its value */
-			lua_pushvalue(L, 1);	/* the userdata */
-			lua_call(L, 1, 1);	/* 1 value in (userdata),1 out (result) */
-			lua_remove(L, -2);	/* stack tidy, remove metatable */
-			return 1;
-		}
-		lua_pop(L, 1);			/* remove whatever was there */
-		/* ok, so try the .fn table */
-		SWIG_Lua_get_table(L, ".fn");	/* find the .get table */
-		assert(lua_istable(L, -1));	/* just in case */
-		lua_pushvalue(L, 2);	/* key */
-		lua_rawget(L, -2);		/* look for the fn */
-		lua_remove(L, -2);		/* stack tidy, remove .fn table */
-		if (lua_isfunction(L, -1)) {	/* note: if its a C function or lua function *//* found it so return the fn & let lua call it */
-			lua_remove(L, -2);	/* stack tidy, remove metatable */
-			return 1;
-		}
-		lua_pop(L, 1);			/* remove whatever was there */
-		/* NEW: looks for the __getitem() fn
-		   this is a user provided get fn */
-		SWIG_Lua_get_table(L, "__getitem");	/* find the __getitem fn */
-		if (lua_iscfunction(L, -1)) {	/* if its there *//* found it so call the fn & return its value */
-			lua_pushvalue(L, 1);	/* the userdata */
-			lua_pushvalue(L, 2);	/* the parameter */
-			lua_call(L, 2, 1);	/* 2 value in (userdata),1 out (result) */
-			lua_remove(L, -2);	/* stack tidy, remove metatable */
-			return 1;
-		}
-		return 0;				/* sorry not known */
-	}
+  assert(lua_isuserdata(L,-2));  /* just in case */
+  lua_getmetatable(L,-2);    /* get the meta table */
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_get_table(L,".get"); /* find the .get table */
+  assert(lua_istable(L,-1));  /* just in case */
+  /* look for the key in the .get table */
+  lua_pushvalue(L,2);  /* key */
+  lua_rawget(L,-2);
+  lua_remove(L,-2); /* stack tidy, remove .get table */
+  if (lua_iscfunction(L,-1))
+  {  /* found it so call the fn & return its value */
+    lua_pushvalue(L,1);  /* the userdata */
+    lua_call(L,1,1);  /* 1 value in (userdata),1 out (result) */
+    lua_remove(L,-2); /* stack tidy, remove metatable */
+    return 1;
+  }
+  lua_pop(L,1);  /* remove whatever was there */
+  /* ok, so try the .fn table */
+  SWIG_Lua_get_table(L,".fn"); /* find the .get table */
+  assert(lua_istable(L,-1));  /* just in case */
+  lua_pushvalue(L,2);  /* key */
+  lua_rawget(L,-2);  /* look for the fn */
+  lua_remove(L,-2); /* stack tidy, remove .fn table */
+  if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
+  {  /* found it so return the fn & let lua call it */
+    lua_remove(L,-2); /* stack tidy, remove metatable */
+    return 1;
+  }
+  lua_pop(L,1);  /* remove whatever was there */
+  /* NEW: looks for the __getitem() fn
+  this is a user provided get fn */
+  SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
+  if (lua_iscfunction(L,-1))  /* if its there */
+  {  /* found it so call the fn & return its value */
+    lua_pushvalue(L,1);  /* the userdata */
+    lua_pushvalue(L,2);  /* the parameter */
+    lua_call(L,2,1);  /* 2 value in (userdata),1 out (result) */
+    lua_remove(L,-2); /* stack tidy, remove metatable */
+    return 1;
+  }
+  return 0;  /* sorry not known */
+}
 
 /* the class.set method, performs the lookup of class attributes */
-	SWIGINTERN int SWIG_Lua_class_set(lua_State * L) {
+SWIGINTERN int  SWIG_Lua_class_set(lua_State* L)
+{
 /*  there should be 3 params passed in
   (1) table (not the meta table)
   (2) string name of the attribute
@@ -1045,123 +1063,136 @@
       lua_tostring(L,2),
       lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/
 
-		assert(lua_isuserdata(L, 1));	/* just in case */
-		lua_getmetatable(L, 1);	/* get the meta table */
-		assert(lua_istable(L, -1));	/* just in case */
-
-		SWIG_Lua_get_table(L, ".set");	/* find the .set table */
-		if (lua_istable(L, -1)) {
-			/* look for the key in the .set table */
-			lua_pushvalue(L, 2);	/* key */
-			lua_rawget(L, -2);
-			if (lua_iscfunction(L, -1)) {	/* found it so call the fn & return its value */
-				lua_pushvalue(L, 1);	/* userdata */
-				lua_pushvalue(L, 3);	/* value */
-				lua_call(L, 2, 0);
-				return 0;
-			}
-			lua_pop(L, 1);		/* remove the value */
-		}
-		lua_pop(L, 1);			/* remove the value .set table */
-		/* NEW: looks for the __setitem() fn
-		   this is a user provided set fn */
-		SWIG_Lua_get_table(L, "__setitem");	/* find the fn */
-		if (lua_iscfunction(L, -1)) {	/* if its there *//* found it so call the fn & return its value */
-			lua_pushvalue(L, 1);	/* the userdata */
-			lua_pushvalue(L, 2);	/* the parameter */
-			lua_pushvalue(L, 3);	/* the value */
-			lua_call(L, 3, 0);	/* 3 values in ,0 out */
-			lua_remove(L, -2);	/* stack tidy, remove metatable */
-			return 1;
-		}
-		return 0;
-	}
+  assert(lua_isuserdata(L,1));  /* just in case */
+  lua_getmetatable(L,1);    /* get the meta table */
+  assert(lua_istable(L,-1));  /* just in case */
+
+  SWIG_Lua_get_table(L,".set"); /* find the .set table */
+  if (lua_istable(L,-1))
+  {
+    /* look for the key in the .set table */
+    lua_pushvalue(L,2);  /* key */
+    lua_rawget(L,-2);
+    if (lua_iscfunction(L,-1))
+    {  /* found it so call the fn & return its value */
+      lua_pushvalue(L,1);  /* userdata */
+      lua_pushvalue(L,3);  /* value */
+      lua_call(L,2,0);
+      return 0;
+    }
+    lua_pop(L,1);  /* remove the value */
+  }
+  lua_pop(L,1);  /* remove the value .set table */
+  /* NEW: looks for the __setitem() fn
+  this is a user provided set fn */
+  SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
+  if (lua_iscfunction(L,-1))  /* if its there */
+  {  /* found it so call the fn & return its value */
+    lua_pushvalue(L,1);  /* the userdata */
+    lua_pushvalue(L,2);  /* the parameter */
+    lua_pushvalue(L,3);  /* the value */
+    lua_call(L,3,0);  /* 3 values in ,0 out */
+    lua_remove(L,-2); /* stack tidy, remove metatable */
+    return 1;
+  }
+  return 0;
+}
 
 /* the class.destruct method called by the interpreter */
-	SWIGINTERN int SWIG_Lua_class_destruct(lua_State * L) {
+SWIGINTERN int  SWIG_Lua_class_destruct(lua_State* L)
+{
 /*  there should be 1 params passed in
   (1) userdata (not the meta table) */
-		swig_lua_userdata *usr;
-		swig_lua_class *clss;
-		assert(lua_isuserdata(L, -1));	/* just in case */
-		usr = (swig_lua_userdata *) lua_touserdata(L, -1);	/* get it */
-		/* if must be destroyed & has a destructor */
-		if (usr->own) {			/* if must be destroyed */
-			clss = (swig_lua_class *) usr->type->clientdata;	/* get the class */
-			if (clss && clss->destructor) {	/* there is a destroy fn */
-				clss->destructor(usr->ptr);	/* bye bye */
-			}
-		}
-		return 0;
-	}
+  swig_lua_userdata* usr;
+  swig_lua_class* clss;
+  assert(lua_isuserdata(L,-1));  /* just in case */
+  usr=(swig_lua_userdata*)lua_touserdata(L,-1);  /* get it */
+  /* if must be destroyed & has a destructor */
+  if (usr->own) /* if must be destroyed */
+  {
+    clss=(swig_lua_class*)usr->type->clientdata;  /* get the class */
+    if (clss && clss->destructor)  /* there is a destroy fn */
+    {
+      clss->destructor(usr->ptr);  /* bye bye */
+    }
+  }
+  return 0;
+}
 
 /* gets the swig class registry (or creates it) */
-	SWIGINTERN void SWIG_Lua_get_class_registry(lua_State * L) {
-		/* add this all into the swig registry: */
-		lua_pushstring(L, "SWIG");
-		lua_rawget(L, LUA_REGISTRYINDEX);	/* get the registry */
-		if (!lua_istable(L, -1)) {	/* not there *//* must be first time, so add it */
-			lua_pop(L, 1);		/* remove the result */
-			lua_pushstring(L, "SWIG");
-			lua_newtable(L);
-			lua_rawset(L, LUA_REGISTRYINDEX);
-			/* then get it */
-			lua_pushstring(L, "SWIG");
-			lua_rawget(L, LUA_REGISTRYINDEX);
-		}
-	}
+SWIGINTERN void  SWIG_Lua_get_class_registry(lua_State* L)
+{
+  /* add this all into the swig registry: */
+  lua_pushstring(L,"SWIG");
+  lua_rawget(L,LUA_REGISTRYINDEX);  /* get the registry */
+  if (!lua_istable(L,-1))  /* not there */
+  {  /* must be first time, so add it */
+    lua_pop(L,1);  /* remove the result */
+    lua_pushstring(L,"SWIG");
+    lua_newtable(L);
+    lua_rawset(L,LUA_REGISTRYINDEX);
+    /* then get it */
+    lua_pushstring(L,"SWIG");
+    lua_rawget(L,LUA_REGISTRYINDEX);
+  }
+}
 
 /* helper fn to get the classes metatable from the register */
-	SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State * L, const char *cname) {
-		SWIG_Lua_get_class_registry(L);	/* get the registry */
-		lua_pushstring(L, cname);	/* get the name */
-		lua_rawget(L, -2);		/* get it */
-		lua_remove(L, -2);		/* tidy up (remove registry) */
-	}
+SWIGINTERN void  SWIG_Lua_get_class_metatable(lua_State* L,const char* cname)
+{
+  SWIG_Lua_get_class_registry(L);  /* get the registry */
+  lua_pushstring(L,cname);  /* get the name */
+  lua_rawget(L,-2);    /* get it */
+  lua_remove(L,-2);    /* tidy up (remove registry) */
+}
 
 /* helper add a variable to a registered class */
-	SWIGINTERN void SWIG_Lua_add_class_variable(lua_State * L, const char *name, lua_CFunction getFn, lua_CFunction setFn) {
-		assert(lua_istable(L, -1));	/* just in case */
-		SWIG_Lua_get_table(L, ".get");	/* find the .get table */
-		assert(lua_istable(L, -1));	/* just in case */
-		SWIG_Lua_add_function(L, name, getFn);
-		lua_pop(L, 1);			/* tidy stack (remove table) */
-		if (setFn) {
-			SWIG_Lua_get_table(L, ".set");	/* find the .set table */
-			assert(lua_istable(L, -1));	/* just in case */
-			SWIG_Lua_add_function(L, name, setFn);
-			lua_pop(L, 1);		/* tidy stack (remove table) */
-		}
-	}
+SWIGINTERN void  SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
+{
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_get_table(L,".get"); /* find the .get table */
+  assert(lua_istable(L,-1));  /* just in case */
+  SWIG_Lua_add_function(L,name,getFn);
+  lua_pop(L,1);       /* tidy stack (remove table) */
+  if (setFn)
+  {
+    SWIG_Lua_get_table(L,".set"); /* find the .set table */
+    assert(lua_istable(L,-1));  /* just in case */
+    SWIG_Lua_add_function(L,name,setFn);
+    lua_pop(L,1);       /* tidy stack (remove table) */
+  }
+}
 
 /* helper to recursively add class details (attributes & operations) */
-	SWIGINTERN void SWIG_Lua_add_class_details(lua_State * L, swig_lua_class * clss) {
-		int i;
-		/* call all the base classes first: we can then override these later: */
-		for (i = 0; clss->bases[i]; i++) {
-			SWIG_Lua_add_class_details(L, clss->bases[i]);
-		}
-		/* add fns */
-		for (i = 0; clss->attributes[i].name; i++) {
-			SWIG_Lua_add_class_variable(L, clss->attributes[i].name, clss->attributes[i].getmethod, clss->attributes[i].setmethod);
-		}
-		/* add methods to the metatable */
-		SWIG_Lua_get_table(L, ".fn");	/* find the .fn table */
-		assert(lua_istable(L, -1));	/* just in case */
-		for (i = 0; clss->methods[i].name; i++) {
-			SWIG_Lua_add_function(L, clss->methods[i].name, clss->methods[i].method);
-		}
-		lua_pop(L, 1);			/* tidy stack (remove table) */
-		/*   add operator overloads
-		   these look ANY method which start with "__" and assume they
-		   are operator overloads & add them to the metatable
-		   (this might mess up is someone defines a method __gc (the destructor) */
-		for (i = 0; clss->methods[i].name; i++) {
-			if (clss->methods[i].name[0] == '_' && clss->methods[i].name[1] == '_') {
-				SWIG_Lua_add_function(L, clss->methods[i].name, clss->methods[i].method);
-			}
-		}
-	}
+SWIGINTERN void  SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss)
+{
+  int i;
+  /* call all the base classes first: we can then override these later: */
+  for(i=0;clss->bases[i];i++)
+  {
+    SWIG_Lua_add_class_details(L,clss->bases[i]);
+  }
+  /* add fns */
+  for(i=0;clss->attributes[i].name;i++){
+    SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
+  }
+  /* add methods to the metatable */
+  SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
+  assert(lua_istable(L,-1));  /* just in case */
+  for(i=0;clss->methods[i].name;i++){
+    SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
+  }
+  lua_pop(L,1);       /* tidy stack (remove table) */
+  /*   add operator overloads
+    these look ANY method which start with "__" and assume they
+    are operator overloads & add them to the metatable
+    (this might mess up is someone defines a method __gc (the destructor)*/
+  for(i=0;clss->methods[i].name;i++){
+    if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){
+      SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
+    }
+  }
+}
 
 /* set up the base classes pointers.
 Each class structure has a list of pointers to the base class structures.
@@ -1170,237 +1201,256 @@
 spread over more than one swig file. 
 Therefore it must be done at runtime, querying the SWIG type system.
 */
-	SWIGINTERN void SWIG_Lua_init_base_class(lua_State * L, swig_lua_class * clss) {
-		int i = 0;
-		swig_module_info *module = SWIG_GetModule(L);
-		for (i = 0; clss->base_names[i]; i++) {
-			if (clss->bases[i] == 0) {	/* not found yet */
-				/* lookup and cache the base class */
-				swig_type_info *info = SWIG_TypeQueryModule(module, module, clss->base_names[i]);
-				if (info)
-					clss->bases[i] = (swig_lua_class *) info->clientdata;
-			}
-		}
-	}
+SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss)
+{
+  int i=0;
+  swig_module_info* module=SWIG_GetModule(L);
+  for(i=0;clss->base_names[i];i++)
+  {
+    if (clss->bases[i]==0) /* not found yet */
+    {
+      /* lookup and cache the base class */
+      swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
+      if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
+    }
+  }	
+}
 
 /* performs the entire class registration process */
-	SWIGINTERN void SWIG_Lua_class_register(lua_State * L, swig_lua_class * clss) {
-		/*  add its constructor to module with the name of the class
-		   so you can do MyClass(...) as well as new_MyClass(...)
-		   BUT only if a constructor is defined
-		   (this overcomes the problem of pure virtual classes without constructors) */
-		if (clss->constructor)
-			SWIG_Lua_add_function(L, clss->name, clss->constructor);
-
-		SWIG_Lua_get_class_registry(L);	/* get the registry */
-		lua_pushstring(L, clss->name);	/* get the name */
-		lua_newtable(L);		/* create the metatable */
-		/* add string of class name called ".type" */
-		lua_pushstring(L, ".type");
-		lua_pushstring(L, clss->name);
-		lua_rawset(L, -3);
-		/* add a table called ".get" */
-		lua_pushstring(L, ".get");
-		lua_newtable(L);
-		lua_rawset(L, -3);
-		/* add a table called ".set" */
-		lua_pushstring(L, ".set");
-		lua_newtable(L);
-		lua_rawset(L, -3);
-		/* add a table called ".fn" */
-		lua_pushstring(L, ".fn");
-		lua_newtable(L);
-		lua_rawset(L, -3);
-		/* add accessor fns for using the .get,.set&.fn */
-		SWIG_Lua_add_function(L, "__index", SWIG_Lua_class_get);
-		SWIG_Lua_add_function(L, "__newindex", SWIG_Lua_class_set);
-		SWIG_Lua_add_function(L, "__gc", SWIG_Lua_class_destruct);
-		/* add it */
-		lua_rawset(L, -3);		/* metatable into registry */
-		lua_pop(L, 1);			/* tidy stack (remove registry) */
-
-		SWIG_Lua_get_class_metatable(L, clss->name);
-		SWIG_Lua_add_class_details(L, clss);	/* recursive adding of details (atts & ops) */
-		lua_pop(L, 1);			/* tidy stack (remove class metatable) */
-	}
+SWIGINTERN void  SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss)
+{
+  /*  add its constructor to module with the name of the class
+  so you can do MyClass(...) as well as new_MyClass(...)
+  BUT only if a constructor is defined
+  (this overcomes the problem of pure virtual classes without constructors)*/
+  if (clss->constructor)
+    SWIG_Lua_add_function(L,clss->name,clss->constructor);
+
+  SWIG_Lua_get_class_registry(L);  /* get the registry */
+  lua_pushstring(L,clss->name);  /* get the name */
+  lua_newtable(L);    /* create the metatable */
+  /* add string of class name called ".type" */
+  lua_pushstring(L,".type");
+  lua_pushstring(L,clss->name);
+  lua_rawset(L,-3);
+  /* add a table called ".get" */
+  lua_pushstring(L,".get");
+  lua_newtable(L);
+  lua_rawset(L,-3);
+  /* add a table called ".set" */
+  lua_pushstring(L,".set");
+  lua_newtable(L);
+  lua_rawset(L,-3);
+  /* add a table called ".fn" */
+  lua_pushstring(L,".fn");
+  lua_newtable(L);
+  lua_rawset(L,-3);
+  /* add accessor fns for using the .get,.set&.fn */
+  SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
+  SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
+  SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
+  /* add it */
+  lua_rawset(L,-3);  /* metatable into registry */
+  lua_pop(L,1);      /* tidy stack (remove registry) */
+
+  SWIG_Lua_get_class_metatable(L,clss->name);
+  SWIG_Lua_add_class_details(L,clss);  /* recursive adding of details (atts & ops) */
+  lua_pop(L,1);      /* tidy stack (remove class metatable) */
+}
 
 /* -----------------------------------------------------------------------------
  * Class/structure conversion fns
  * ----------------------------------------------------------------------------- */
 
 /* helper to add metatable to new lua object */
-	SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State * L, swig_type_info * type) {
-		if (type->clientdata) {	/* there is clientdata: so add the metatable */
-			SWIG_Lua_get_class_metatable(L, ((swig_lua_class *) (type->clientdata))->name);
-			if (lua_istable(L, -1)) {
-				lua_setmetatable(L, -2);
-			} else {
-				lua_pop(L, 1);
-			}
-		}
-	}
+SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type)
+{
+  if (type->clientdata)  /* there is clientdata: so add the metatable */
+  {
+    SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name);
+    if (lua_istable(L,-1))
+    {
+      lua_setmetatable(L,-2);
+    }
+    else
+    {
+      lua_pop(L,1);
+    }
+  }
+}
 
 /* pushes a new object into the lua stack */
-	SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State * L, void *ptr, swig_type_info * type, int own) {
-		swig_lua_userdata *usr;
-		if (!ptr) {
-			lua_pushnil(L);
-			return;
-		}
-		usr = (swig_lua_userdata *) lua_newuserdata(L, sizeof(swig_lua_userdata));	/* get data */
-		usr->ptr = ptr;			/* set the ptr */
-		usr->type = type;
-		usr->own = own;
-		_SWIG_Lua_AddMetatable(L, type);	/* add metatable */
-	}
+SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own)
+{
+  swig_lua_userdata* usr;
+  if (!ptr){
+    lua_pushnil(L);
+    return;
+  }
+  usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata));  /* get data */
+  usr->ptr=ptr;  /* set the ptr */
+  usr->type=type;
+  usr->own=own;
+  _SWIG_Lua_AddMetatable(L,type); /* add metatable */
+}
 
 /* takes a object from the lua stack & converts it into an object of the correct type
  (if possible) */
-	SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State * L, int index, void **ptr, swig_type_info * type, int flags) {
-		swig_lua_userdata *usr;
-		swig_cast_info *cast;
-		if (lua_isnil(L, index)) {
-			*ptr = 0;
-			return SWIG_OK;
-		}						/* special case: lua nil => NULL pointer */
-		usr = (swig_lua_userdata *) lua_touserdata(L, index);	/* get data */
-		if (usr) {
-			if (flags & SWIG_POINTER_DISOWN) {	/* must disown the object */
-				usr->own = 0;
-			}
-			if (!type) {		/* special cast void*, no casting fn */
-				*ptr = usr->ptr;
-				return SWIG_OK;	/* ok */
-			}
-			cast = SWIG_TypeCheckStruct(usr->type, type);	/* performs normal type checking */
-			if (cast) {
-				int newmemory = 0;
-				*ptr = SWIG_TypeCast(cast, usr->ptr, &newmemory);
-				assert(!newmemory);	/* newmemory handling not yet implemented */
-				return SWIG_OK;	/* ok */
-			}
-		}
-		return SWIG_ERROR;		/* error */
-	}
+SWIGRUNTIME int  SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags)
+{
+  swig_lua_userdata* usr;
+  swig_cast_info *cast;
+  if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;}    /* special case: lua nil => NULL pointer */
+  usr=(swig_lua_userdata*)lua_touserdata(L,index);  /* get data */
+  if (usr)
+  {
+    if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
+    {
+        usr->own=0;
+    }
+    if (!type)            /* special cast void*, no casting fn */
+    {
+      *ptr=usr->ptr;
+      return SWIG_OK; /* ok */
+    }
+    cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
+    if (cast)
+    {
+      int newmemory = 0;
+      *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+      return SWIG_OK;  /* ok */
+    }
+  }
+  return SWIG_ERROR;  /* error */
+}
 
-	SWIGRUNTIME void *SWIG_Lua_MustGetPtr(lua_State * L, int index, swig_type_info * type, int flags, int argnum, const char *func_name) {
-		void *result;
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, index, &result, type, flags))) {
-			lua_pushfstring(L, "Error in %s, expected a %s at argument number %d\n", func_name, (type && type->str) ? type->str : "void*", argnum);
-			lua_error(L);
-		}
-		return result;
-	}
+SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags,
+       int argnum,const char* func_name){
+  void* result;
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
+    lua_pushfstring(L,"Error in %s, expected a %s at argument number %d\n",
+      func_name,(type && type->str)?type->str:"void*",argnum);
+    lua_error(L);
+  }
+  return result;
+}
 
 /* pushes a packed userdata. user for member fn pointers only */
-	SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State * L, void *ptr, size_t size, swig_type_info * type) {
-		swig_lua_rawdata *raw;
-		assert(ptr);			/* not acceptable to pass in a NULL value */
-		raw = (swig_lua_rawdata *) lua_newuserdata(L, sizeof(swig_lua_rawdata) - 1 + size);	/* alloc data */
-		raw->type = type;
-		raw->own = 0;
-		memcpy(raw->data, ptr, size);	/* copy the data */
-		_SWIG_Lua_AddMetatable(L, type);	/* add metatable */
-	}
-
+SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type)
+{
+  swig_lua_rawdata* raw;
+  assert(ptr); /* not acceptable to pass in a NULL value */
+  raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size);  /* alloc data */
+  raw->type=type;
+  raw->own=0;
+  memcpy(raw->data,ptr,size); /* copy the data */
+  _SWIG_Lua_AddMetatable(L,type); /* add metatable */
+}
+    
 /* converts a packed userdata. user for member fn pointers only */
-	SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State * L, int index, void *ptr, size_t size, swig_type_info * type) {
-		swig_lua_rawdata *raw;
-		raw = (swig_lua_rawdata *) lua_touserdata(L, index);	/* get data */
-		if (!raw)
-			return SWIG_ERROR;	/* error */
-		if (type == 0 || type == raw->type) {	/* void* or identical type */
-			memcpy(ptr, raw->data, size);	/* copy it */
-			return SWIG_OK;		/* ok */
-		}
-		return SWIG_ERROR;		/* error */
-	}
+SWIGRUNTIME int  SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type)
+{
+  swig_lua_rawdata* raw;
+  raw=(swig_lua_rawdata*)lua_touserdata(L,index);  /* get data */
+  if (!raw) return SWIG_ERROR;  /* error */
+  if (type==0 || type==raw->type) /* void* or identical type */
+  {
+    memcpy(ptr,raw->data,size); /* copy it */
+    return SWIG_OK; /* ok */
+  }
+  return SWIG_ERROR;  /* error */
+}
 
 /* a function to get the typestring of a piece of data */
-	SWIGRUNTIME const char *SWIG_Lua_typename(lua_State * L, int tp) {
-		swig_lua_userdata *usr;
-		if (lua_isuserdata(L, tp)) {
-			usr = (swig_lua_userdata *) lua_touserdata(L, 1);	/* get data */
-			if (usr && usr->type && usr->type->str)
-				return usr->type->str;
-			return "userdata (unknown type)";
-		}
-		return lua_typename(L, lua_type(L, tp));
-	}
+SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
+{
+  swig_lua_userdata* usr;
+  if (lua_isuserdata(L,tp))
+  {
+    usr=(swig_lua_userdata*)lua_touserdata(L,1);  /* get data */
+    if (usr && usr->type && usr->type->str)
+      return usr->type->str;
+    return "userdata (unknown type)";
+  }
+  return lua_typename(L,lua_type(L,tp));
+}
 
 /* lua callable function to get the userdata's type */
-	SWIGRUNTIME int SWIG_Lua_type(lua_State * L) {
-		lua_pushstring(L, SWIG_Lua_typename(L, 1));
-		return 1;
-	}
+SWIGRUNTIME int SWIG_Lua_type(lua_State* L)
+{
+  lua_pushstring(L,SWIG_Lua_typename(L,1));
+  return 1;
+}
 
 /* lua callable function to compare userdata's value
 the issue is that two userdata may point to the same thing
 but to lua, they are different objects */
-	SWIGRUNTIME int SWIG_Lua_equal(lua_State * L) {
-		int result;
-		swig_lua_userdata *usr1, *usr2;
-		if (!lua_isuserdata(L, 1) || !lua_isuserdata(L, 2))	/* just in case */
-			return 0;			/* nil reply */
-		usr1 = (swig_lua_userdata *) lua_touserdata(L, 1);	/* get data */
-		usr2 = (swig_lua_userdata *) lua_touserdata(L, 2);	/* get data */
-		/*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same */
-		result = (usr1->ptr == usr2->ptr);
-		lua_pushboolean(L, result);
-		return 1;
-	}
+SWIGRUNTIME int SWIG_Lua_equal(lua_State* L)
+{
+  int result;
+  swig_lua_userdata *usr1,*usr2;
+  if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2))  /* just in case */
+    return 0;  /* nil reply */
+  usr1=(swig_lua_userdata*)lua_touserdata(L,1);  /* get data */
+  usr2=(swig_lua_userdata*)lua_touserdata(L,2);  /* get data */
+  /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
+  result=(usr1->ptr==usr2->ptr);
+   lua_pushboolean(L,result);
+  return 1;
+}
 
 /* -----------------------------------------------------------------------------
  * global variable support code: class/struct typemap functions
  * ----------------------------------------------------------------------------- */
 
 /* Install Constants */
-	SWIGINTERN void
-	     SWIG_Lua_InstallConstants(lua_State * L, swig_lua_const_info constants[]) {
-		int i;
-		for (i = 0; constants[i].type; i++) {
-			switch (constants[i].type) {
-			case SWIG_LUA_INT:
-				lua_pushstring(L, constants[i].name);
-				lua_pushnumber(L, (lua_Number) constants[i].lvalue);
-				lua_rawset(L, -3);
-				break;
-			case SWIG_LUA_FLOAT:
-				lua_pushstring(L, constants[i].name);
-				lua_pushnumber(L, (lua_Number) constants[i].dvalue);
-				lua_rawset(L, -3);
-				break;
-			case SWIG_LUA_CHAR:
-				lua_pushstring(L, constants[i].name);
-				lua_pushfstring(L, "%c", (char) constants[i].lvalue);
-				lua_rawset(L, -3);
-				break;
-			case SWIG_LUA_STRING:
-				lua_pushstring(L, constants[i].name);
-				lua_pushstring(L, (char *) constants[i].pvalue);
-				lua_rawset(L, -3);
-				break;
-			case SWIG_LUA_POINTER:
-				lua_pushstring(L, constants[i].name);
-				SWIG_NewPointerObj(L, constants[i].pvalue, *(constants[i]).ptype, 0);
-				lua_rawset(L, -3);
-				break;
-			case SWIG_LUA_BINARY:
-				lua_pushstring(L, constants[i].name);
-				SWIG_NewMemberObj(L, constants[i].pvalue, constants[i].lvalue, *(constants[i]).ptype);
-				lua_rawset(L, -3);
-				break;
-			default:
-				break;
-			}
-		}
-	}
+SWIGINTERN void
+SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
+  int i;
+  for (i = 0; constants[i].type; i++) {
+    switch(constants[i].type) {
+    case SWIG_LUA_INT:
+      lua_pushstring(L,constants[i].name);
+      lua_pushnumber(L,(lua_Number)constants[i].lvalue);
+      lua_rawset(L,-3);
+      break;
+    case SWIG_LUA_FLOAT:
+      lua_pushstring(L,constants[i].name);
+      lua_pushnumber(L,(lua_Number)constants[i].dvalue);
+      lua_rawset(L,-3);
+      break;
+    case SWIG_LUA_CHAR:
+      lua_pushstring(L,constants[i].name);
+      lua_pushfstring(L,"%c",(char)constants[i].lvalue);
+      lua_rawset(L,-3);
+      break;
+    case SWIG_LUA_STRING:
+      lua_pushstring(L,constants[i].name);
+      lua_pushstring(L,(char *) constants[i].pvalue);
+      lua_rawset(L,-3);
+      break;
+    case SWIG_LUA_POINTER:
+      lua_pushstring(L,constants[i].name);
+      SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
+      lua_rawset(L,-3);
+      break;
+    case SWIG_LUA_BINARY:
+      lua_pushstring(L,constants[i].name);
+      SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
+      lua_rawset(L,-3);
+      break;
+    default:
+      break;
+    }
+  }
+}
 
 /* -----------------------------------------------------------------------------
  * executing lua code from within the wrapper
  * ----------------------------------------------------------------------------- */
 
-#ifndef SWIG_DOSTRING_FAIL		/* Allows redefining of error function */
+#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
 #define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
 #endif
 /* Executes a C string in Lua a really simple way of calling lua from C
@@ -1408,23 +1458,22 @@
 In lua 5.0.X its lua_dostring()
 In lua 5.1.X its luaL_dostring()
 */
-	SWIGINTERN int
-	    SWIG_Lua_dostring(lua_State * L, const char *str) {
-		int ok, top;
-		if (str == 0 || str[0] == 0)
-			return 0;			/* nothing to do */
-		top = lua_gettop(L);	/* save stack */
+SWIGINTERN int 
+SWIG_Lua_dostring(lua_State *L, const char* str) {
+  int ok,top;
+  if (str==0 || str[0]==0) return 0; /* nothing to do */
+  top=lua_gettop(L); /* save stack */
 #if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
-		ok = luaL_dostring(L, str);	/* looks like this is lua 5.1.X or later, good */
+  ok=luaL_dostring(L,str);	/* looks like this is lua 5.1.X or later, good */
 #else
-		ok = lua_dostring(L, str);	/* might be lua 5.0.x, using lua_dostring */
+  ok=lua_dostring(L,str);	/* might be lua 5.0.x, using lua_dostring */
 #endif
-		if (ok != 0) {
-			SWIG_DOSTRING_FAIL(lua_tostring(L, -1));
-		}
-		lua_settop(L, top);		/* restore the stack */
-		return ok;
-	}
+  if (ok!=0) {
+    SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
+  }
+  lua_settop(L,top); /* restore the stack */
+  return ok;
+}    
 
 #ifdef __cplusplus
 }
@@ -1437,26 +1486,31 @@
 
 #define SWIGTYPE_p_API swig_types[0]
 #define SWIGTYPE_p_CoreSession swig_types[1]
-#define SWIGTYPE_p_Event swig_types[2]
-#define SWIGTYPE_p_IVRMenu swig_types[3]
-#define SWIGTYPE_p_LUA__Session swig_types[4]
-#define SWIGTYPE_p_Stream swig_types[5]
-#define SWIGTYPE_p_input_callback_state swig_types[6]
-#define SWIGTYPE_p_lua_State swig_types[7]
-#define SWIGTYPE_p_session_flag_t swig_types[8]
-#define SWIGTYPE_p_switch_channel_state_t swig_types[9]
-#define SWIGTYPE_p_switch_channel_t swig_types[10]
-#define SWIGTYPE_p_switch_core_session_t swig_types[11]
-#define SWIGTYPE_p_switch_event_t swig_types[12]
-#define SWIGTYPE_p_switch_input_args_t swig_types[13]
-#define SWIGTYPE_p_switch_input_type_t swig_types[14]
-#define SWIGTYPE_p_switch_priority_t swig_types[15]
-#define SWIGTYPE_p_switch_status_t swig_types[16]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[17]
-#define SWIGTYPE_p_void swig_types[18]
-static swig_type_info *swig_types[20];
-static swig_module_info swig_module = { swig_types, 19, 0, 0, 0, 0 };
-
+#define SWIGTYPE_p_DTMF swig_types[2]
+#define SWIGTYPE_p_Event swig_types[3]
+#define SWIGTYPE_p_EventConsumer swig_types[4]
+#define SWIGTYPE_p_IVRMenu swig_types[5]
+#define SWIGTYPE_p_LUA__Session swig_types[6]
+#define SWIGTYPE_p_Stream swig_types[7]
+#define SWIGTYPE_p_input_callback_state swig_types[8]
+#define SWIGTYPE_p_lua_State swig_types[9]
+#define SWIGTYPE_p_session_flag_t swig_types[10]
+#define SWIGTYPE_p_switch_channel_state_t swig_types[11]
+#define SWIGTYPE_p_switch_channel_t swig_types[12]
+#define SWIGTYPE_p_switch_core_session_t swig_types[13]
+#define SWIGTYPE_p_switch_event_node_t swig_types[14]
+#define SWIGTYPE_p_switch_event_t swig_types[15]
+#define SWIGTYPE_p_switch_event_types_t swig_types[16]
+#define SWIGTYPE_p_switch_input_args_t swig_types[17]
+#define SWIGTYPE_p_switch_input_type_t swig_types[18]
+#define SWIGTYPE_p_switch_priority_t swig_types[19]
+#define SWIGTYPE_p_switch_queue_t swig_types[20]
+#define SWIGTYPE_p_switch_status_t swig_types[21]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[22]
+#define SWIGTYPE_p_uint32_t swig_types[23]
+#define SWIGTYPE_p_void swig_types[24]
+static swig_type_info *swig_types[26];
+static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -1470,5297 +1524,6175 @@
 
 
 namespace swig {
-	typedef struct {
-	} LANGUAGE_OBJ;
+typedef struct{} LANGUAGE_OBJ;
 }
+
+
 #include "switch.h"
 #include "switch_cpp.h"
 #include "freeswitch_lua.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
-	static int _wrap_consoleLog(lua_State * L) {
-		int SWIG_arg = -1;
-		char *arg1 = (char *) 0;
-		char *arg2 = (char *) 0;
-
-		     SWIG_check_num_args("consoleLog", 2, 2)
-		if   (!lua_isstring(L, 1))
-			     SWIG_fail_arg("consoleLog", 1, "char *");
-		if   (!lua_isstring(L, 2))
-			     SWIG_fail_arg("consoleLog", 2, "char *");
-		     arg1 = (char *) lua_tostring(L, 1);
-		     arg2 = (char *) lua_tostring(L, 2);
-		     consoleLog(arg1, arg2);
-		     SWIG_arg = 0;
-
-		     return SWIG_arg;
-
-		if   (0)
-			     SWIG_fail;
-
-		     fail:lua_error(L);
-		     return SWIG_arg;
-	} static int _wrap_consoleCleanLog(lua_State * L) {
-		int SWIG_arg = -1;
-		char *arg1 = (char *) 0;
-
-		SWIG_check_num_args("consoleCleanLog", 1, 1)
-			if (!lua_isstring(L, 1))
-			SWIG_fail_arg("consoleCleanLog", 1, "char *");
-		arg1 = (char *) lua_tostring(L, 1);
-		consoleCleanLog(arg1);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_new_IVRMenu(lua_State * L) {
-		int SWIG_arg = -1;
-		IVRMenu *arg1 = (IVRMenu *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *arg4 = (char *) 0;
-		char *arg5 = (char *) 0;
-		char *arg6 = (char *) 0;
-		char *arg7 = (char *) 0;
-		char *arg8 = (char *) 0;
-		int arg9;
-		int arg10;
-		int arg11;
-		int arg12;
-		int arg13;
-		IVRMenu *result = 0;
-
-		SWIG_check_num_args("IVRMenu", 13, 13)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("IVRMenu", 1, "IVRMenu *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("IVRMenu", 2, "char const *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("IVRMenu", 3, "char const *");
-		if (!lua_isstring(L, 4))
-			SWIG_fail_arg("IVRMenu", 4, "char const *");
-		if (!lua_isstring(L, 5))
-			SWIG_fail_arg("IVRMenu", 5, "char const *");
-		if (!lua_isstring(L, 6))
-			SWIG_fail_arg("IVRMenu", 6, "char const *");
-		if (!lua_isstring(L, 7))
-			SWIG_fail_arg("IVRMenu", 7, "char const *");
-		if (!lua_isstring(L, 8))
-			SWIG_fail_arg("IVRMenu", 8, "char const *");
-		if (!lua_isnumber(L, 9))
-			SWIG_fail_arg("IVRMenu", 9, "int");
-		if (!lua_isnumber(L, 10))
-			SWIG_fail_arg("IVRMenu", 10, "int");
-		if (!lua_isnumber(L, 11))
-			SWIG_fail_arg("IVRMenu", 11, "int");
-		if (!lua_isnumber(L, 12))
-			SWIG_fail_arg("IVRMenu", 12, "int");
-		if (!lua_isnumber(L, 13))
-			SWIG_fail_arg("IVRMenu", 13, "int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, 0))) {
-			SWIG_fail_ptr("new_IVRMenu", 1, SWIGTYPE_p_IVRMenu);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		arg4 = (char *) lua_tostring(L, 4);
-		arg5 = (char *) lua_tostring(L, 5);
-		arg6 = (char *) lua_tostring(L, 6);
-		arg7 = (char *) lua_tostring(L, 7);
-		arg8 = (char *) lua_tostring(L, 8);
-		arg9 = (int) lua_tonumber(L, 9);
-		arg10 = (int) lua_tonumber(L, 10);
-		arg11 = (int) lua_tonumber(L, 11);
-		arg12 = (int) lua_tonumber(L, 12);
-		arg13 = (int) lua_tonumber(L, 13);
-		result =
-			(IVRMenu *) new IVRMenu(arg1, (char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5, (char const *) arg6,
-									(char const *) arg7, (char const *) arg8, arg9, arg10, arg11, arg12, arg13);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_IVRMenu, 1);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
+static int _wrap_consoleLog(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("consoleLog",2,2)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("consoleLog",1,"char *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("consoleLog",2,"char *");
+  arg1 = (char *)lua_tostring(L, 1);
+  arg2 = (char *)lua_tostring(L, 2);
+  consoleLog(arg1,arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_delete_IVRMenu(lua_State * L) {
-		int SWIG_arg = -1;
-		IVRMenu *arg1 = (IVRMenu *) 0;
 
-		SWIG_check_num_args("IVRMenu", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("IVRMenu", 1, "IVRMenu *");
+static int _wrap_consoleCleanLog(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  
+  SWIG_check_num_args("consoleCleanLog",1,1)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("consoleCleanLog",1,"char *");
+  arg1 = (char *)lua_tostring(L, 1);
+  consoleCleanLog(arg1);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN))) {
-			SWIG_fail_ptr("delete_IVRMenu", 1, SWIGTYPE_p_IVRMenu);
-		}
 
-		delete arg1;
+static int _wrap_new_IVRMenu(lua_State* L) {
+  int SWIG_arg = -1;
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  int arg9 ;
+  int arg10 ;
+  int arg11 ;
+  int arg12 ;
+  int arg13 ;
+  IVRMenu *result = 0 ;
+  
+  SWIG_check_num_args("IVRMenu",13,13)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("IVRMenu",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("IVRMenu",3,"char const *");
+  if(!lua_isstring(L,4)) SWIG_fail_arg("IVRMenu",4,"char const *");
+  if(!lua_isstring(L,5)) SWIG_fail_arg("IVRMenu",5,"char const *");
+  if(!lua_isstring(L,6)) SWIG_fail_arg("IVRMenu",6,"char const *");
+  if(!lua_isstring(L,7)) SWIG_fail_arg("IVRMenu",7,"char const *");
+  if(!lua_isstring(L,8)) SWIG_fail_arg("IVRMenu",8,"char const *");
+  if(!lua_isnumber(L,9)) SWIG_fail_arg("IVRMenu",9,"int");
+  if(!lua_isnumber(L,10)) SWIG_fail_arg("IVRMenu",10,"int");
+  if(!lua_isnumber(L,11)) SWIG_fail_arg("IVRMenu",11,"int");
+  if(!lua_isnumber(L,12)) SWIG_fail_arg("IVRMenu",12,"int");
+  if(!lua_isnumber(L,13)) SWIG_fail_arg("IVRMenu",13,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
+    SWIG_fail_ptr("new_IVRMenu",1,SWIGTYPE_p_IVRMenu);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  arg4 = (char *)lua_tostring(L, 4);
+  arg5 = (char *)lua_tostring(L, 5);
+  arg6 = (char *)lua_tostring(L, 6);
+  arg7 = (char *)lua_tostring(L, 7);
+  arg8 = (char *)lua_tostring(L, 8);
+  arg9 = (int)lua_tonumber(L, 9);
+  arg10 = (int)lua_tonumber(L, 10);
+  arg11 = (int)lua_tonumber(L, 11);
+  arg12 = (int)lua_tonumber(L, 12);
+  arg13 = (int)lua_tonumber(L, 13);
+  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_IVRMenu,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		SWIG_arg = 0;
 
-		return SWIG_arg;
+static int _wrap_delete_IVRMenu(lua_State* L) {
+  int SWIG_arg = -1;
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  
+  SWIG_check_num_args("IVRMenu",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_IVRMenu",1,SWIGTYPE_p_IVRMenu);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (0)
-			SWIG_fail;
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_IVRMenu_bindAction(lua_State* L) {
+  int SWIG_arg = -1;
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  
+  SWIG_check_num_args("bindAction",4,4)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bindAction",1,"IVRMenu *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("bindAction",2,"char *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("bindAction",3,"char const *");
+  if(!lua_isstring(L,4)) SWIG_fail_arg("bindAction",4,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
+    SWIG_fail_ptr("IVRMenu_bindAction",1,SWIGTYPE_p_IVRMenu);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  arg4 = (char *)lua_tostring(L, 4);
+  (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_IVRMenu_bindAction(lua_State * L) {
-		int SWIG_arg = -1;
-		IVRMenu *arg1 = (IVRMenu *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *arg4 = (char *) 0;
-
-		SWIG_check_num_args("bindAction", 4, 4)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("bindAction", 1, "IVRMenu *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("bindAction", 2, "char *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("bindAction", 3, "char const *");
-		if (!lua_isstring(L, 4))
-			SWIG_fail_arg("bindAction", 4, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, 0))) {
-			SWIG_fail_ptr("IVRMenu_bindAction", 1, SWIGTYPE_p_IVRMenu);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		arg4 = (char *) lua_tostring(L, 4);
-		(arg1)->bindAction(arg2, (char const *) arg3, (char const *) arg4);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_IVRMenu_execute(lua_State* L) {
+  int SWIG_arg = -1;
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  SWIG_check_num_args("execute",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"IVRMenu *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("execute",2,"CoreSession *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
+    SWIG_fail_ptr("IVRMenu_execute",1,SWIGTYPE_p_IVRMenu);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("IVRMenu_execute",2,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg3 = (char *)lua_tostring(L, 3);
+  (arg1)->execute(arg2,(char const *)arg3);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_IVRMenu_execute(lua_State * L) {
-		int SWIG_arg = -1;
-		IVRMenu *arg1 = (IVRMenu *) 0;
-		CoreSession *arg2 = (CoreSession *) 0;
-		char *arg3 = (char *) 0;
-
-		SWIG_check_num_args("execute", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("execute", 1, "IVRMenu *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("execute", 2, "CoreSession *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("execute", 3, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, 0))) {
-			SWIG_fail_ptr("IVRMenu_execute", 1, SWIGTYPE_p_IVRMenu);
-		}
-
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("IVRMenu_execute", 2, SWIGTYPE_p_CoreSession);
-		}
-
-		arg3 = (char *) lua_tostring(L, 3);
-		(arg1)->execute(arg2, (char const *) arg3);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static void swig_delete_IVRMenu(void *obj) {
+IVRMenu *arg1 = (IVRMenu *) obj;
+delete arg1;
+}
+static swig_lua_method swig_IVRMenu_methods[] = {
+    {"bindAction", _wrap_IVRMenu_bindAction}, 
+    {"execute", _wrap_IVRMenu_execute}, 
+    {0,0}
+};
+static swig_lua_attribute swig_IVRMenu_attributes[] = {
+    {0,0,0}
+};
+static swig_lua_class *swig_IVRMenu_bases[] = {0};
+static const char *swig_IVRMenu_base_names[] = {0};
+static swig_lua_class _wrap_class_IVRMenu = { "IVRMenu", &SWIGTYPE_p_IVRMenu,_wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases, swig_IVRMenu_base_names };
+
+static int _wrap_new_API(lua_State* L) {
+  int SWIG_arg = -1;
+  API *result = 0 ;
+  
+  SWIG_check_num_args("API",0,0)
+  result = (API *)new API();
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_API,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static void swig_delete_IVRMenu(void *obj) {
-		IVRMenu *arg1 = (IVRMenu *) obj;
-		delete arg1;
-	}
-	static swig_lua_method swig_IVRMenu_methods[] = {
-		{"bindAction", _wrap_IVRMenu_bindAction},
-		{"execute", _wrap_IVRMenu_execute},
-		{0, 0}
-	};
-	static swig_lua_attribute swig_IVRMenu_attributes[] = {
-		{0, 0, 0}
-	};
-	static swig_lua_class *swig_IVRMenu_bases[] = { 0 };
-	static const char *swig_IVRMenu_base_names[] = { 0 };
-	static swig_lua_class _wrap_class_IVRMenu =
-		{ "IVRMenu", &SWIGTYPE_p_IVRMenu, _wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases,
-swig_IVRMenu_base_names };
-
-	static int _wrap_new_API(lua_State * L) {
-		int SWIG_arg = -1;
-		API *result = 0;
-
-		SWIG_check_num_args("API", 0, 0)
-		result = (API *) new API();
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_API, 1);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_delete_API(lua_State* L) {
+  int SWIG_arg = -1;
+  API *arg1 = (API *) 0 ;
+  
+  SWIG_check_num_args("API",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("API",1,"API *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_API",1,SWIGTYPE_p_API);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_delete_API(lua_State * L) {
-		int SWIG_arg = -1;
-		API *arg1 = (API *) 0;
+static int _wrap_API_execute(lua_State* L) {
+  int SWIG_arg = -1;
+  API *arg1 = (API *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("execute",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"API *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){
+    SWIG_fail_ptr("API_execute",1,SWIGTYPE_p_API);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		SWIG_check_num_args("API", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("API", 1, "API *");
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_API, SWIG_POINTER_DISOWN))) {
-			SWIG_fail_ptr("delete_API", 1, SWIGTYPE_p_API);
-		}
+static int _wrap_API_executeString(lua_State* L) {
+  int SWIG_arg = -1;
+  API *arg1 = (API *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("executeString",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("executeString",1,"API *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("executeString",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){
+    SWIG_fail_ptr("API_executeString",1,SWIGTYPE_p_API);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (char *)(arg1)->executeString((char const *)arg2);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		delete arg1;
 
-		SWIG_arg = 0;
+static void swig_delete_API(void *obj) {
+API *arg1 = (API *) obj;
+delete arg1;
+}
+static swig_lua_method swig_API_methods[] = {
+    {"execute", _wrap_API_execute}, 
+    {"executeString", _wrap_API_executeString}, 
+    {0,0}
+};
+static swig_lua_attribute swig_API_attributes[] = {
+    {0,0,0}
+};
+static swig_lua_class *swig_API_bases[] = {0};
+static const char *swig_API_base_names[] = {0};
+static swig_lua_class _wrap_class_API = { "API", &SWIGTYPE_p_API,_wrap_new_API, swig_delete_API, swig_API_methods, swig_API_attributes, swig_API_bases, swig_API_base_names };
+
+static int _wrap_input_callback_state_t_function_set(lua_State* L) {
+  int SWIG_arg = -1;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  SWIG_check_num_args("function",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("function",1,"input_callback_state_t *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("function",2,"void *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
+    SWIG_fail_ptr("input_callback_state_t_function_set",1,SWIGTYPE_p_input_callback_state);
+  }
+  
+  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_function_set");
+  if (arg1) (arg1)->function = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		return SWIG_arg;
 
-		if (0)
-			SWIG_fail;
+static int _wrap_input_callback_state_t_function_get(lua_State* L) {
+  int SWIG_arg = -1;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *result = 0 ;
+  
+  SWIG_check_num_args("function",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("function",1,"input_callback_state_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
+    SWIG_fail_ptr("input_callback_state_t_function_get",1,SWIGTYPE_p_input_callback_state);
+  }
+  
+  result = (void *) ((arg1)->function);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
-
-	static int _wrap_API_execute(lua_State * L) {
-		int SWIG_arg = -1;
-		API *arg1 = (API *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("execute", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("execute", 1, "API *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("execute", 2, "char const *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("execute", 3, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_API, 0))) {
-			SWIG_fail_ptr("API_execute", 1, SWIGTYPE_p_API);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		result = (char *) (arg1)->execute((char const *) arg2, (char const *) arg3);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_API_executeString(lua_State * L) {
-		int SWIG_arg = -1;
-		API *arg1 = (API *) 0;
-		char *arg2 = (char *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("executeString", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("executeString", 1, "API *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("executeString", 2, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_API, 0))) {
-			SWIG_fail_ptr("API_executeString", 1, SWIGTYPE_p_API);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (char *) (arg1)->executeString((char const *) arg2);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_input_callback_state_t_threadState_set(lua_State* L) {
+  int SWIG_arg = -1;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  SWIG_check_num_args("threadState",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("threadState",1,"input_callback_state_t *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("threadState",2,"void *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
+    SWIG_fail_ptr("input_callback_state_t_threadState_set",1,SWIGTYPE_p_input_callback_state);
+  }
+  
+  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_threadState_set");
+  if (arg1) (arg1)->threadState = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static void swig_delete_API(void *obj) {
-		API *arg1 = (API *) obj;
-		delete arg1;
-	}
-	static swig_lua_method swig_API_methods[] = {
-		{"execute", _wrap_API_execute},
-		{"executeString", _wrap_API_executeString},
-		{0, 0}
-	};
-	static swig_lua_attribute swig_API_attributes[] = {
-		{0, 0, 0}
-	};
-	static swig_lua_class *swig_API_bases[] = { 0 };
-	static const char *swig_API_base_names[] = { 0 };
-	static swig_lua_class _wrap_class_API =
-		{ "API", &SWIGTYPE_p_API, _wrap_new_API, swig_delete_API, swig_API_methods, swig_API_attributes, swig_API_bases, swig_API_base_names };
-
-	static int _wrap_input_callback_state_t_function_set(lua_State * L) {
-		int SWIG_arg = -1;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *arg2 = (void *) 0;
-
-		SWIG_check_num_args("function", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("function", 1, "input_callback_state_t *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("function", 2, "void *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
-			SWIG_fail_ptr("input_callback_state_t_function_set", 1, SWIGTYPE_p_input_callback_state);
-		}
-
-		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "input_callback_state_t_function_set");
-		if (arg1)
-			(arg1)->function = arg2;
-
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_input_callback_state_t_threadState_get(lua_State* L) {
+  int SWIG_arg = -1;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *result = 0 ;
+  
+  SWIG_check_num_args("threadState",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("threadState",1,"input_callback_state_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
+    SWIG_fail_ptr("input_callback_state_t_threadState_get",1,SWIGTYPE_p_input_callback_state);
+  }
+  
+  result = (void *) ((arg1)->threadState);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_input_callback_state_t_function_get(lua_State * L) {
-		int SWIG_arg = -1;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *result = 0;
-
-		SWIG_check_num_args("function", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("function", 1, "input_callback_state_t *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
-			SWIG_fail_ptr("input_callback_state_t_function_get", 1, SWIGTYPE_p_input_callback_state);
-		}
-
-		result = (void *) ((arg1)->function);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_input_callback_state_t_extra_set(lua_State* L) {
+  int SWIG_arg = -1;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  SWIG_check_num_args("extra",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("extra",1,"input_callback_state_t *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("extra",2,"void *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
+    SWIG_fail_ptr("input_callback_state_t_extra_set",1,SWIGTYPE_p_input_callback_state);
+  }
+  
+  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_extra_set");
+  if (arg1) (arg1)->extra = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_input_callback_state_t_threadState_set(lua_State * L) {
-		int SWIG_arg = -1;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *arg2 = (void *) 0;
-
-		SWIG_check_num_args("threadState", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("threadState", 1, "input_callback_state_t *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("threadState", 2, "void *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
-			SWIG_fail_ptr("input_callback_state_t_threadState_set", 1, SWIGTYPE_p_input_callback_state);
-		}
-
-		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "input_callback_state_t_threadState_set");
-		if (arg1)
-			(arg1)->threadState = arg2;
-
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_input_callback_state_t_extra_get(lua_State* L) {
+  int SWIG_arg = -1;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *result = 0 ;
+  
+  SWIG_check_num_args("extra",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("extra",1,"input_callback_state_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
+    SWIG_fail_ptr("input_callback_state_t_extra_get",1,SWIGTYPE_p_input_callback_state);
+  }
+  
+  result = (void *) ((arg1)->extra);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_input_callback_state_t_threadState_get(lua_State * L) {
-		int SWIG_arg = -1;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *result = 0;
-
-		SWIG_check_num_args("threadState", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("threadState", 1, "input_callback_state_t *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
-			SWIG_fail_ptr("input_callback_state_t_threadState_get", 1, SWIGTYPE_p_input_callback_state);
-		}
-
-		result = (void *) ((arg1)->threadState);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_input_callback_state_t_funcargs_set(lua_State* L) {
+  int SWIG_arg = -1;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("funcargs",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("funcargs",1,"input_callback_state_t *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("funcargs",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
+    SWIG_fail_ptr("input_callback_state_t_funcargs_set",1,SWIGTYPE_p_input_callback_state);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->funcargs) delete [] arg1->funcargs;
+    if (arg2) {
+      arg1->funcargs = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->funcargs, (const char *)arg2);
+    } else {
+      arg1->funcargs = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_input_callback_state_t_extra_set(lua_State * L) {
-		int SWIG_arg = -1;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *arg2 = (void *) 0;
-
-		SWIG_check_num_args("extra", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("extra", 1, "input_callback_state_t *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("extra", 2, "void *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
-			SWIG_fail_ptr("input_callback_state_t_extra_set", 1, SWIGTYPE_p_input_callback_state);
-		}
-
-		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "input_callback_state_t_extra_set");
-		if (arg1)
-			(arg1)->extra = arg2;
-
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_input_callback_state_t_funcargs_get(lua_State* L) {
+  int SWIG_arg = -1;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("funcargs",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("funcargs",1,"input_callback_state_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
+    SWIG_fail_ptr("input_callback_state_t_funcargs_get",1,SWIGTYPE_p_input_callback_state);
+  }
+  
+  result = (char *) ((arg1)->funcargs);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_input_callback_state_t_extra_get(lua_State * L) {
-		int SWIG_arg = -1;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *result = 0;
-
-		SWIG_check_num_args("extra", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("extra", 1, "input_callback_state_t *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
-			SWIG_fail_ptr("input_callback_state_t_extra_get", 1, SWIGTYPE_p_input_callback_state);
-		}
-
-		result = (void *) ((arg1)->extra);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_new_input_callback_state_t(lua_State* L) {
+  int SWIG_arg = -1;
+  input_callback_state_t *result = 0 ;
+  
+  SWIG_check_num_args("input_callback_state_t::input_callback_state_t",0,0)
+  result = (input_callback_state_t *)new input_callback_state_t();
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_input_callback_state,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_input_callback_state_t_funcargs_set(lua_State * L) {
-		int SWIG_arg = -1;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("funcargs", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("funcargs", 1, "input_callback_state_t *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("funcargs", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
-			SWIG_fail_ptr("input_callback_state_t_funcargs_set", 1, SWIGTYPE_p_input_callback_state);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		{
-			if (arg1->funcargs)
-				delete[]arg1->funcargs;
-			if (arg2) {
-				arg1->funcargs = (char *) (new char[strlen((const char *)arg2) + 1]);
-				strcpy((char *) arg1->funcargs, (const char *) arg2);
-			} else {
-				arg1->funcargs = 0;
-			}
-		}
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_delete_input_callback_state_t(lua_State* L) {
+  int SWIG_arg = -1;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  
+  SWIG_check_num_args("input_callback_state_t::~input_callback_state_t",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("input_callback_state_t::~input_callback_state_t",1,"input_callback_state_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_input_callback_state_t",1,SWIGTYPE_p_input_callback_state);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_input_callback_state_t_funcargs_get(lua_State * L) {
-		int SWIG_arg = -1;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("funcargs", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("funcargs", 1, "input_callback_state_t *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
-			SWIG_fail_ptr("input_callback_state_t_funcargs_get", 1, SWIGTYPE_p_input_callback_state);
-		}
-
-		result = (char *) ((arg1)->funcargs);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static void swig_delete_input_callback_state_t(void *obj) {
+input_callback_state_t *arg1 = (input_callback_state_t *) obj;
+delete arg1;
+}
+static swig_lua_method swig_input_callback_state_t_methods[] = {
+    {0,0}
+};
+static swig_lua_attribute swig_input_callback_state_t_attributes[] = {
+    { "function", _wrap_input_callback_state_t_function_get, _wrap_input_callback_state_t_function_set},
+    { "threadState", _wrap_input_callback_state_t_threadState_get, _wrap_input_callback_state_t_threadState_set},
+    { "extra", _wrap_input_callback_state_t_extra_get, _wrap_input_callback_state_t_extra_set},
+    { "funcargs", _wrap_input_callback_state_t_funcargs_get, _wrap_input_callback_state_t_funcargs_set},
+    {0,0,0}
+};
+static swig_lua_class *swig_input_callback_state_t_bases[] = {0};
+static const char *swig_input_callback_state_t_base_names[] = {0};
+static swig_lua_class _wrap_class_input_callback_state_t = { "input_callback_state_t", &SWIGTYPE_p_input_callback_state,_wrap_new_input_callback_state_t, swig_delete_input_callback_state_t, swig_input_callback_state_t_methods, swig_input_callback_state_t_attributes, swig_input_callback_state_t_bases, swig_input_callback_state_t_base_names };
+
+static int _wrap_DTMF_digit_set(lua_State* L) {
+  int SWIG_arg = -1;
+  DTMF *arg1 = (DTMF *) 0 ;
+  char arg2 ;
+  
+  SWIG_check_num_args("digit",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("digit",1,"DTMF *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("digit",2,"char");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){
+    SWIG_fail_ptr("DTMF_digit_set",1,SWIGTYPE_p_DTMF);
+  }
+  
+  arg2 = (lua_tostring(L, 2))[0];
+  if (arg1) (arg1)->digit = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_new_input_callback_state_t(lua_State * L) {
-		int SWIG_arg = -1;
-		input_callback_state_t *result = 0;
-
-		SWIG_check_num_args("input_callback_state_t::input_callback_state_t", 0, 0)
-		result = (input_callback_state_t *) new input_callback_state_t();
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_input_callback_state, 1);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_DTMF_digit_get(lua_State* L) {
+  int SWIG_arg = -1;
+  DTMF *arg1 = (DTMF *) 0 ;
+  char result;
+  
+  SWIG_check_num_args("digit",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("digit",1,"DTMF *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){
+    SWIG_fail_ptr("DTMF_digit_get",1,SWIGTYPE_p_DTMF);
+  }
+  
+  result = (char) ((arg1)->digit);
+  SWIG_arg=0;
+  lua_pushfstring(L,"%c",result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_delete_input_callback_state_t(lua_State * L) {
-		int SWIG_arg = -1;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+static int _wrap_DTMF_duration_set(lua_State* L) {
+  int SWIG_arg = -1;
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t arg2 ;
+  uint32_t *argp2 ;
+  
+  SWIG_check_num_args("duration",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("duration",1,"DTMF *");
+  if(!lua_isuserdata(L,2)) SWIG_fail_arg("duration",2,"uint32_t");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){
+    SWIG_fail_ptr("DTMF_duration_set",1,SWIGTYPE_p_DTMF);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_uint32_t,0))){
+    SWIG_fail_ptr("DTMF_duration_set",2,SWIGTYPE_p_uint32_t);
+  }
+  arg2 = *argp2;
+  
+  if (arg1) (arg1)->duration = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		SWIG_check_num_args("input_callback_state_t::~input_callback_state_t", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("input_callback_state_t::~input_callback_state_t", 1, "input_callback_state_t *");
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN))) {
-			SWIG_fail_ptr("delete_input_callback_state_t", 1, SWIGTYPE_p_input_callback_state);
-		}
+static int _wrap_DTMF_duration_get(lua_State* L) {
+  int SWIG_arg = -1;
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t result;
+  
+  SWIG_check_num_args("duration",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("duration",1,"DTMF *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){
+    SWIG_fail_ptr("DTMF_duration_get",1,SWIGTYPE_p_DTMF);
+  }
+  
+  result =  ((arg1)->duration);
+  SWIG_arg=0;
+  {
+    uint32_t * resultptr = new uint32_t((uint32_t &) result);
+    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_uint32_t,1); SWIG_arg++;
+  }
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		delete arg1;
 
-		SWIG_arg = 0;
+static int _wrap_new_DTMF__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  char arg1 ;
+  uint32_t arg2 ;
+  DTMF *result = 0 ;
+  uint32_t *argp2 ;
+  
+  SWIG_check_num_args("DTMF",2,2)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("DTMF",1,"char");
+  if(!lua_isuserdata(L,2)) SWIG_fail_arg("DTMF",2,"uint32_t");
+  arg1 = (lua_tostring(L, 1))[0];
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_uint32_t,0))){
+    SWIG_fail_ptr("new_DTMF",2,SWIGTYPE_p_uint32_t);
+  }
+  arg2 = *argp2;
+  
+  result = (DTMF *)new DTMF(arg1,arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_DTMF,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		return SWIG_arg;
 
-		if (0)
-			SWIG_fail;
+static int _wrap_new_DTMF__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  char arg1 ;
+  DTMF *result = 0 ;
+  
+  SWIG_check_num_args("DTMF",1,1)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("DTMF",1,"char");
+  arg1 = (lua_tostring(L, 1))[0];
+  result = (DTMF *)new DTMF(arg1);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_DTMF,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_new_DTMF(lua_State* L) {
+  int argc;
+  int argv[3]={
+    1,2,3
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 1) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]) && (lua_strlen(L,argv[0])==1);
+    }
+    if (_v) {
+      return _wrap_new_DTMF__SWIG_1(L);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]) && (lua_strlen(L,argv[0])==1);
+    }
+    if (_v) {
+      {
+        void *ptr;
+        if (lua_isuserdata(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_uint32_t, 0)) {
+          _v = 0;
+        } else {
+          _v = 1;
+        }
+      }
+      if (_v) {
+        return _wrap_new_DTMF__SWIG_0(L);
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'new_DTMF'");
+  lua_error(L);return 0;
+}
 
-	static void swig_delete_input_callback_state_t(void *obj) {
-		input_callback_state_t *arg1 = (input_callback_state_t *) obj;
-		delete arg1;
-	}
-	static swig_lua_method swig_input_callback_state_t_methods[] = {
-		{0, 0}
-	};
-	static swig_lua_attribute swig_input_callback_state_t_attributes[] = {
-		{"function", _wrap_input_callback_state_t_function_get, _wrap_input_callback_state_t_function_set},
-		{"threadState", _wrap_input_callback_state_t_threadState_get, _wrap_input_callback_state_t_threadState_set},
-		{"extra", _wrap_input_callback_state_t_extra_get, _wrap_input_callback_state_t_extra_set},
-		{"funcargs", _wrap_input_callback_state_t_funcargs_get, _wrap_input_callback_state_t_funcargs_set},
-		{0, 0, 0}
-	};
-	static swig_lua_class *swig_input_callback_state_t_bases[] = { 0 };
-	static const char *swig_input_callback_state_t_base_names[] = { 0 };
-	static swig_lua_class _wrap_class_input_callback_state_t =
-		{ "input_callback_state_t", &SWIGTYPE_p_input_callback_state, _wrap_new_input_callback_state_t, swig_delete_input_callback_state_t,
-swig_input_callback_state_t_methods, swig_input_callback_state_t_attributes, swig_input_callback_state_t_bases, swig_input_callback_state_t_base_names };
-
-	static int _wrap_new_Stream__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		Stream *result = 0;
-
-		SWIG_check_num_args("Stream", 0, 0)
-		result = (Stream *) new Stream();
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Stream, 1);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_delete_DTMF(lua_State* L) {
+  int SWIG_arg = -1;
+  DTMF *arg1 = (DTMF *) 0 ;
+  
+  SWIG_check_num_args("DTMF",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("DTMF",1,"DTMF *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_DTMF",1,SWIGTYPE_p_DTMF);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_new_Stream__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0;
-		Stream *result = 0;
-
-		SWIG_check_num_args("Stream", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("Stream", 1, "switch_stream_handle_t *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_stream_handle_t, 0))) {
-			SWIG_fail_ptr("new_Stream", 1, SWIGTYPE_p_switch_stream_handle_t);
-		}
-
-		result = (Stream *) new Stream(arg1);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Stream, 1);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static void swig_delete_DTMF(void *obj) {
+DTMF *arg1 = (DTMF *) obj;
+delete arg1;
+}
+static swig_lua_method swig_DTMF_methods[] = {
+    {0,0}
+};
+static swig_lua_attribute swig_DTMF_attributes[] = {
+    { "digit", _wrap_DTMF_digit_get, _wrap_DTMF_digit_set},
+    { "duration", _wrap_DTMF_duration_get, _wrap_DTMF_duration_set},
+    {0,0,0}
+};
+static swig_lua_class *swig_DTMF_bases[] = {0};
+static const char *swig_DTMF_base_names[] = {0};
+static swig_lua_class _wrap_class_DTMF = { "DTMF", &SWIGTYPE_p_DTMF,_wrap_new_DTMF, swig_delete_DTMF, swig_DTMF_methods, swig_DTMF_attributes, swig_DTMF_bases, swig_DTMF_base_names };
+
+static int _wrap_new_Stream__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  Stream *result = 0 ;
+  
+  SWIG_check_num_args("Stream",0,0)
+  result = (Stream *)new Stream();
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_new_Stream(lua_State * L) {
-		int argc;
-		int argv[2] = {
-			1, 2
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 0) {
-			return _wrap_new_Stream__SWIG_0(L);
-		}
-		if (argc == 1) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_stream_handle_t, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				return _wrap_new_Stream__SWIG_1(L);
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'new_Stream'");
-		lua_error(L);
-		return 0;
-	}
 
+static int _wrap_new_Stream__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
+  Stream *result = 0 ;
+  
+  SWIG_check_num_args("Stream",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Stream",1,"switch_stream_handle_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_stream_handle_t,0))){
+    SWIG_fail_ptr("new_Stream",1,SWIGTYPE_p_switch_stream_handle_t);
+  }
+  
+  result = (Stream *)new Stream(arg1);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_delete_Stream(lua_State * L) {
-		int SWIG_arg = -1;
-		Stream *arg1 = (Stream *) 0;
 
-		SWIG_check_num_args("Stream", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("Stream", 1, "Stream *");
+static int _wrap_new_Stream(lua_State* L) {
+  int argc;
+  int argv[2]={
+    1,2
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 0) {
+    return _wrap_new_Stream__SWIG_0(L);
+  }
+  if (argc == 1) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_stream_handle_t, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      return _wrap_new_Stream__SWIG_1(L);
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'new_Stream'");
+  lua_error(L);return 0;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN))) {
-			SWIG_fail_ptr("delete_Stream", 1, SWIGTYPE_p_Stream);
-		}
 
-		delete arg1;
+static int _wrap_delete_Stream(lua_State* L) {
+  int SWIG_arg = -1;
+  Stream *arg1 = (Stream *) 0 ;
+  
+  SWIG_check_num_args("Stream",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Stream",1,"Stream *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_Stream",1,SWIGTYPE_p_Stream);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		SWIG_arg = 0;
 
-		return SWIG_arg;
+static int _wrap_Stream_write(lua_State* L) {
+  int SWIG_arg = -1;
+  Stream *arg1 = (Stream *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("write",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("write",1,"Stream *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("write",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){
+    SWIG_fail_ptr("Stream_write",1,SWIGTYPE_p_Stream);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  (arg1)->write((char const *)arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (0)
-			SWIG_fail;
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Stream_get_data(lua_State* L) {
+  int SWIG_arg = -1;
+  Stream *arg1 = (Stream *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("get_data",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_data",1,"Stream *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){
+    SWIG_fail_ptr("Stream_get_data",1,SWIGTYPE_p_Stream);
+  }
+  
+  result = (char *)(arg1)->get_data();
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Stream_write(lua_State * L) {
-		int SWIG_arg = -1;
-		Stream *arg1 = (Stream *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("write", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("write", 1, "Stream *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("write", 2, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Stream, 0))) {
-			SWIG_fail_ptr("Stream_write", 1, SWIGTYPE_p_Stream);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		(arg1)->write((char const *) arg2);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static void swig_delete_Stream(void *obj) {
+Stream *arg1 = (Stream *) obj;
+delete arg1;
+}
+static swig_lua_method swig_Stream_methods[] = {
+    {"write", _wrap_Stream_write}, 
+    {"get_data", _wrap_Stream_get_data}, 
+    {0,0}
+};
+static swig_lua_attribute swig_Stream_attributes[] = {
+    {0,0,0}
+};
+static swig_lua_class *swig_Stream_bases[] = {0};
+static const char *swig_Stream_base_names[] = {0};
+static swig_lua_class _wrap_class_Stream = { "Stream", &SWIGTYPE_p_Stream,_wrap_new_Stream, swig_delete_Stream, swig_Stream_methods, swig_Stream_attributes, swig_Stream_bases, swig_Stream_base_names };
+
+static int _wrap_Event_event_set(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  switch_event_t *arg2 = (switch_event_t *) 0 ;
+  
+  SWIG_check_num_args("event",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"Event *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("event",2,"switch_event_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_event_set",1,SWIGTYPE_p_Event);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_event_t,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("Event_event_set",2,SWIGTYPE_p_switch_event_t);
+  }
+  
+  if (arg1) (arg1)->event = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Stream_get_data(lua_State * L) {
-		int SWIG_arg = -1;
-		Stream *arg1 = (Stream *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("get_data", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("get_data", 1, "Stream *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Stream, 0))) {
-			SWIG_fail_ptr("Stream_get_data", 1, SWIGTYPE_p_Stream);
-		}
-
-		result = (char *) (arg1)->get_data();
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_event_get(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  switch_event_t *result = 0 ;
+  
+  SWIG_check_num_args("event",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"Event *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_event_get",1,SWIGTYPE_p_Event);
+  }
+  
+  result = (switch_event_t *) ((arg1)->event);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_event_t,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static void swig_delete_Stream(void *obj) {
-		Stream *arg1 = (Stream *) obj;
-		delete arg1;
-	}
-	static swig_lua_method swig_Stream_methods[] = {
-		{"write", _wrap_Stream_write},
-		{"get_data", _wrap_Stream_get_data},
-		{0, 0}
-	};
-	static swig_lua_attribute swig_Stream_attributes[] = {
-		{0, 0, 0}
-	};
-	static swig_lua_class *swig_Stream_bases[] = { 0 };
-	static const char *swig_Stream_base_names[] = { 0 };
-	static swig_lua_class _wrap_class_Stream =
-		{ "Stream", &SWIGTYPE_p_Stream, _wrap_new_Stream, swig_delete_Stream, swig_Stream_methods, swig_Stream_attributes, swig_Stream_bases,
-swig_Stream_base_names };
-
-	static int _wrap_Event_event_set(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		switch_event_t *arg2 = (switch_event_t *) 0;
-
-		SWIG_check_num_args("event", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("event", 1, "Event *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("event", 2, "switch_event_t *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_event_set", 1, SWIGTYPE_p_Event);
-		}
-
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN))) {
-			SWIG_fail_ptr("Event_event_set", 2, SWIGTYPE_p_switch_event_t);
-		}
-
-		if (arg1)
-			(arg1)->event = arg2;
-
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_serialized_string_set(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("serialized_string",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"Event *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("serialized_string",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_serialized_string_set",1,SWIGTYPE_p_Event);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->serialized_string) delete [] arg1->serialized_string;
+    if (arg2) {
+      arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->serialized_string, (const char *)arg2);
+    } else {
+      arg1->serialized_string = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_event_get(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		switch_event_t *result = 0;
-
-		SWIG_check_num_args("event", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("event", 1, "Event *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_event_get", 1, SWIGTYPE_p_Event);
-		}
-
-		result = (switch_event_t *) ((arg1)->event);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_event_t, 0);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_serialized_string_get(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("serialized_string",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"Event *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_serialized_string_get",1,SWIGTYPE_p_Event);
+  }
+  
+  result = (char *) ((arg1)->serialized_string);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_serialized_string_set(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("serialized_string", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("serialized_string", 1, "Event *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("serialized_string", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_serialized_string_set", 1, SWIGTYPE_p_Event);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		{
-			if (arg1->serialized_string)
-				delete[]arg1->serialized_string;
-			if (arg2) {
-				arg1->serialized_string = (char *) (new char[strlen((const char *)arg2) + 1]);
-				strcpy((char *) arg1->serialized_string, (const char *) arg2);
-			} else {
-				arg1->serialized_string = 0;
-			}
-		}
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_mine_set(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  int arg2 ;
+  
+  SWIG_check_num_args("mine",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"Event *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("mine",2,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_mine_set",1,SWIGTYPE_p_Event);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  if (arg1) (arg1)->mine = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_serialized_string_get(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("serialized_string", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("serialized_string", 1, "Event *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_serialized_string_get", 1, SWIGTYPE_p_Event);
-		}
-
-		result = (char *) ((arg1)->serialized_string);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_mine_get(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("mine",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"Event *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_mine_get",1,SWIGTYPE_p_Event);
+  }
+  
+  result = (int) ((arg1)->mine);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_mine_set(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		int arg2;
-
-		SWIG_check_num_args("mine", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("mine", 1, "Event *");
-		if (!lua_isnumber(L, 2))
-			SWIG_fail_arg("mine", 2, "int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_mine_set", 1, SWIGTYPE_p_Event);
-		}
-
-		arg2 = (int) lua_tonumber(L, 2);
-		if (arg1)
-			(arg1)->mine = arg2;
-
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_new_Event__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  Event *result = 0 ;
+  
+  SWIG_check_num_args("Event",2,2)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("Event",1,"char const *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("Event",2,"char const *");
+  arg1 = (char *)lua_tostring(L, 1);
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (Event *)new Event((char const *)arg1,(char const *)arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_mine_get(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		int result;
-
-		SWIG_check_num_args("mine", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("mine", 1, "Event *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_mine_get", 1, SWIGTYPE_p_Event);
-		}
-
-		result = (int) ((arg1)->mine);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_new_Event__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  Event *result = 0 ;
+  
+  SWIG_check_num_args("Event",1,1)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("Event",1,"char const *");
+  arg1 = (char *)lua_tostring(L, 1);
+  result = (Event *)new Event((char const *)arg1);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_new_Event__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		char *arg1 = (char *) 0;
-		char *arg2 = (char *) 0;
-		Event *result = 0;
-
-		SWIG_check_num_args("Event", 2, 2)
-			if (!lua_isstring(L, 1))
-			SWIG_fail_arg("Event", 1, "char const *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("Event", 2, "char const *");
-		arg1 = (char *) lua_tostring(L, 1);
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (Event *) new Event((char const *) arg1, (char const *) arg2);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_new_Event__SWIG_2(lua_State* L) {
+  int SWIG_arg = -1;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  int arg2 ;
+  Event *result = 0 ;
+  
+  SWIG_check_num_args("Event",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"switch_event_t *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("Event",2,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_event_t,0))){
+    SWIG_fail_ptr("new_Event",1,SWIGTYPE_p_switch_event_t);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  result = (Event *)new Event(arg1,arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_new_Event__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		char *arg1 = (char *) 0;
-		Event *result = 0;
-
-		SWIG_check_num_args("Event", 1, 1)
-			if (!lua_isstring(L, 1))
-			SWIG_fail_arg("Event", 1, "char const *");
-		arg1 = (char *) lua_tostring(L, 1);
-		result = (Event *) new Event((char const *) arg1);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_new_Event__SWIG_3(lua_State* L) {
+  int SWIG_arg = -1;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  Event *result = 0 ;
+  
+  SWIG_check_num_args("Event",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"switch_event_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_event_t,0))){
+    SWIG_fail_ptr("new_Event",1,SWIGTYPE_p_switch_event_t);
+  }
+  
+  result = (Event *)new Event(arg1);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_new_Event__SWIG_2(lua_State * L) {
-		int SWIG_arg = -1;
-		switch_event_t *arg1 = (switch_event_t *) 0;
-		int arg2;
-		Event *result = 0;
-
-		SWIG_check_num_args("Event", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("Event", 1, "switch_event_t *");
-		if (!lua_isnumber(L, 2))
-			SWIG_fail_arg("Event", 2, "int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_event_t, 0))) {
-			SWIG_fail_ptr("new_Event", 1, SWIGTYPE_p_switch_event_t);
-		}
-
-		arg2 = (int) lua_tonumber(L, 2);
-		result = (Event *) new Event(arg1, arg2);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
+static int _wrap_new_Event(lua_State* L) {
+  int argc;
+  int argv[3]={
+    1,2,3
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 1) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      return _wrap_new_Event__SWIG_3(L);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]);
+    }
+    if (_v) {
+      return _wrap_new_Event__SWIG_1(L);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isnumber(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_new_Event__SWIG_2(L);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]);
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_new_Event__SWIG_0(L);
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'new_Event'");
+  lua_error(L);return 0;
+}
 
-	static int _wrap_new_Event__SWIG_3(lua_State * L) {
-		int SWIG_arg = -1;
-		switch_event_t *arg1 = (switch_event_t *) 0;
-		Event *result = 0;
-
-		SWIG_check_num_args("Event", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("Event", 1, "switch_event_t *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_event_t, 0))) {
-			SWIG_fail_ptr("new_Event", 1, SWIGTYPE_p_switch_event_t);
-		}
-
-		result = (Event *) new Event(arg1);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_delete_Event(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  
+  SWIG_check_num_args("Event",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"Event *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_Event",1,SWIGTYPE_p_Event);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_new_Event(lua_State * L) {
-		int argc;
-		int argv[3] = {
-			1, 2, 3
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 1) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				return _wrap_new_Event__SWIG_3(L);
-			}
-		}
-		if (argc == 1) {
-			int _v;
-			{
-				_v = lua_isstring(L, argv[0]);
-			}
-			if (_v) {
-				return _wrap_new_Event__SWIG_1(L);
-			}
-		}
-		if (argc == 2) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isnumber(L, argv[1]);
-				}
-				if (_v) {
-					return _wrap_new_Event__SWIG_2(L);
-				}
-			}
-		}
-		if (argc == 2) {
-			int _v;
-			{
-				_v = lua_isstring(L, argv[0]);
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					return _wrap_new_Event__SWIG_0(L);
-				}
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'new_Event'");
-		lua_error(L);
-		return 0;
-	}
 
+static int _wrap_Event_serialize__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("serialize",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialize",1,"Event *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("serialize",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_serialize",1,SWIGTYPE_p_Event);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (char *)(arg1)->serialize((char const *)arg2);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_delete_Event(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
 
-		SWIG_check_num_args("Event", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("Event", 1, "Event *");
+static int _wrap_Event_serialize__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("serialize",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialize",1,"Event *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_serialize",1,SWIGTYPE_p_Event);
+  }
+  
+  result = (char *)(arg1)->serialize();
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, SWIG_POINTER_DISOWN))) {
-			SWIG_fail_ptr("delete_Event", 1, SWIGTYPE_p_Event);
-		}
 
-		delete arg1;
+static int _wrap_Event_serialize(lua_State* L) {
+  int argc;
+  int argv[3]={
+    1,2,3
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 1) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      return _wrap_Event_serialize__SWIG_1(L);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_Event_serialize__SWIG_0(L);
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'Event_serialize'");
+  lua_error(L);return 0;
+}
 
-		SWIG_arg = 0;
 
-		return SWIG_arg;
+static int _wrap_Event_setPriority__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  switch_priority_t arg2 ;
+  bool result;
+  switch_priority_t *argp2 ;
+  
+  SWIG_check_num_args("setPriority",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPriority",1,"Event *");
+  if(!lua_isuserdata(L,2)) SWIG_fail_arg("setPriority",2,"switch_priority_t");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_setPriority",1,SWIGTYPE_p_Event);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_priority_t,0))){
+    SWIG_fail_ptr("Event_setPriority",2,SWIGTYPE_p_switch_priority_t);
+  }
+  arg2 = *argp2;
+  
+  result = (bool)(arg1)->setPriority(arg2);
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (0)
-			SWIG_fail;
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_setPriority__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("setPriority",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPriority",1,"Event *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_setPriority",1,SWIGTYPE_p_Event);
+  }
+  
+  result = (bool)(arg1)->setPriority();
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_serialize__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("serialize", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("serialize", 1, "Event *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("serialize", 2, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_serialize", 1, SWIGTYPE_p_Event);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (char *) (arg1)->serialize((char const *) arg2);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_setPriority(lua_State* L) {
+  int argc;
+  int argv[3]={
+    1,2,3
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 1) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      return _wrap_Event_setPriority__SWIG_1(L);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        void *ptr;
+        if (lua_isuserdata(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_switch_priority_t, 0)) {
+          _v = 0;
+        } else {
+          _v = 1;
+        }
+      }
+      if (_v) {
+        return _wrap_Event_setPriority__SWIG_0(L);
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'Event_setPriority'");
+  lua_error(L);return 0;
+}
 
 
-	static int _wrap_Event_serialize__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("serialize", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("serialize", 1, "Event *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_serialize", 1, SWIGTYPE_p_Event);
-		}
-
-		result = (char *) (arg1)->serialize();
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_getHeader(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("getHeader",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getHeader",1,"Event *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("getHeader",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_getHeader",1,SWIGTYPE_p_Event);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (char *)(arg1)->getHeader(arg2);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_serialize(lua_State * L) {
-		int argc;
-		int argv[3] = {
-			1, 2, 3
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 1) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				return _wrap_Event_serialize__SWIG_1(L);
-			}
-		}
-		if (argc == 2) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					return _wrap_Event_serialize__SWIG_0(L);
-				}
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'Event_serialize'");
-		lua_error(L);
-		return 0;
-	}
+static int _wrap_Event_getBody(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("getBody",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getBody",1,"Event *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_getBody",1,SWIGTYPE_p_Event);
+  }
+  
+  result = (char *)(arg1)->getBody();
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_setPriority__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		switch_priority_t arg2;
-		bool result;
-		switch_priority_t *argp2;
-
-		SWIG_check_num_args("setPriority", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setPriority", 1, "Event *");
-		if (!lua_isuserdata(L, 2))
-			SWIG_fail_arg("setPriority", 2, "switch_priority_t");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_setPriority", 1, SWIGTYPE_p_Event);
-		}
-
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &argp2, SWIGTYPE_p_switch_priority_t, 0))) {
-			SWIG_fail_ptr("Event_setPriority", 2, SWIGTYPE_p_switch_priority_t);
-		}
-		arg2 = *argp2;
-
-		result = (bool) (arg1)->setPriority(arg2);
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_getType(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("getType",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getType",1,"Event *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_getType",1,SWIGTYPE_p_Event);
+  }
+  
+  result = (char *)(arg1)->getType();
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_setPriority__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		bool result;
-
-		SWIG_check_num_args("setPriority", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setPriority", 1, "Event *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_setPriority", 1, SWIGTYPE_p_Event);
-		}
-
-		result = (bool) (arg1)->setPriority();
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_addBody(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("addBody",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addBody",1,"Event *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("addBody",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_addBody",1,SWIGTYPE_p_Event);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (bool)(arg1)->addBody((char const *)arg2);
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_setPriority(lua_State * L) {
-		int argc;
-		int argv[3] = {
-			1, 2, 3
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 1) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				return _wrap_Event_setPriority__SWIG_1(L);
-			}
-		}
-		if (argc == 2) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					void *ptr;
-					if (lua_isuserdata(L, argv[1]) == 0 || SWIG_ConvertPtr(L, argv[1], (void **) &ptr, SWIGTYPE_p_switch_priority_t, 0)) {
-						_v = 0;
-					} else {
-						_v = 1;
-					}
-				}
-				if (_v) {
-					return _wrap_Event_setPriority__SWIG_0(L);
-				}
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'Event_setPriority'");
-		lua_error(L);
-		return 0;
-	}
+static int _wrap_Event_addHeader(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("addHeader",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addHeader",1,"Event *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("addHeader",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("addHeader",3,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_addHeader",1,SWIGTYPE_p_Event);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_getHeader(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("getHeader", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("getHeader", 1, "Event *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("getHeader", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_getHeader", 1, SWIGTYPE_p_Event);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (char *) (arg1)->getHeader(arg2);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_delHeader(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("delHeader",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("delHeader",1,"Event *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("delHeader",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_delHeader",1,SWIGTYPE_p_Event);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (bool)(arg1)->delHeader((char const *)arg2);
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_getBody(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("getBody", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("getBody", 1, "Event *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_getBody", 1, SWIGTYPE_p_Event);
-		}
-
-		result = (char *) (arg1)->getBody();
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Event_fire(lua_State* L) {
+  int SWIG_arg = -1;
+  Event *arg1 = (Event *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("fire",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("fire",1,"Event *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("Event_fire",1,SWIGTYPE_p_Event);
+  }
+  
+  result = (bool)(arg1)->fire();
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_getType(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("getType", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("getType", 1, "Event *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_getType", 1, SWIGTYPE_p_Event);
-		}
-
-		result = (char *) (arg1)->getType();
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static void swig_delete_Event(void *obj) {
+Event *arg1 = (Event *) obj;
+delete arg1;
+}
+static swig_lua_method swig_Event_methods[] = {
+    {"serialize", _wrap_Event_serialize}, 
+    {"setPriority", _wrap_Event_setPriority}, 
+    {"getHeader", _wrap_Event_getHeader}, 
+    {"getBody", _wrap_Event_getBody}, 
+    {"getType", _wrap_Event_getType}, 
+    {"addBody", _wrap_Event_addBody}, 
+    {"addHeader", _wrap_Event_addHeader}, 
+    {"delHeader", _wrap_Event_delHeader}, 
+    {"fire", _wrap_Event_fire}, 
+    {0,0}
+};
+static swig_lua_attribute swig_Event_attributes[] = {
+    { "event", _wrap_Event_event_get, _wrap_Event_event_set},
+    { "serialized_string", _wrap_Event_serialized_string_get, _wrap_Event_serialized_string_set},
+    { "mine", _wrap_Event_mine_get, _wrap_Event_mine_set},
+    {0,0,0}
+};
+static swig_lua_class *swig_Event_bases[] = {0};
+static const char *swig_Event_base_names[] = {0};
+static swig_lua_class _wrap_class_Event = { "Event", &SWIGTYPE_p_Event,_wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, swig_Event_bases, swig_Event_base_names };
+
+static int _wrap_EventConsumer_events_set(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_queue_t *arg2 = (switch_queue_t *) 0 ;
+  
+  SWIG_check_num_args("events",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("events",1,"EventConsumer *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("events",2,"switch_queue_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_events_set",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_queue_t,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("EventConsumer_events_set",2,SWIGTYPE_p_switch_queue_t);
+  }
+  
+  if (arg1) (arg1)->events = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_addBody(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-		bool result;
-
-		SWIG_check_num_args("addBody", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("addBody", 1, "Event *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("addBody", 2, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_addBody", 1, SWIGTYPE_p_Event);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (bool) (arg1)->addBody((char const *) arg2);
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_EventConsumer_events_get(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_queue_t *result = 0 ;
+  
+  SWIG_check_num_args("events",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("events",1,"EventConsumer *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_events_get",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  result = (switch_queue_t *) ((arg1)->events);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_queue_t,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_addHeader(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		bool result;
-
-		SWIG_check_num_args("addHeader", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("addHeader", 1, "Event *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("addHeader", 2, "char const *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("addHeader", 3, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_addHeader", 1, SWIGTYPE_p_Event);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		result = (bool) (arg1)->addHeader((char const *) arg2, (char const *) arg3);
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_EventConsumer_e_event_id_set(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_types_t arg2 ;
+  switch_event_types_t *argp2 ;
+  
+  SWIG_check_num_args("e_event_id",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_event_id",1,"EventConsumer *");
+  if(!lua_isuserdata(L,2)) SWIG_fail_arg("e_event_id",2,"switch_event_types_t");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_e_event_id_set",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_event_types_t,0))){
+    SWIG_fail_ptr("EventConsumer_e_event_id_set",2,SWIGTYPE_p_switch_event_types_t);
+  }
+  arg2 = *argp2;
+  
+  if (arg1) (arg1)->e_event_id = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_delHeader(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-		bool result;
-
-		SWIG_check_num_args("delHeader", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("delHeader", 1, "Event *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("delHeader", 2, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_delHeader", 1, SWIGTYPE_p_Event);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (bool) (arg1)->delHeader((char const *) arg2);
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_EventConsumer_e_event_id_get(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_types_t result;
+  
+  SWIG_check_num_args("e_event_id",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_event_id",1,"EventConsumer *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_e_event_id_get",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  result =  ((arg1)->e_event_id);
+  SWIG_arg=0;
+  {
+    switch_event_types_t * resultptr = new switch_event_types_t((switch_event_types_t &) result);
+    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_event_types_t,1); SWIG_arg++;
+  }
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Event_fire(lua_State * L) {
-		int SWIG_arg = -1;
-		Event *arg1 = (Event *) 0;
-		bool result;
-
-		SWIG_check_num_args("fire", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("fire", 1, "Event *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("Event_fire", 1, SWIGTYPE_p_Event);
-		}
-
-		result = (bool) (arg1)->fire();
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_EventConsumer_node_set(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_node_t *arg2 = (switch_event_node_t *) 0 ;
+  
+  SWIG_check_num_args("node",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("node",1,"EventConsumer *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("node",2,"switch_event_node_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_node_set",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_event_node_t,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("EventConsumer_node_set",2,SWIGTYPE_p_switch_event_node_t);
+  }
+  
+  if (arg1) (arg1)->node = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static void swig_delete_Event(void *obj) {
-		Event *arg1 = (Event *) obj;
-		delete arg1;
-	}
-	static swig_lua_method swig_Event_methods[] = {
-		{"serialize", _wrap_Event_serialize},
-		{"setPriority", _wrap_Event_setPriority},
-		{"getHeader", _wrap_Event_getHeader},
-		{"getBody", _wrap_Event_getBody},
-		{"getType", _wrap_Event_getType},
-		{"addBody", _wrap_Event_addBody},
-		{"addHeader", _wrap_Event_addHeader},
-		{"delHeader", _wrap_Event_delHeader},
-		{"fire", _wrap_Event_fire},
-		{0, 0}
-	};
-	static swig_lua_attribute swig_Event_attributes[] = {
-		{"event", _wrap_Event_event_get, _wrap_Event_event_set},
-		{"serialized_string", _wrap_Event_serialized_string_get, _wrap_Event_serialized_string_set},
-		{"mine", _wrap_Event_mine_get, _wrap_Event_mine_set},
-		{0, 0, 0}
-	};
-	static swig_lua_class *swig_Event_bases[] = { 0 };
-	static const char *swig_Event_base_names[] = { 0 };
-	static swig_lua_class _wrap_class_Event =
-		{ "Event", &SWIGTYPE_p_Event, _wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, swig_Event_bases,
-swig_Event_base_names };
-
-	static int _wrap_delete_CoreSession(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-
-		SWIG_check_num_args("CoreSession", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("CoreSession", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN))) {
-			SWIG_fail_ptr("delete_CoreSession", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		delete arg1;
-
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_EventConsumer_node_get(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_node_t *result = 0 ;
+  
+  SWIG_check_num_args("node",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("node",1,"EventConsumer *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_node_get",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  result = (switch_event_node_t *) ((arg1)->node);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_event_node_t,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_session_set(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_core_session_t *arg2 = (switch_core_session_t *) 0;
+static int _wrap_EventConsumer_e_callback_set(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("e_callback",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_callback",1,"EventConsumer *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("e_callback",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_e_callback_set",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->e_callback) delete [] arg1->e_callback;
+    if (arg2) {
+      arg1->e_callback = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->e_callback, (const char *)arg2);
+    } else {
+      arg1->e_callback = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		SWIG_check_num_args("session", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("session", 1, "CoreSession *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("session", 2, "switch_core_session_t *");
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_session_set", 1, SWIGTYPE_p_CoreSession);
-		}
+static int _wrap_EventConsumer_e_callback_get(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("e_callback",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_callback",1,"EventConsumer *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_e_callback_get",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  result = (char *) ((arg1)->e_callback);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN))) {
-			SWIG_fail_ptr("CoreSession_session_set", 2, SWIGTYPE_p_switch_core_session_t);
-		}
+static int _wrap_EventConsumer_e_subclass_name_set(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("e_subclass_name",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_subclass_name",1,"EventConsumer *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("e_subclass_name",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_e_subclass_name_set",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->e_subclass_name) delete [] arg1->e_subclass_name;
+    if (arg2) {
+      arg1->e_subclass_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->e_subclass_name, (const char *)arg2);
+    } else {
+      arg1->e_subclass_name = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (arg1)
-			(arg1)->session = arg2;
 
-		SWIG_arg = 0;
+static int _wrap_EventConsumer_e_subclass_name_get(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("e_subclass_name",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_subclass_name",1,"EventConsumer *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_e_subclass_name_get",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  result = (char *) ((arg1)->e_subclass_name);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		return SWIG_arg;
 
-		if (0)
-			SWIG_fail;
+static int _wrap_EventConsumer_e_cb_arg_set(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("e_cb_arg",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_cb_arg",1,"EventConsumer *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("e_cb_arg",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_e_cb_arg_set",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->e_cb_arg) delete [] arg1->e_cb_arg;
+    if (arg2) {
+      arg1->e_cb_arg = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->e_cb_arg, (const char *)arg2);
+    } else {
+      arg1->e_cb_arg = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_EventConsumer_e_cb_arg_get(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("e_cb_arg",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_cb_arg",1,"EventConsumer *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_e_cb_arg_get",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  result = (char *) ((arg1)->e_cb_arg);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_session_get(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_core_session_t *result = 0;
-
-		SWIG_check_num_args("session", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("session", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_session_get", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (switch_core_session_t *) ((arg1)->session);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_core_session_t, 0);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_new_EventConsumer__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  EventConsumer *result = 0 ;
+  
+  SWIG_check_num_args("EventConsumer",2,2)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("EventConsumer",1,"char const *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("EventConsumer",2,"char const *");
+  arg1 = (char *)lua_tostring(L, 1);
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_EventConsumer,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_channel_set(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_channel_t *arg2 = (switch_channel_t *) 0;
 
-		SWIG_check_num_args("channel", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("channel", 1, "CoreSession *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("channel", 2, "switch_channel_t *");
+static int _wrap_new_EventConsumer__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  EventConsumer *result = 0 ;
+  
+  SWIG_check_num_args("EventConsumer",1,1)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("EventConsumer",1,"char const *");
+  arg1 = (char *)lua_tostring(L, 1);
+  result = (EventConsumer *)new EventConsumer((char const *)arg1);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_EventConsumer,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_channel_set", 1, SWIGTYPE_p_CoreSession);
-		}
 
+static int _wrap_new_EventConsumer(lua_State* L) {
+  int argc;
+  int argv[3]={
+    1,2,3
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 1) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]);
+    }
+    if (_v) {
+      return _wrap_new_EventConsumer__SWIG_1(L);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]);
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_new_EventConsumer__SWIG_0(L);
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'new_EventConsumer'");
+  lua_error(L);return 0;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN))) {
-			SWIG_fail_ptr("CoreSession_channel_set", 2, SWIGTYPE_p_switch_channel_t);
-		}
 
-		if (arg1)
-			(arg1)->channel = arg2;
-
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_delete_EventConsumer(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  
+  SWIG_check_num_args("EventConsumer",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("EventConsumer",1,"EventConsumer *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_EventConsumer",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_channel_get(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_channel_t *result = 0;
-
-		SWIG_check_num_args("channel", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("channel", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_channel_get", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (switch_channel_t *) ((arg1)->channel);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_channel_t, 0);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_EventConsumer_pop__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  int arg2 ;
+  Event *result = 0 ;
+  
+  SWIG_check_num_args("pop",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pop",1,"EventConsumer *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("pop",2,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_pop",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  result = (Event *)(arg1)->pop(arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_flags_set(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		unsigned int arg2;
-
-		SWIG_check_num_args("flags", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("flags", 1, "CoreSession *");
-		if (!lua_isnumber(L, 2))
-			SWIG_fail_arg("flags", 2, "unsigned int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_flags_set", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (unsigned int) lua_tonumber(L, 2);
-		if (arg1)
-			(arg1)->flags = arg2;
-
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_EventConsumer_pop__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  Event *result = 0 ;
+  
+  SWIG_check_num_args("pop",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pop",1,"EventConsumer *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){
+    SWIG_fail_ptr("EventConsumer_pop",1,SWIGTYPE_p_EventConsumer);
+  }
+  
+  result = (Event *)(arg1)->pop();
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_flags_get(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		unsigned int result;
-
-		SWIG_check_num_args("flags", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("flags", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_flags_get", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (unsigned int) ((arg1)->flags);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_EventConsumer_pop(lua_State* L) {
+  int argc;
+  int argv[3]={
+    1,2,3
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 1) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_EventConsumer, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      return _wrap_EventConsumer_pop__SWIG_1(L);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_EventConsumer, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isnumber(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_EventConsumer_pop__SWIG_0(L);
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'EventConsumer_pop'");
+  lua_error(L);return 0;
+}
 
 
-	static int _wrap_CoreSession_allocated_set(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int arg2;
-
-		SWIG_check_num_args("allocated", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("allocated", 1, "CoreSession *");
-		if (!lua_isnumber(L, 2))
-			SWIG_fail_arg("allocated", 2, "int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_allocated_set", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (int) lua_tonumber(L, 2);
-		if (arg1)
-			(arg1)->allocated = arg2;
-
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static void swig_delete_EventConsumer(void *obj) {
+EventConsumer *arg1 = (EventConsumer *) obj;
+delete arg1;
+}
+static swig_lua_method swig_EventConsumer_methods[] = {
+    {"pop", _wrap_EventConsumer_pop}, 
+    {0,0}
+};
+static swig_lua_attribute swig_EventConsumer_attributes[] = {
+    { "events", _wrap_EventConsumer_events_get, _wrap_EventConsumer_events_set},
+    { "e_event_id", _wrap_EventConsumer_e_event_id_get, _wrap_EventConsumer_e_event_id_set},
+    { "node", _wrap_EventConsumer_node_get, _wrap_EventConsumer_node_set},
+    { "e_callback", _wrap_EventConsumer_e_callback_get, _wrap_EventConsumer_e_callback_set},
+    { "e_subclass_name", _wrap_EventConsumer_e_subclass_name_get, _wrap_EventConsumer_e_subclass_name_set},
+    { "e_cb_arg", _wrap_EventConsumer_e_cb_arg_get, _wrap_EventConsumer_e_cb_arg_set},
+    {0,0,0}
+};
+static swig_lua_class *swig_EventConsumer_bases[] = {0};
+static const char *swig_EventConsumer_base_names[] = {0};
+static swig_lua_class _wrap_class_EventConsumer = { "EventConsumer", &SWIGTYPE_p_EventConsumer,_wrap_new_EventConsumer, swig_delete_EventConsumer, swig_EventConsumer_methods, swig_EventConsumer_attributes, swig_EventConsumer_bases, swig_EventConsumer_base_names };
+
+static int _wrap_delete_CoreSession(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  
+  SWIG_check_num_args("CoreSession",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("CoreSession",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_CoreSession",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_allocated_get(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int result;
-
-		SWIG_check_num_args("allocated", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("allocated", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_allocated_get", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (int) ((arg1)->allocated);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_CoreSession_session_set(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  
+  SWIG_check_num_args("session",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("session",1,"CoreSession *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("session",2,"switch_core_session_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_session_set",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("CoreSession_session_set",2,SWIGTYPE_p_switch_core_session_t);
+  }
+  
+  if (arg1) (arg1)->session = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_cb_state_set(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		input_callback_state *arg2 = (input_callback_state *) 0;
+static int _wrap_CoreSession_session_get(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_core_session_t *result = 0 ;
+  
+  SWIG_check_num_args("session",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("session",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_session_get",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (switch_core_session_t *) ((arg1)->session);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_core_session_t,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		SWIG_check_num_args("cb_state", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("cb_state", 1, "CoreSession *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("cb_state", 2, "input_callback_state *");
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_cb_state_set", 1, SWIGTYPE_p_CoreSession);
-		}
+static int _wrap_CoreSession_channel_set(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+  
+  SWIG_check_num_args("channel",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("channel",1,"CoreSession *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("channel",2,"switch_channel_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_channel_set",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_channel_t,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("CoreSession_channel_set",2,SWIGTYPE_p_switch_channel_t);
+  }
+  
+  if (arg1) (arg1)->channel = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_input_callback_state, 0))) {
-			SWIG_fail_ptr("CoreSession_cb_state_set", 2, SWIGTYPE_p_input_callback_state);
-		}
+static int _wrap_CoreSession_channel_get(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_t *result = 0 ;
+  
+  SWIG_check_num_args("channel",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("channel",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_channel_get",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (switch_channel_t *) ((arg1)->channel);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_channel_t,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (arg1)
-			(arg1)->cb_state = *arg2;
 
-		SWIG_arg = 0;
+static int _wrap_CoreSession_flags_set(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  unsigned int arg2 ;
+  
+  SWIG_check_num_args("flags",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flags",1,"CoreSession *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("flags",2,"unsigned int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_flags_set",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (unsigned int)lua_tonumber(L, 2);
+  if (arg1) (arg1)->flags = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		return SWIG_arg;
 
-		if (0)
-			SWIG_fail;
+static int _wrap_CoreSession_flags_get(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  unsigned int result;
+  
+  SWIG_check_num_args("flags",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flags",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_flags_get",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (unsigned int) ((arg1)->flags);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_allocated_set(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  
+  SWIG_check_num_args("allocated",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("allocated",1,"CoreSession *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("allocated",2,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_allocated_set",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  if (arg1) (arg1)->allocated = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_cb_state_get(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		input_callback_state *result = 0;
-
-		SWIG_check_num_args("cb_state", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("cb_state", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_cb_state_get", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (input_callback_state *) & ((arg1)->cb_state);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_input_callback_state, 0);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_allocated_get(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("allocated",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("allocated",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_allocated_get",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (int) ((arg1)->allocated);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_hook_state_set(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_channel_state_t arg2;
-		switch_channel_state_t *argp2;
 
-		SWIG_check_num_args("hook_state", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("hook_state", 1, "CoreSession *");
-		if (!lua_isuserdata(L, 2))
-			SWIG_fail_arg("hook_state", 2, "switch_channel_state_t");
+static int _wrap_CoreSession_cb_state_set(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  input_callback_state *arg2 = (input_callback_state *) 0 ;
+  
+  SWIG_check_num_args("cb_state",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_state",1,"CoreSession *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cb_state",2,"input_callback_state *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_cb_state_set",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_input_callback_state,0))){
+    SWIG_fail_ptr("CoreSession_cb_state_set",2,SWIGTYPE_p_input_callback_state);
+  }
+  
+  if (arg1) (arg1)->cb_state = *arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_hook_state_set", 1, SWIGTYPE_p_CoreSession);
-		}
 
+static int _wrap_CoreSession_cb_state_get(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  input_callback_state *result = 0 ;
+  
+  SWIG_check_num_args("cb_state",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_state",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_cb_state_get",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (input_callback_state *)& ((arg1)->cb_state);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_input_callback_state,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &argp2, SWIGTYPE_p_switch_channel_state_t, 0))) {
-			SWIG_fail_ptr("CoreSession_hook_state_set", 2, SWIGTYPE_p_switch_channel_state_t);
-		}
-		arg2 = *argp2;
 
-		if (arg1)
-			(arg1)->hook_state = arg2;
+static int _wrap_CoreSession_hook_state_set(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_state_t arg2 ;
+  switch_channel_state_t *argp2 ;
+  
+  SWIG_check_num_args("hook_state",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hook_state",1,"CoreSession *");
+  if(!lua_isuserdata(L,2)) SWIG_fail_arg("hook_state",2,"switch_channel_state_t");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_hook_state_set",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_channel_state_t,0))){
+    SWIG_fail_ptr("CoreSession_hook_state_set",2,SWIGTYPE_p_switch_channel_state_t);
+  }
+  arg2 = *argp2;
+  
+  if (arg1) (arg1)->hook_state = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		SWIG_arg = 0;
 
-		return SWIG_arg;
+static int _wrap_CoreSession_hook_state_get(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_state_t result;
+  
+  SWIG_check_num_args("hook_state",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hook_state",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_hook_state_get",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result =  ((arg1)->hook_state);
+  SWIG_arg=0;
+  {
+    switch_channel_state_t * resultptr = new switch_channel_state_t((switch_channel_state_t &) result);
+    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_channel_state_t,1); SWIG_arg++;
+  }
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (0)
-			SWIG_fail;
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_CoreSession_uuid_set(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("uuid",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uuid",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("uuid",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_uuid_set",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->uuid) delete [] arg1->uuid;
+    if (arg2) {
+      arg1->uuid = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->uuid, (const char *)arg2);
+    } else {
+      arg1->uuid = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_hook_state_get(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_channel_state_t result;
-
-		SWIG_check_num_args("hook_state", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("hook_state", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_hook_state_get", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = ((arg1)->hook_state);
-		SWIG_arg = 0;
-		{
-			switch_channel_state_t *resultptr = new switch_channel_state_t ((switch_channel_state_t &) result);
-			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_channel_state_t, 1);
-			SWIG_arg++;
-		}
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_CoreSession_uuid_get(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("uuid",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uuid",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_uuid_get",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (char *) ((arg1)->uuid);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_answer(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int result;
-
-		SWIG_check_num_args("answer", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("answer", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_answer", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (int) (arg1)->answer();
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_CoreSession_tts_name_set(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("tts_name",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("tts_name",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("tts_name",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_tts_name_set",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->tts_name) delete [] arg1->tts_name;
+    if (arg2) {
+      arg1->tts_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->tts_name, (const char *)arg2);
+    } else {
+      arg1->tts_name = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_preAnswer(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int result;
-
-		SWIG_check_num_args("preAnswer", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("preAnswer", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_preAnswer", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (int) (arg1)->preAnswer();
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_CoreSession_tts_name_get(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("tts_name",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("tts_name",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_tts_name_get",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (char *) ((arg1)->tts_name);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_hangup__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("hangup", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("hangup", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("hangup", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_hangup", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		(arg1)->hangup(arg2);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_CoreSession_voice_name_set(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("voice_name",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("voice_name",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("voice_name",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_voice_name_set",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->voice_name) delete [] arg1->voice_name;
+    if (arg2) {
+      arg1->voice_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->voice_name, (const char *)arg2);
+    } else {
+      arg1->voice_name = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_hangup__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
+static int _wrap_CoreSession_voice_name_get(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("voice_name",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("voice_name",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_voice_name_get",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (char *) ((arg1)->voice_name);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		SWIG_check_num_args("hangup", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("hangup", 1, "CoreSession *");
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_hangup", 1, SWIGTYPE_p_CoreSession);
-		}
+static int _wrap_CoreSession_answer(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("answer",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("answer",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_answer",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (int)(arg1)->answer();
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		(arg1)->hangup();
-		SWIG_arg = 0;
 
-		return SWIG_arg;
+static int _wrap_CoreSession_preAnswer(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("preAnswer",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("preAnswer",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_preAnswer",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (int)(arg1)->preAnswer();
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (0)
-			SWIG_fail;
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_CoreSession_hangup__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("hangup",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("hangup",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_hangup",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  (arg1)->hangup(arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_hangup(lua_State * L) {
-		int argc;
-		int argv[3] = {
-			1, 2, 3
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 1) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				return _wrap_CoreSession_hangup__SWIG_1(L);
-			}
-		}
-		if (argc == 2) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					return _wrap_CoreSession_hangup__SWIG_0(L);
-				}
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'CoreSession_hangup'");
-		lua_error(L);
-		return 0;
-	}
+static int _wrap_CoreSession_hangup__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  
+  SWIG_check_num_args("hangup",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_hangup",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  (arg1)->hangup();
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_setVariable(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-
-		SWIG_check_num_args("setVariable", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setVariable", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("setVariable", 2, "char *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("setVariable", 3, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_setVariable", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		(arg1)->setVariable(arg2, arg3);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_CoreSession_hangup(lua_State* L) {
+  int argc;
+  int argv[3]={
+    1,2,3
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 1) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      return _wrap_CoreSession_hangup__SWIG_1(L);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_CoreSession_hangup__SWIG_0(L);
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'CoreSession_hangup'");
+  lua_error(L);return 0;
+}
 
 
-	static int _wrap_CoreSession_setPrivate(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		void *arg3 = (void *) 0;
-
-		SWIG_check_num_args("setPrivate", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setPrivate", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("setPrivate", 2, "char *");
-		if (!SWIG_isptrtype(L, 3))
-			SWIG_fail_arg("setPrivate", 3, "void *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_setPrivate", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (void *) SWIG_MustGetPtr(L, 3, 0, 0, 3, "CoreSession_setPrivate");
-		(arg1)->setPrivate(arg2, arg3);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_CoreSession_setVariable(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  SWIG_check_num_args("setVariable",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setVariable",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("setVariable",2,"char *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("setVariable",3,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_setVariable",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  (arg1)->setVariable(arg2,arg3);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_getPrivate(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		void *result = 0;
-
-		SWIG_check_num_args("getPrivate", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("getPrivate", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("getPrivate", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_getPrivate", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (void *) (arg1)->getPrivate(arg2);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_CoreSession_setPrivate(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = (void *) 0 ;
+  
+  SWIG_check_num_args("setPrivate",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPrivate",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("setPrivate",2,"char *");
+  if(!SWIG_isptrtype(L,3)) SWIG_fail_arg("setPrivate",3,"void *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_setPrivate",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3=(void *)SWIG_MustGetPtr(L,3,0,0,3,"CoreSession_setPrivate");
+  (arg1)->setPrivate(arg2,arg3);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_CoreSession_getVariable(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("getVariable", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("getVariable", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("getVariable", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_getVariable", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (char *) (arg1)->getVariable(arg2);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_CoreSession_process_callback_result(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		switch_status_t result;
-
-		SWIG_check_num_args("process_callback_result", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("process_callback_result", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("process_callback_result", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_process_callback_result", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (arg1)->process_callback_result(arg2);
-		SWIG_arg = 0;
-		{
-			switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
-			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
-			SWIG_arg++;
-		}
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_CoreSession_say(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *arg4 = (char *) 0;
-		char *arg5 = (char *) 0;
-
-		SWIG_check_num_args("say", 5, 5)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("say", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("say", 2, "char const *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("say", 3, "char const *");
-		if (!lua_isstring(L, 4))
-			SWIG_fail_arg("say", 4, "char const *");
-		if (!lua_isstring(L, 5))
-			SWIG_fail_arg("say", 5, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_say", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		arg4 = (char *) lua_tostring(L, 4);
-		arg5 = (char *) lua_tostring(L, 5);
-		(arg1)->say((char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_CoreSession_sayPhrase__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *arg4 = (char *) 0;
-
-		SWIG_check_num_args("sayPhrase", 4, 4)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("sayPhrase", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("sayPhrase", 2, "char const *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("sayPhrase", 3, "char const *");
-		if (!lua_isstring(L, 4))
-			SWIG_fail_arg("sayPhrase", 4, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_sayPhrase", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		arg4 = (char *) lua_tostring(L, 4);
-		(arg1)->sayPhrase((char const *) arg2, (char const *) arg3, (char const *) arg4);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_CoreSession_sayPhrase__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-
-		SWIG_check_num_args("sayPhrase", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("sayPhrase", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("sayPhrase", 2, "char const *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("sayPhrase", 3, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_sayPhrase", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		(arg1)->sayPhrase((char const *) arg2, (char const *) arg3);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_CoreSession_sayPhrase__SWIG_2(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("sayPhrase", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("sayPhrase", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("sayPhrase", 2, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_sayPhrase", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		(arg1)->sayPhrase((char const *) arg2);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_CoreSession_sayPhrase(lua_State * L) {
-		int argc;
-		int argv[5] = {
-			1, 2, 3, 4, 5
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 2) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					return _wrap_CoreSession_sayPhrase__SWIG_2(L);
-				}
-			}
-		}
-		if (argc == 3) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					{
-						_v = lua_isstring(L, argv[2]);
-					}
-					if (_v) {
-						return _wrap_CoreSession_sayPhrase__SWIG_1(L);
-					}
-				}
-			}
-		}
-		if (argc == 4) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					{
-						_v = lua_isstring(L, argv[2]);
-					}
-					if (_v) {
-						{
-							_v = lua_isstring(L, argv[3]);
-						}
-						if (_v) {
-							return _wrap_CoreSession_sayPhrase__SWIG_0(L);
-						}
-					}
-				}
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'CoreSession_sayPhrase'");
-		lua_error(L);
-		return 0;
-	}
-
-
-	static int _wrap_CoreSession_recordFile__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int arg3;
-		int arg4;
-		int arg5;
-		int result;
-
-		SWIG_check_num_args("recordFile", 5, 5)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("recordFile", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("recordFile", 2, "char *");
-		if (!lua_isnumber(L, 3))
-			SWIG_fail_arg("recordFile", 3, "int");
-		if (!lua_isnumber(L, 4))
-			SWIG_fail_arg("recordFile", 4, "int");
-		if (!lua_isnumber(L, 5))
-			SWIG_fail_arg("recordFile", 5, "int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (int) lua_tonumber(L, 3);
-		arg4 = (int) lua_tonumber(L, 4);
-		arg5 = (int) lua_tonumber(L, 5);
-		result = (int) (arg1)->recordFile(arg2, arg3, arg4, arg5);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_CoreSession_recordFile__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int arg3;
-		int arg4;
-		int result;
-
-		SWIG_check_num_args("recordFile", 4, 4)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("recordFile", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("recordFile", 2, "char *");
-		if (!lua_isnumber(L, 3))
-			SWIG_fail_arg("recordFile", 3, "int");
-		if (!lua_isnumber(L, 4))
-			SWIG_fail_arg("recordFile", 4, "int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (int) lua_tonumber(L, 3);
-		arg4 = (int) lua_tonumber(L, 4);
-		result = (int) (arg1)->recordFile(arg2, arg3, arg4);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_CoreSession_recordFile__SWIG_2(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int arg3;
-		int result;
-
-		SWIG_check_num_args("recordFile", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("recordFile", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("recordFile", 2, "char *");
-		if (!lua_isnumber(L, 3))
-			SWIG_fail_arg("recordFile", 3, "int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (int) lua_tonumber(L, 3);
-		result = (int) (arg1)->recordFile(arg2, arg3);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_CoreSession_recordFile__SWIG_3(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int result;
-
-		SWIG_check_num_args("recordFile", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("recordFile", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("recordFile", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (int) (arg1)->recordFile(arg2);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
-
-
-	static int _wrap_CoreSession_recordFile(lua_State * L) {
-		int argc;
-		int argv[6] = {
-			1, 2, 3, 4, 5, 6
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 2) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					return _wrap_CoreSession_recordFile__SWIG_3(L);
-				}
-			}
-		}
-		if (argc == 3) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					{
-						_v = lua_isnumber(L, argv[2]);
-					}
-					if (_v) {
-						return _wrap_CoreSession_recordFile__SWIG_2(L);
-					}
-				}
-			}
-		}
-		if (argc == 4) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					{
-						_v = lua_isnumber(L, argv[2]);
-					}
-					if (_v) {
-						{
-							_v = lua_isnumber(L, argv[3]);
-						}
-						if (_v) {
-							return _wrap_CoreSession_recordFile__SWIG_1(L);
-						}
-					}
-				}
-			}
-		}
-		if (argc == 5) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					{
-						_v = lua_isnumber(L, argv[2]);
-					}
-					if (_v) {
-						{
-							_v = lua_isnumber(L, argv[3]);
-						}
-						if (_v) {
-							{
-								_v = lua_isnumber(L, argv[4]);
-							}
-							if (_v) {
-								return _wrap_CoreSession_recordFile__SWIG_0(L);
-							}
-						}
-					}
-				}
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'CoreSession_recordFile'");
-		lua_error(L);
-		return 0;
-	}
-
+static int _wrap_CoreSession_getPrivate(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *result = 0 ;
+  
+  SWIG_check_num_args("getPrivate",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getPrivate",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("getPrivate",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_getPrivate",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (void *)(arg1)->getPrivate(arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_setCallerData(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-
-		SWIG_check_num_args("setCallerData", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setCallerData", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("setCallerData", 2, "char *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("setCallerData", 3, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_setCallerData", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		(arg1)->setCallerData(arg2, arg3);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_getVariable(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("getVariable",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getVariable",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("getVariable",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_getVariable",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (char *)(arg1)->getVariable(arg2);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_originate__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		CoreSession *arg2 = (CoreSession *) 0;
-		char *arg3 = (char *) 0;
-		int arg4;
-		int result;
-
-		SWIG_check_num_args("originate", 4, 4)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("originate", 1, "CoreSession *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("originate", 2, "CoreSession *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("originate", 3, "char *");
-		if (!lua_isnumber(L, 4))
-			SWIG_fail_arg("originate", 4, "int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_originate", 1, SWIGTYPE_p_CoreSession);
-		}
-
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_originate", 2, SWIGTYPE_p_CoreSession);
-		}
-
-		arg3 = (char *) lua_tostring(L, 3);
-		arg4 = (int) lua_tonumber(L, 4);
-		result = (int) (arg1)->originate(arg2, arg3, arg4);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_process_callback_result(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  SWIG_check_num_args("process_callback_result",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("process_callback_result",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("process_callback_result",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_process_callback_result",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (arg1)->process_callback_result(arg2);
+  SWIG_arg=0;
+  {
+    switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
+    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
+  }
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_originate__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		CoreSession *arg2 = (CoreSession *) 0;
-		char *arg3 = (char *) 0;
-		int result;
-
-		SWIG_check_num_args("originate", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("originate", 1, "CoreSession *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("originate", 2, "CoreSession *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("originate", 3, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_originate", 1, SWIGTYPE_p_CoreSession);
-		}
-
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_originate", 2, SWIGTYPE_p_CoreSession);
-		}
-
-		arg3 = (char *) lua_tostring(L, 3);
-		result = (int) (arg1)->originate(arg2, arg3);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_say(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  
+  SWIG_check_num_args("say",5,5)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("say",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("say",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("say",3,"char const *");
+  if(!lua_isstring(L,4)) SWIG_fail_arg("say",4,"char const *");
+  if(!lua_isstring(L,5)) SWIG_fail_arg("say",5,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_say",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  arg4 = (char *)lua_tostring(L, 4);
+  arg5 = (char *)lua_tostring(L, 5);
+  (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_originate(lua_State * L) {
-		int argc;
-		int argv[5] = {
-			1, 2, 3, 4, 5
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 3) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					void *ptr;
-					if (SWIG_isptrtype(L, argv[1]) == 0 || SWIG_ConvertPtr(L, argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-						_v = 0;
-					} else {
-						_v = 1;
-					}
-				}
-				if (_v) {
-					{
-						_v = lua_isstring(L, argv[2]);
-					}
-					if (_v) {
-						return _wrap_CoreSession_originate__SWIG_1(L);
-					}
-				}
-			}
-		}
-		if (argc == 4) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					void *ptr;
-					if (SWIG_isptrtype(L, argv[1]) == 0 || SWIG_ConvertPtr(L, argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-						_v = 0;
-					} else {
-						_v = 1;
-					}
-				}
-				if (_v) {
-					{
-						_v = lua_isstring(L, argv[2]);
-					}
-					if (_v) {
-						{
-							_v = lua_isnumber(L, argv[3]);
-						}
-						if (_v) {
-							return _wrap_CoreSession_originate__SWIG_0(L);
-						}
-					}
-				}
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'CoreSession_originate'");
-		lua_error(L);
-		return 0;
-	}
 
+static int _wrap_CoreSession_sayPhrase__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  
+  SWIG_check_num_args("sayPhrase",4,4)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("sayPhrase",3,"char const *");
+  if(!lua_isstring(L,4)) SWIG_fail_arg("sayPhrase",4,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  arg4 = (char *)lua_tostring(L, 4);
+  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_setDTMFCallback(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		void *arg2 = (void *) 0;
-		char *arg3 = (char *) 0;
-
-		SWIG_check_num_args("setDTMFCallback", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setDTMFCallback", 1, "CoreSession *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("setDTMFCallback", 2, "void *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("setDTMFCallback", 3, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_setDTMFCallback", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "CoreSession_setDTMFCallback");
-		arg3 = (char *) lua_tostring(L, 3);
-		(arg1)->setDTMFCallback(arg2, arg3);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_sayPhrase__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  SWIG_check_num_args("sayPhrase",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("sayPhrase",3,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_speak(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int result;
-
-		SWIG_check_num_args("speak", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("speak", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("speak", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_speak", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (int) (arg1)->speak(arg2);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_sayPhrase__SWIG_2(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("sayPhrase",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  (arg1)->sayPhrase((char const *)arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_set_tts_parms(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-
-		SWIG_check_num_args("set_tts_parms", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("set_tts_parms", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("set_tts_parms", 2, "char *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("set_tts_parms", 3, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_set_tts_parms", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		(arg1)->set_tts_parms(arg2, arg3);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_sayPhrase(lua_State* L) {
+  int argc;
+  int argv[5]={
+    1,2,3,4,5
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_CoreSession_sayPhrase__SWIG_2(L);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          return _wrap_CoreSession_sayPhrase__SWIG_1(L);
+        }
+      }
+    }
+  }
+  if (argc == 4) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          {
+            _v = lua_isstring(L,argv[3]);
+          }
+          if (_v) {
+            return _wrap_CoreSession_sayPhrase__SWIG_0(L);
+          }
+        }
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'CoreSession_sayPhrase'");
+  lua_error(L);return 0;
+}
 
-	static int _wrap_CoreSession_collectDigits(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int arg2;
-		int result;
-
-		SWIG_check_num_args("collectDigits", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("collectDigits", 1, "CoreSession *");
-		if (!lua_isnumber(L, 2))
-			SWIG_fail_arg("collectDigits", 2, "int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_collectDigits", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (int) lua_tonumber(L, 2);
-		result = (int) (arg1)->collectDigits(arg2);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_recordFile__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int arg4 ;
+  int arg5 ;
+  int result;
+  
+  SWIG_check_num_args("recordFile",5,5)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
+  if(!lua_isnumber(L,3)) SWIG_fail_arg("recordFile",3,"int");
+  if(!lua_isnumber(L,4)) SWIG_fail_arg("recordFile",4,"int");
+  if(!lua_isnumber(L,5)) SWIG_fail_arg("recordFile",5,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (int)lua_tonumber(L, 3);
+  arg4 = (int)lua_tonumber(L, 4);
+  arg5 = (int)lua_tonumber(L, 5);
+  result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_getDigits(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int arg2;
-		char *arg3 = (char *) 0;
-		int arg4;
-		char *result = 0;
-
-		SWIG_check_num_args("getDigits", 4, 4)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("getDigits", 1, "CoreSession *");
-		if (!lua_isnumber(L, 2))
-			SWIG_fail_arg("getDigits", 2, "int");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("getDigits", 3, "char *");
-		if (!lua_isnumber(L, 4))
-			SWIG_fail_arg("getDigits", 4, "int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_getDigits", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (int) lua_tonumber(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		arg4 = (int) lua_tonumber(L, 4);
-		result = (char *) (arg1)->getDigits(arg2, arg3, arg4);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_recordFile__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int arg4 ;
+  int result;
+  
+  SWIG_check_num_args("recordFile",4,4)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
+  if(!lua_isnumber(L,3)) SWIG_fail_arg("recordFile",3,"int");
+  if(!lua_isnumber(L,4)) SWIG_fail_arg("recordFile",4,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (int)lua_tonumber(L, 3);
+  arg4 = (int)lua_tonumber(L, 4);
+  result = (int)(arg1)->recordFile(arg2,arg3,arg4);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_transfer(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *arg4 = (char *) 0;
-		int result;
-
-		SWIG_check_num_args("transfer", 4, 4)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("transfer", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("transfer", 2, "char *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("transfer", 3, "char *");
-		if (!lua_isstring(L, 4))
-			SWIG_fail_arg("transfer", 4, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_transfer", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		arg4 = (char *) lua_tostring(L, 4);
-		result = (int) (arg1)->transfer(arg2, arg3, arg4);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_recordFile__SWIG_2(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int result;
+  
+  SWIG_check_num_args("recordFile",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
+  if(!lua_isnumber(L,3)) SWIG_fail_arg("recordFile",3,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (int)lua_tonumber(L, 3);
+  result = (int)(arg1)->recordFile(arg2,arg3);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_read(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int arg2;
-		int arg3;
-		char *arg4 = (char *) 0;
-		int arg5;
-		char *arg6 = (char *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("read", 6, 6)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("read", 1, "CoreSession *");
-		if (!lua_isnumber(L, 2))
-			SWIG_fail_arg("read", 2, "int");
-		if (!lua_isnumber(L, 3))
-			SWIG_fail_arg("read", 3, "int");
-		if (!lua_isstring(L, 4))
-			SWIG_fail_arg("read", 4, "char const *");
-		if (!lua_isnumber(L, 5))
-			SWIG_fail_arg("read", 5, "int");
-		if (!lua_isstring(L, 6))
-			SWIG_fail_arg("read", 6, "char const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_read", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (int) lua_tonumber(L, 2);
-		arg3 = (int) lua_tonumber(L, 3);
-		arg4 = (char *) lua_tostring(L, 4);
-		arg5 = (int) lua_tonumber(L, 5);
-		arg6 = (char *) lua_tostring(L, 6);
-		result = (char *) (arg1)->read(arg2, arg3, (char const *) arg4, arg5, (char const *) arg6);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_recordFile__SWIG_3(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("recordFile",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (int)(arg1)->recordFile(arg2);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_playAndGetDigits(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int arg2;
-		int arg3;
-		int arg4;
-		int arg5;
-		char *arg6 = (char *) 0;
-		char *arg7 = (char *) 0;
-		char *arg8 = (char *) 0;
-		char *arg9 = (char *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("playAndGetDigits", 9, 9)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("playAndGetDigits", 1, "CoreSession *");
-		if (!lua_isnumber(L, 2))
-			SWIG_fail_arg("playAndGetDigits", 2, "int");
-		if (!lua_isnumber(L, 3))
-			SWIG_fail_arg("playAndGetDigits", 3, "int");
-		if (!lua_isnumber(L, 4))
-			SWIG_fail_arg("playAndGetDigits", 4, "int");
-		if (!lua_isnumber(L, 5))
-			SWIG_fail_arg("playAndGetDigits", 5, "int");
-		if (!lua_isstring(L, 6))
-			SWIG_fail_arg("playAndGetDigits", 6, "char *");
-		if (!lua_isstring(L, 7))
-			SWIG_fail_arg("playAndGetDigits", 7, "char *");
-		if (!lua_isstring(L, 8))
-			SWIG_fail_arg("playAndGetDigits", 8, "char *");
-		if (!lua_isstring(L, 9))
-			SWIG_fail_arg("playAndGetDigits", 9, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_playAndGetDigits", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (int) lua_tonumber(L, 2);
-		arg3 = (int) lua_tonumber(L, 3);
-		arg4 = (int) lua_tonumber(L, 4);
-		arg5 = (int) lua_tonumber(L, 5);
-		arg6 = (char *) lua_tostring(L, 6);
-		arg7 = (char *) lua_tostring(L, 7);
-		arg8 = (char *) lua_tostring(L, 8);
-		arg9 = (char *) lua_tostring(L, 9);
-		result = (char *) (arg1)->playAndGetDigits(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_recordFile(lua_State* L) {
+  int argc;
+  int argv[6]={
+    1,2,3,4,5,6
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_CoreSession_recordFile__SWIG_3(L);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isnumber(L,argv[2]);
+        }
+        if (_v) {
+          return _wrap_CoreSession_recordFile__SWIG_2(L);
+        }
+      }
+    }
+  }
+  if (argc == 4) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isnumber(L,argv[2]);
+        }
+        if (_v) {
+          {
+            _v = lua_isnumber(L,argv[3]);
+          }
+          if (_v) {
+            return _wrap_CoreSession_recordFile__SWIG_1(L);
+          }
+        }
+      }
+    }
+  }
+  if (argc == 5) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isnumber(L,argv[2]);
+        }
+        if (_v) {
+          {
+            _v = lua_isnumber(L,argv[3]);
+          }
+          if (_v) {
+            {
+              _v = lua_isnumber(L,argv[4]);
+            }
+            if (_v) {
+              return _wrap_CoreSession_recordFile__SWIG_0(L);
+            }
+          }
+        }
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'CoreSession_recordFile'");
+  lua_error(L);return 0;
+}
 
-	static int _wrap_CoreSession_streamFile__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int arg3;
-		int result;
-
-		SWIG_check_num_args("streamFile", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("streamFile", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("streamFile", 2, "char *");
-		if (!lua_isnumber(L, 3))
-			SWIG_fail_arg("streamFile", 3, "int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_streamFile", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (int) lua_tonumber(L, 3);
-		result = (int) (arg1)->streamFile(arg2, arg3);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_setCallerData(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  SWIG_check_num_args("setCallerData",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setCallerData",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("setCallerData",2,"char *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("setCallerData",3,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_setCallerData",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  (arg1)->setCallerData(arg2,arg3);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_streamFile__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int result;
-
-		SWIG_check_num_args("streamFile", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("streamFile", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("streamFile", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_streamFile", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		result = (int) (arg1)->streamFile(arg2);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_originate__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  int result;
+  
+  SWIG_check_num_args("originate",4,4)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("originate",1,"CoreSession *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("originate",2,"CoreSession *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("originate",3,"char *");
+  if(!lua_isnumber(L,4)) SWIG_fail_arg("originate",4,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_originate",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_originate",2,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg3 = (char *)lua_tostring(L, 3);
+  arg4 = (int)lua_tonumber(L, 4);
+  result = (int)(arg1)->originate(arg2,arg3,arg4);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_streamFile(lua_State * L) {
-		int argc;
-		int argv[4] = {
-			1, 2, 3, 4
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 2) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					return _wrap_CoreSession_streamFile__SWIG_1(L);
-				}
-			}
-		}
-		if (argc == 3) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					{
-						_v = lua_isnumber(L, argv[2]);
-					}
-					if (_v) {
-						return _wrap_CoreSession_streamFile__SWIG_0(L);
-					}
-				}
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'CoreSession_streamFile'");
-		lua_error(L);
-		return 0;
-	}
 
+static int _wrap_CoreSession_originate__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("originate",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("originate",1,"CoreSession *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("originate",2,"CoreSession *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("originate",3,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_originate",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_originate",2,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg3 = (char *)lua_tostring(L, 3);
+  result = (int)(arg1)->originate(arg2,arg3);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_flushEvents(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int result;
-
-		SWIG_check_num_args("flushEvents", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("flushEvents", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_flushEvents", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (int) (arg1)->flushEvents();
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_originate(lua_State* L) {
+  int argc;
+  int argv[5]={
+    1,2,3,4,5
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 3) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        void *ptr;
+        if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+          _v = 0;
+        } else {
+          _v = 1;
+        }
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          return _wrap_CoreSession_originate__SWIG_1(L);
+        }
+      }
+    }
+  }
+  if (argc == 4) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        void *ptr;
+        if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+          _v = 0;
+        } else {
+          _v = 1;
+        }
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          {
+            _v = lua_isnumber(L,argv[3]);
+          }
+          if (_v) {
+            return _wrap_CoreSession_originate__SWIG_0(L);
+          }
+        }
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'CoreSession_originate'");
+  lua_error(L);return 0;
+}
 
-	static int _wrap_CoreSession_flushDigits(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int result;
-
-		SWIG_check_num_args("flushDigits", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("flushDigits", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_flushDigits", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (int) (arg1)->flushDigits();
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_setDTMFCallback(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  void *arg2 = (void *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  SWIG_check_num_args("setDTMFCallback",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setDTMFCallback",1,"CoreSession *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setDTMFCallback",2,"void *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("setDTMFCallback",3,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_setDTMFCallback",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_setDTMFCallback");
+  arg3 = (char *)lua_tostring(L, 3);
+  (arg1)->setDTMFCallback(arg2,arg3);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_setAutoHangup(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		bool arg2;
-		int result;
-
-		SWIG_check_num_args("setAutoHangup", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setAutoHangup", 1, "CoreSession *");
-		if (!lua_isboolean(L, 2))
-			SWIG_fail_arg("setAutoHangup", 2, "bool");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_setAutoHangup", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (lua_toboolean(L, 2) != 0);
-		result = (int) (arg1)->setAutoHangup(arg2);
-		SWIG_arg = 0;
-		lua_pushnumber(L, (lua_Number) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_speak(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("speak",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("speak",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("speak",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_speak",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (int)(arg1)->speak(arg2);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_setHangupHook(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		void *arg2 = (void *) 0;
-
-		SWIG_check_num_args("setHangupHook", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setHangupHook", 1, "CoreSession *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("setHangupHook", 2, "void *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_setHangupHook", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "CoreSession_setHangupHook");
-		(arg1)->setHangupHook(arg2);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_set_tts_parms(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  SWIG_check_num_args("set_tts_parms",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("set_tts_parms",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("set_tts_parms",2,"char *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("set_tts_parms",3,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_set_tts_parms",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  (arg1)->set_tts_parms(arg2,arg3);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_ready(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		bool result;
-
-		SWIG_check_num_args("ready", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("ready", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_ready", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (bool) (arg1)->ready();
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_collectDigits(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int result;
+  
+  SWIG_check_num_args("collectDigits",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("collectDigits",1,"CoreSession *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("collectDigits",2,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_collectDigits",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  result = (int)(arg1)->collectDigits(arg2);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_execute__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-
-		SWIG_check_num_args("execute", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("execute", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("execute", 2, "char *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("execute", 3, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_execute", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		(arg1)->execute(arg2, arg3);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_getDigits__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("getDigits",4,4)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getDigits",1,"CoreSession *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("getDigits",2,"int");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("getDigits",3,"char *");
+  if(!lua_isnumber(L,4)) SWIG_fail_arg("getDigits",4,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_getDigits",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  arg4 = (int)lua_tonumber(L, 4);
+  result = (char *)(arg1)->getDigits(arg2,arg3,arg4);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_execute__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("execute", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("execute", 1, "CoreSession *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("execute", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_execute", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		(arg1)->execute(arg2);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_getDigits__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  int arg5 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("getDigits",5,5)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getDigits",1,"CoreSession *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("getDigits",2,"int");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("getDigits",3,"char *");
+  if(!lua_isnumber(L,4)) SWIG_fail_arg("getDigits",4,"int");
+  if(!lua_isnumber(L,5)) SWIG_fail_arg("getDigits",5,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_getDigits",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  arg4 = (int)lua_tonumber(L, 4);
+  arg5 = (int)lua_tonumber(L, 5);
+  result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_execute(lua_State * L) {
-		int argc;
-		int argv[4] = {
-			1, 2, 3, 4
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 2) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					return _wrap_CoreSession_execute__SWIG_1(L);
-				}
-			}
-		}
-		if (argc == 3) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					{
-						_v = lua_isstring(L, argv[2]);
-					}
-					if (_v) {
-						return _wrap_CoreSession_execute__SWIG_0(L);
-					}
-				}
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'CoreSession_execute'");
-		lua_error(L);
-		return 0;
-	}
 
+static int _wrap_CoreSession_getDigits(lua_State* L) {
+  int argc;
+  int argv[6]={
+    1,2,3,4,5,6
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 4) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isnumber(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          {
+            _v = lua_isnumber(L,argv[3]);
+          }
+          if (_v) {
+            return _wrap_CoreSession_getDigits__SWIG_0(L);
+          }
+        }
+      }
+    }
+  }
+  if (argc == 5) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isnumber(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          {
+            _v = lua_isnumber(L,argv[3]);
+          }
+          if (_v) {
+            {
+              _v = lua_isnumber(L,argv[4]);
+            }
+            if (_v) {
+              return _wrap_CoreSession_getDigits__SWIG_1(L);
+            }
+          }
+        }
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'CoreSession_getDigits'");
+  lua_error(L);return 0;
+}
 
-	static int _wrap_CoreSession_sendEvent(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		Event *arg2 = (Event *) 0;
 
-		SWIG_check_num_args("sendEvent", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("sendEvent", 1, "CoreSession *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("sendEvent", 2, "Event *");
+static int _wrap_CoreSession_transfer(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("transfer",4,4)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("transfer",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("transfer",2,"char *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("transfer",3,"char *");
+  if(!lua_isstring(L,4)) SWIG_fail_arg("transfer",4,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_transfer",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  arg4 = (char *)lua_tostring(L, 4);
+  result = (int)(arg1)->transfer(arg2,arg3,arg4);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_sendEvent", 1, SWIGTYPE_p_CoreSession);
-		}
 
+static int _wrap_CoreSession_read(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int arg3 ;
+  char *arg4 = (char *) 0 ;
+  int arg5 ;
+  char *arg6 = (char *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("read",6,6)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("read",1,"CoreSession *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("read",2,"int");
+  if(!lua_isnumber(L,3)) SWIG_fail_arg("read",3,"int");
+  if(!lua_isstring(L,4)) SWIG_fail_arg("read",4,"char const *");
+  if(!lua_isnumber(L,5)) SWIG_fail_arg("read",5,"int");
+  if(!lua_isstring(L,6)) SWIG_fail_arg("read",6,"char const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_read",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  arg3 = (int)lua_tonumber(L, 3);
+  arg4 = (char *)lua_tostring(L, 4);
+  arg5 = (int)lua_tonumber(L, 5);
+  arg6 = (char *)lua_tostring(L, 6);
+  result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("CoreSession_sendEvent", 2, SWIGTYPE_p_Event);
-		}
 
-		(arg1)->sendEvent(arg2);
-		SWIG_arg = 0;
+static int _wrap_CoreSession_playAndGetDigits(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int arg3 ;
+  int arg4 ;
+  int arg5 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  char *arg9 = (char *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("playAndGetDigits",9,9)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("playAndGetDigits",1,"CoreSession *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("playAndGetDigits",2,"int");
+  if(!lua_isnumber(L,3)) SWIG_fail_arg("playAndGetDigits",3,"int");
+  if(!lua_isnumber(L,4)) SWIG_fail_arg("playAndGetDigits",4,"int");
+  if(!lua_isnumber(L,5)) SWIG_fail_arg("playAndGetDigits",5,"int");
+  if(!lua_isstring(L,6)) SWIG_fail_arg("playAndGetDigits",6,"char *");
+  if(!lua_isstring(L,7)) SWIG_fail_arg("playAndGetDigits",7,"char *");
+  if(!lua_isstring(L,8)) SWIG_fail_arg("playAndGetDigits",8,"char *");
+  if(!lua_isstring(L,9)) SWIG_fail_arg("playAndGetDigits",9,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_playAndGetDigits",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  arg3 = (int)lua_tonumber(L, 3);
+  arg4 = (int)lua_tonumber(L, 4);
+  arg5 = (int)lua_tonumber(L, 5);
+  arg6 = (char *)lua_tostring(L, 6);
+  arg7 = (char *)lua_tostring(L, 7);
+  arg8 = (char *)lua_tostring(L, 8);
+  arg9 = (char *)lua_tostring(L, 9);
+  result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		return SWIG_arg;
 
-		if (0)
-			SWIG_fail;
+static int _wrap_CoreSession_streamFile__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int result;
+  
+  SWIG_check_num_args("streamFile",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("streamFile",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("streamFile",2,"char *");
+  if(!lua_isnumber(L,3)) SWIG_fail_arg("streamFile",3,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_streamFile",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (int)lua_tonumber(L, 3);
+  result = (int)(arg1)->streamFile(arg2,arg3);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_streamFile__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("streamFile",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("streamFile",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("streamFile",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_streamFile",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  result = (int)(arg1)->streamFile(arg2);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_setEventData(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		Event *arg2 = (Event *) 0;
 
-		SWIG_check_num_args("setEventData", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setEventData", 1, "CoreSession *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("setEventData", 2, "Event *");
+static int _wrap_CoreSession_streamFile(lua_State* L) {
+  int argc;
+  int argv[4]={
+    1,2,3,4
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_CoreSession_streamFile__SWIG_1(L);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isnumber(L,argv[2]);
+        }
+        if (_v) {
+          return _wrap_CoreSession_streamFile__SWIG_0(L);
+        }
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'CoreSession_streamFile'");
+  lua_error(L);return 0;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_setEventData", 1, SWIGTYPE_p_CoreSession);
-		}
 
+static int _wrap_CoreSession_sleep(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int result;
+  
+  SWIG_check_num_args("sleep",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sleep",1,"CoreSession *");
+  if(!lua_isnumber(L,2)) SWIG_fail_arg("sleep",2,"int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_sleep",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (int)lua_tonumber(L, 2);
+  result = (int)(arg1)->sleep(arg2);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_Event, 0))) {
-			SWIG_fail_ptr("CoreSession_setEventData", 2, SWIGTYPE_p_Event);
-		}
 
-		(arg1)->setEventData(arg2);
-		SWIG_arg = 0;
+static int _wrap_CoreSession_flushEvents(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("flushEvents",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flushEvents",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_flushEvents",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (int)(arg1)->flushEvents();
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		return SWIG_arg;
 
-		if (0)
-			SWIG_fail;
+static int _wrap_CoreSession_flushDigits(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  
+  SWIG_check_num_args("flushDigits",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flushDigits",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_flushDigits",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (int)(arg1)->flushDigits();
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_setAutoHangup(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool arg2 ;
+  int result;
+  
+  SWIG_check_num_args("setAutoHangup",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setAutoHangup",1,"CoreSession *");
+  if(!lua_isboolean(L,2)) SWIG_fail_arg("setAutoHangup",2,"bool");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_setAutoHangup",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (lua_toboolean(L, 2)!=0);
+  result = (int)(arg1)->setAutoHangup(arg2);
+  SWIG_arg=0;
+  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_getXMLCDR(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("getXMLCDR", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("getXMLCDR", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_getXMLCDR", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (char *) (arg1)->getXMLCDR();
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_setHangupHook(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  SWIG_check_num_args("setHangupHook",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"CoreSession *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setHangupHook",2,"void *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_setHangupHook",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_setHangupHook");
+  (arg1)->setHangupHook(arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_begin_allow_threads(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		bool result;
-
-		SWIG_check_num_args("begin_allow_threads", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("begin_allow_threads", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_begin_allow_threads", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (bool) (arg1)->begin_allow_threads();
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_ready(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("ready",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ready",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_ready",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (bool)(arg1)->ready();
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_end_allow_threads(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		bool result;
-
-		SWIG_check_num_args("end_allow_threads", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("end_allow_threads", 1, "CoreSession *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_end_allow_threads", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (bool) (arg1)->end_allow_threads();
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_answered(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("answered",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("answered",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_answered",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (bool)(arg1)->answered();
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_get_uuid(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("get_uuid", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("get_uuid", 1, "CoreSession const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_get_uuid", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		result = (char *) ((CoreSession const *) arg1)->get_uuid();
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_mediaReady(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("mediaReady",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mediaReady",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_mediaReady",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (bool)(arg1)->mediaReady();
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_get_cb_args(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_input_args_t *result = 0;
-
-		SWIG_check_num_args("get_cb_args", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("get_cb_args", 1, "CoreSession const *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_get_cb_args", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		{
-			switch_input_args_t const &_result_ref = ((CoreSession const *) arg1)->get_cb_args();
-			result = (switch_input_args_t *) &_result_ref;
-		}
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_input_args_t, 0);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_waitForAnswer(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  
+  SWIG_check_num_args("waitForAnswer",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("waitForAnswer",1,"CoreSession *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("waitForAnswer",2,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_waitForAnswer",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_waitForAnswer",2,SWIGTYPE_p_CoreSession);
+  }
+  
+  (arg1)->waitForAnswer(arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_check_hangup_hook(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
 
-		SWIG_check_num_args("check_hangup_hook", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("check_hangup_hook", 1, "CoreSession *");
+static int _wrap_CoreSession_execute__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  SWIG_check_num_args("execute",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  (arg1)->execute(arg2,arg3);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_check_hangup_hook", 1, SWIGTYPE_p_CoreSession);
-		}
 
-		(arg1)->check_hangup_hook();
-		SWIG_arg = 0;
+static int _wrap_CoreSession_execute__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("execute",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  (arg1)->execute(arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		return SWIG_arg;
 
-		if (0)
-			SWIG_fail;
+static int _wrap_CoreSession_execute(lua_State* L) {
+  int argc;
+  int argv[4]={
+    1,2,3,4
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_CoreSession_execute__SWIG_1(L);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          return _wrap_CoreSession_execute__SWIG_0(L);
+        }
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'CoreSession_execute'");
+  lua_error(L);return 0;
+}
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_sendEvent(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  Event *arg2 = (Event *) 0 ;
+  
+  SWIG_check_num_args("sendEvent",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sendEvent",1,"CoreSession *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("sendEvent",2,"Event *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_sendEvent",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("CoreSession_sendEvent",2,SWIGTYPE_p_Event);
+  }
+  
+  (arg1)->sendEvent(arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_CoreSession_run_dtmf_callback(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = (CoreSession *) 0;
-		void *arg2 = (void *) 0;
-		switch_input_type_t arg3;
-		switch_status_t result;
-		switch_input_type_t *argp3;
-
-		SWIG_check_num_args("run_dtmf_callback", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("run_dtmf_callback", 1, "CoreSession *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("run_dtmf_callback", 2, "void *");
-		if (!lua_isuserdata(L, 3))
-			SWIG_fail_arg("run_dtmf_callback", 3, "switch_input_type_t");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("CoreSession_run_dtmf_callback", 1, SWIGTYPE_p_CoreSession);
-		}
-
-		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "CoreSession_run_dtmf_callback");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 3, (void **) &argp3, SWIGTYPE_p_switch_input_type_t, 0))) {
-			SWIG_fail_ptr("CoreSession_run_dtmf_callback", 3, SWIGTYPE_p_switch_input_type_t);
-		}
-		arg3 = *argp3;
-
-		result = (arg1)->run_dtmf_callback(arg2, arg3);
-		SWIG_arg = 0;
-		{
-			switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
-			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
-			SWIG_arg++;
-		}
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_setEventData(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  Event *arg2 = (Event *) 0 ;
+  
+  SWIG_check_num_args("setEventData",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setEventData",1,"CoreSession *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setEventData",2,"Event *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_setEventData",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){
+    SWIG_fail_ptr("CoreSession_setEventData",2,SWIGTYPE_p_Event);
+  }
+  
+  (arg1)->setEventData(arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static void swig_delete_CoreSession(void *obj) {
-		CoreSession *arg1 = (CoreSession *) obj;
-		delete arg1;
-	}
-	static swig_lua_method swig_CoreSession_methods[] = {
-		{"answer", _wrap_CoreSession_answer},
-		{"preAnswer", _wrap_CoreSession_preAnswer},
-		{"hangup", _wrap_CoreSession_hangup},
-		{"setVariable", _wrap_CoreSession_setVariable},
-		{"setPrivate", _wrap_CoreSession_setPrivate},
-		{"getPrivate", _wrap_CoreSession_getPrivate},
-		{"getVariable", _wrap_CoreSession_getVariable},
-		{"process_callback_result", _wrap_CoreSession_process_callback_result},
-		{"say", _wrap_CoreSession_say},
-		{"sayPhrase", _wrap_CoreSession_sayPhrase},
-		{"recordFile", _wrap_CoreSession_recordFile},
-		{"setCallerData", _wrap_CoreSession_setCallerData},
-		{"originate", _wrap_CoreSession_originate},
-		{"setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
-		{"speak", _wrap_CoreSession_speak},
-		{"set_tts_parms", _wrap_CoreSession_set_tts_parms},
-		{"collectDigits", _wrap_CoreSession_collectDigits},
-		{"getDigits", _wrap_CoreSession_getDigits},
-		{"transfer", _wrap_CoreSession_transfer},
-		{"read", _wrap_CoreSession_read},
-		{"playAndGetDigits", _wrap_CoreSession_playAndGetDigits},
-		{"streamFile", _wrap_CoreSession_streamFile},
-		{"flushEvents", _wrap_CoreSession_flushEvents},
-		{"flushDigits", _wrap_CoreSession_flushDigits},
-		{"setAutoHangup", _wrap_CoreSession_setAutoHangup},
-		{"setHangupHook", _wrap_CoreSession_setHangupHook},
-		{"ready", _wrap_CoreSession_ready},
-		{"execute", _wrap_CoreSession_execute},
-		{"sendEvent", _wrap_CoreSession_sendEvent},
-		{"setEventData", _wrap_CoreSession_setEventData},
-		{"getXMLCDR", _wrap_CoreSession_getXMLCDR},
-		{"begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
-		{"end_allow_threads", _wrap_CoreSession_end_allow_threads},
-		{"get_uuid", _wrap_CoreSession_get_uuid},
-		{"get_cb_args", _wrap_CoreSession_get_cb_args},
-		{"check_hangup_hook", _wrap_CoreSession_check_hangup_hook},
-		{"run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback},
-		{0, 0}
-	};
-	static swig_lua_attribute swig_CoreSession_attributes[] = {
-		{"session", _wrap_CoreSession_session_get, _wrap_CoreSession_session_set},
-		{"channel", _wrap_CoreSession_channel_get, _wrap_CoreSession_channel_set},
-		{"flags", _wrap_CoreSession_flags_get, _wrap_CoreSession_flags_set},
-		{"allocated", _wrap_CoreSession_allocated_get, _wrap_CoreSession_allocated_set},
-		{"cb_state", _wrap_CoreSession_cb_state_get, _wrap_CoreSession_cb_state_set},
-		{"hook_state", _wrap_CoreSession_hook_state_get, _wrap_CoreSession_hook_state_set},
-		{0, 0, 0}
-	};
-	static swig_lua_class *swig_CoreSession_bases[] = { 0 };
-	static const char *swig_CoreSession_base_names[] = { 0 };
-	static swig_lua_class _wrap_class_CoreSession =
-		{ "CoreSession", &SWIGTYPE_p_CoreSession, 0, swig_delete_CoreSession, swig_CoreSession_methods, swig_CoreSession_attributes,
-swig_CoreSession_bases, swig_CoreSession_base_names };
-
-	static int _wrap_console_log(lua_State * L) {
-		int SWIG_arg = -1;
-		char *arg1 = (char *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("console_log", 2, 2)
-			if (!lua_isstring(L, 1))
-			SWIG_fail_arg("console_log", 1, "char *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("console_log", 2, "char *");
-		arg1 = (char *) lua_tostring(L, 1);
-		arg2 = (char *) lua_tostring(L, 2);
-		console_log(arg1, arg2);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_getXMLCDR(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("getXMLCDR",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getXMLCDR",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_getXMLCDR",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (char *)(arg1)->getXMLCDR();
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_console_clean_log(lua_State * L) {
-		int SWIG_arg = -1;
-		char *arg1 = (char *) 0;
-
-		SWIG_check_num_args("console_clean_log", 1, 1)
-			if (!lua_isstring(L, 1))
-			SWIG_fail_arg("console_clean_log", 1, "char *");
-		arg1 = (char *) lua_tostring(L, 1);
-		console_clean_log(arg1);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_begin_allow_threads(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("begin_allow_threads",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("begin_allow_threads",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_begin_allow_threads",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (bool)(arg1)->begin_allow_threads();
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_bridge(lua_State * L) {
-		int SWIG_arg = -1;
-		CoreSession *arg1 = 0;
-		CoreSession *arg2 = 0;
 
-		SWIG_check_num_args("bridge", 2, 2)
-			if (!lua_isuserdata(L, 1))
-			SWIG_fail_arg("bridge", 1, "CoreSession &");
-		if (!lua_isuserdata(L, 2))
-			SWIG_fail_arg("bridge", 2, "CoreSession &");
+static int _wrap_CoreSession_end_allow_threads(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("end_allow_threads",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("end_allow_threads",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_end_allow_threads",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (bool)(arg1)->end_allow_threads();
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("bridge", 1, SWIGTYPE_p_CoreSession);
-		}
 
+static int _wrap_CoreSession_get_uuid(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("get_uuid",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_uuid",1,"CoreSession const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_get_uuid",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (char *)((CoreSession const *)arg1)->get_uuid();
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
-			SWIG_fail_ptr("bridge", 2, SWIGTYPE_p_CoreSession);
-		}
 
-		bridge(*arg1, *arg2);
-		SWIG_arg = 0;
+static int _wrap_CoreSession_get_cb_args(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_input_args_t *result = 0 ;
+  
+  SWIG_check_num_args("get_cb_args",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_cb_args",1,"CoreSession const *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_get_cb_args",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  {
+    switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
+    result = (switch_input_args_t *) &_result_ref;
+  }
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_input_args_t,0); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		return SWIG_arg;
 
-		if (0)
-			SWIG_fail;
+static int _wrap_CoreSession_check_hangup_hook(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  
+  SWIG_check_num_args("check_hangup_hook",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("check_hangup_hook",1,"CoreSession *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_check_hangup_hook",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  (arg1)->check_hangup_hook();
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_CoreSession_run_dtmf_callback(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_input_type_t arg3 ;
+  switch_status_t result;
+  switch_input_type_t *argp3 ;
+  
+  SWIG_check_num_args("run_dtmf_callback",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("run_dtmf_callback",1,"CoreSession *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("run_dtmf_callback",2,"void *");
+  if(!lua_isuserdata(L,3)) SWIG_fail_arg("run_dtmf_callback",3,"switch_input_type_t");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_run_dtmf_callback",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_run_dtmf_callback");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){
+    SWIG_fail_ptr("CoreSession_run_dtmf_callback",3,SWIGTYPE_p_switch_input_type_t);
+  }
+  arg3 = *argp3;
+  
+  result = (arg1)->run_dtmf_callback(arg2,arg3);
+  SWIG_arg=0;
+  {
+    switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
+    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
+  }
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_hanguphook(lua_State * L) {
-		int SWIG_arg = -1;
-		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
-		switch_status_t result;
-
-		SWIG_check_num_args("hanguphook", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("hanguphook", 1, "switch_core_session_t *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0))) {
-			SWIG_fail_ptr("hanguphook", 1, SWIGTYPE_p_switch_core_session_t);
-		}
-
-		result = hanguphook(arg1);
-		SWIG_arg = 0;
-		{
-			switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
-			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
-			SWIG_arg++;
-		}
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static void swig_delete_CoreSession(void *obj) {
+CoreSession *arg1 = (CoreSession *) obj;
+delete arg1;
+}
+static swig_lua_method swig_CoreSession_methods[] = {
+    {"answer", _wrap_CoreSession_answer}, 
+    {"preAnswer", _wrap_CoreSession_preAnswer}, 
+    {"hangup", _wrap_CoreSession_hangup}, 
+    {"setVariable", _wrap_CoreSession_setVariable}, 
+    {"setPrivate", _wrap_CoreSession_setPrivate}, 
+    {"getPrivate", _wrap_CoreSession_getPrivate}, 
+    {"getVariable", _wrap_CoreSession_getVariable}, 
+    {"process_callback_result", _wrap_CoreSession_process_callback_result}, 
+    {"say", _wrap_CoreSession_say}, 
+    {"sayPhrase", _wrap_CoreSession_sayPhrase}, 
+    {"recordFile", _wrap_CoreSession_recordFile}, 
+    {"setCallerData", _wrap_CoreSession_setCallerData}, 
+    {"originate", _wrap_CoreSession_originate}, 
+    {"setDTMFCallback", _wrap_CoreSession_setDTMFCallback}, 
+    {"speak", _wrap_CoreSession_speak}, 
+    {"set_tts_parms", _wrap_CoreSession_set_tts_parms}, 
+    {"collectDigits", _wrap_CoreSession_collectDigits}, 
+    {"getDigits", _wrap_CoreSession_getDigits}, 
+    {"transfer", _wrap_CoreSession_transfer}, 
+    {"read", _wrap_CoreSession_read}, 
+    {"playAndGetDigits", _wrap_CoreSession_playAndGetDigits}, 
+    {"streamFile", _wrap_CoreSession_streamFile}, 
+    {"sleep", _wrap_CoreSession_sleep}, 
+    {"flushEvents", _wrap_CoreSession_flushEvents}, 
+    {"flushDigits", _wrap_CoreSession_flushDigits}, 
+    {"setAutoHangup", _wrap_CoreSession_setAutoHangup}, 
+    {"setHangupHook", _wrap_CoreSession_setHangupHook}, 
+    {"ready", _wrap_CoreSession_ready}, 
+    {"answered", _wrap_CoreSession_answered}, 
+    {"mediaReady", _wrap_CoreSession_mediaReady}, 
+    {"waitForAnswer", _wrap_CoreSession_waitForAnswer}, 
+    {"execute", _wrap_CoreSession_execute}, 
+    {"sendEvent", _wrap_CoreSession_sendEvent}, 
+    {"setEventData", _wrap_CoreSession_setEventData}, 
+    {"getXMLCDR", _wrap_CoreSession_getXMLCDR}, 
+    {"begin_allow_threads", _wrap_CoreSession_begin_allow_threads}, 
+    {"end_allow_threads", _wrap_CoreSession_end_allow_threads}, 
+    {"get_uuid", _wrap_CoreSession_get_uuid}, 
+    {"get_cb_args", _wrap_CoreSession_get_cb_args}, 
+    {"check_hangup_hook", _wrap_CoreSession_check_hangup_hook}, 
+    {"run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback}, 
+    {0,0}
+};
+static swig_lua_attribute swig_CoreSession_attributes[] = {
+    { "session", _wrap_CoreSession_session_get, _wrap_CoreSession_session_set},
+    { "channel", _wrap_CoreSession_channel_get, _wrap_CoreSession_channel_set},
+    { "flags", _wrap_CoreSession_flags_get, _wrap_CoreSession_flags_set},
+    { "allocated", _wrap_CoreSession_allocated_get, _wrap_CoreSession_allocated_set},
+    { "cb_state", _wrap_CoreSession_cb_state_get, _wrap_CoreSession_cb_state_set},
+    { "hook_state", _wrap_CoreSession_hook_state_get, _wrap_CoreSession_hook_state_set},
+    { "uuid", _wrap_CoreSession_uuid_get, _wrap_CoreSession_uuid_set},
+    { "tts_name", _wrap_CoreSession_tts_name_get, _wrap_CoreSession_tts_name_set},
+    { "voice_name", _wrap_CoreSession_voice_name_get, _wrap_CoreSession_voice_name_set},
+    {0,0,0}
+};
+static swig_lua_class *swig_CoreSession_bases[] = {0};
+static const char *swig_CoreSession_base_names[] = {0};
+static swig_lua_class _wrap_class_CoreSession = { "CoreSession", &SWIGTYPE_p_CoreSession,0, swig_delete_CoreSession, swig_CoreSession_methods, swig_CoreSession_attributes, swig_CoreSession_bases, swig_CoreSession_base_names };
+
+static int _wrap_console_log(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("console_log",2,2)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("console_log",1,"char *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("console_log",2,"char *");
+  arg1 = (char *)lua_tostring(L, 1);
+  arg2 = (char *)lua_tostring(L, 2);
+  console_log(arg1,arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_dtmf_callback(lua_State * L) {
-		int SWIG_arg = -1;
-		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
-		void *arg2 = (void *) 0;
-		switch_input_type_t arg3;
-		void *arg4 = (void *) 0;
-		unsigned int arg5;
-		switch_status_t result;
-		switch_input_type_t *argp3;
-
-		SWIG_check_num_args("dtmf_callback", 5, 5)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("dtmf_callback", 1, "switch_core_session_t *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("dtmf_callback", 2, "void *");
-		if (!lua_isuserdata(L, 3))
-			SWIG_fail_arg("dtmf_callback", 3, "switch_input_type_t");
-		if (!SWIG_isptrtype(L, 4))
-			SWIG_fail_arg("dtmf_callback", 4, "void *");
-		if (!lua_isnumber(L, 5))
-			SWIG_fail_arg("dtmf_callback", 5, "unsigned int");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0))) {
-			SWIG_fail_ptr("dtmf_callback", 1, SWIGTYPE_p_switch_core_session_t);
-		}
-
-		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "dtmf_callback");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 3, (void **) &argp3, SWIGTYPE_p_switch_input_type_t, 0))) {
-			SWIG_fail_ptr("dtmf_callback", 3, SWIGTYPE_p_switch_input_type_t);
-		}
-		arg3 = *argp3;
-
-		arg4 = (void *) SWIG_MustGetPtr(L, 4, 0, 0, 4, "dtmf_callback");
-		arg5 = (unsigned int) lua_tonumber(L, 5);
-		result = dtmf_callback(arg1, arg2, arg3, arg4, arg5);
-		SWIG_arg = 0;
-		{
-			switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
-			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
-			SWIG_arg++;
-		}
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_console_clean_log(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  
+  SWIG_check_num_args("console_clean_log",1,1)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("console_clean_log",1,"char *");
+  arg1 = (char *)lua_tostring(L, 1);
+  console_clean_log(arg1);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_new_Session__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * result = 0;
-
-		SWIG_check_num_args("LUA::Session", 0, 0)
-		result = (LUA::Session *) new LUA::Session();
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_LUA__Session, 1);
-		SWIG_arg++;
-		result->setLUA(L);
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_bridge(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = 0 ;
+  CoreSession *arg2 = 0 ;
+  
+  SWIG_check_num_args("bridge",2,2)
+  if(!lua_isuserdata(L,1)) SWIG_fail_arg("bridge",1,"CoreSession &");
+  if(!lua_isuserdata(L,2)) SWIG_fail_arg("bridge",2,"CoreSession &");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("bridge",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("bridge",2,SWIGTYPE_p_CoreSession);
+  }
+  
+  bridge(*arg1,*arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_new_Session__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		char *arg1 = (char *) 0;
-		LUA::Session * result = 0;
-
-		SWIG_check_num_args("LUA::Session", 1, 1)
-			if (!lua_isstring(L, 1))
-			SWIG_fail_arg("LUA::Session", 1, "char *");
-		arg1 = (char *) lua_tostring(L, 1);
-		result = (LUA::Session *) new LUA::Session(arg1);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_LUA__Session, 1);
-		SWIG_arg++;
-		result->setLUA(L);
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_hanguphook(lua_State* L) {
+  int SWIG_arg = -1;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  SWIG_check_num_args("hanguphook",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hanguphook",1,"switch_core_session_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){
+    SWIG_fail_ptr("hanguphook",1,SWIGTYPE_p_switch_core_session_t);
+  }
+  
+  result = hanguphook(arg1);
+  SWIG_arg=0;
+  {
+    switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
+    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
+  }
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_new_Session__SWIG_2(lua_State * L) {
-		int SWIG_arg = -1;
-		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
-		LUA::Session * result = 0;
-
-		SWIG_check_num_args("LUA::Session", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("LUA::Session", 1, "switch_core_session_t *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0))) {
-			SWIG_fail_ptr("new_Session", 1, SWIGTYPE_p_switch_core_session_t);
-		}
-
-		result = (LUA::Session *) new LUA::Session(arg1);
-		SWIG_arg = 0;
-		SWIG_NewPointerObj(L, result, SWIGTYPE_p_LUA__Session, 1);
-		SWIG_arg++;
-		result->setLUA(L);
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
 
+static int _wrap_dtmf_callback(lua_State* L) {
+  int SWIG_arg = -1;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_input_type_t arg3 ;
+  void *arg4 = (void *) 0 ;
+  unsigned int arg5 ;
+  switch_status_t result;
+  switch_input_type_t *argp3 ;
+  
+  SWIG_check_num_args("dtmf_callback",5,5)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("dtmf_callback",1,"switch_core_session_t *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("dtmf_callback",2,"void *");
+  if(!lua_isuserdata(L,3)) SWIG_fail_arg("dtmf_callback",3,"switch_input_type_t");
+  if(!SWIG_isptrtype(L,4)) SWIG_fail_arg("dtmf_callback",4,"void *");
+  if(!lua_isnumber(L,5)) SWIG_fail_arg("dtmf_callback",5,"unsigned int");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){
+    SWIG_fail_ptr("dtmf_callback",1,SWIGTYPE_p_switch_core_session_t);
+  }
+  
+  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"dtmf_callback");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){
+    SWIG_fail_ptr("dtmf_callback",3,SWIGTYPE_p_switch_input_type_t);
+  }
+  arg3 = *argp3;
+  
+  arg4=(void *)SWIG_MustGetPtr(L,4,0,0,4,"dtmf_callback");
+  arg5 = (unsigned int)lua_tonumber(L, 5);
+  result = dtmf_callback(arg1,arg2,arg3,arg4,arg5);
+  SWIG_arg=0;
+  {
+    switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
+    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
+  }
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_new_Session(lua_State * L) {
-		int argc;
-		int argv[2] = {
-			1, 2
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 0) {
-			return _wrap_new_Session__SWIG_0(L);
-		}
-		if (argc == 1) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_core_session_t, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				return _wrap_new_Session__SWIG_2(L);
-			}
-		}
-		if (argc == 1) {
-			int _v;
-			{
-				_v = lua_isstring(L, argv[0]);
-			}
-			if (_v) {
-				return _wrap_new_Session__SWIG_1(L);
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'new_Session'");
-		lua_error(L);
-		return 0;
-	}
 
+static int _wrap_new_Session__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *result = 0 ;
+  
+  SWIG_check_num_args("LUA::Session",0,0)
+  result = (LUA::Session *)new LUA::Session();
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-	static int _wrap_delete_Session(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
 
-		SWIG_check_num_args("LUA::~Session", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("LUA::~Session", 1, "LUA::Session *");
+static int _wrap_new_Session__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  LUA::Session *result = 0 ;
+  
+  SWIG_check_num_args("LUA::Session",2,2)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Session",1,"char *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("LUA::Session",2,"CoreSession *");
+  arg1 = (char *)lua_tostring(L, 1);
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("new_Session",2,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (LUA::Session *)new LUA::Session(arg1,arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, SWIG_POINTER_DISOWN))) {
-			SWIG_fail_ptr("delete_Session", 1, SWIGTYPE_p_LUA__Session);
-		}
 
-		delete arg1;
+static int _wrap_new_Session__SWIG_2(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  LUA::Session *result = 0 ;
+  
+  SWIG_check_num_args("LUA::Session",1,1)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Session",1,"char *");
+  arg1 = (char *)lua_tostring(L, 1);
+  result = (LUA::Session *)new LUA::Session(arg1);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		SWIG_arg = 0;
 
-		return SWIG_arg;
+static int _wrap_new_Session__SWIG_3(lua_State* L) {
+  int SWIG_arg = -1;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  LUA::Session *result = 0 ;
+  
+  SWIG_check_num_args("LUA::Session",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::Session",1,"switch_core_session_t *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){
+    SWIG_fail_ptr("new_Session",1,SWIGTYPE_p_switch_core_session_t);
+  }
+  
+  result = (LUA::Session *)new LUA::Session(arg1);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (0)
-			SWIG_fail;
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_new_Session(lua_State* L) {
+  int argc;
+  int argv[3]={
+    1,2,3
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 0) {
+    return _wrap_new_Session__SWIG_0(L);
+  }
+  if (argc == 1) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_core_session_t, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      return _wrap_new_Session__SWIG_3(L);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]);
+    }
+    if (_v) {
+      return _wrap_new_Session__SWIG_2(L);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]);
+    }
+    if (_v) {
+      {
+        void *ptr;
+        if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+          _v = 0;
+        } else {
+          _v = 1;
+        }
+      }
+      if (_v) {
+        return _wrap_new_Session__SWIG_1(L);
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'new_Session'");
+  lua_error(L);return 0;
+}
 
 
-	static int _wrap_Session_begin_allow_threads(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		bool result;
-
-		SWIG_check_num_args("begin_allow_threads", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("begin_allow_threads", 1, "LUA::Session *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_begin_allow_threads", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		result = (bool) (arg1)->begin_allow_threads();
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_delete_Session(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  
+  SWIG_check_num_args("LUA::~Session",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::~Session",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_Session",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_end_allow_threads(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		bool result;
-
-		SWIG_check_num_args("end_allow_threads", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("end_allow_threads", 1, "LUA::Session *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_end_allow_threads", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		result = (bool) (arg1)->end_allow_threads();
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_begin_allow_threads(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("begin_allow_threads",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("begin_allow_threads",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_begin_allow_threads",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  result = (bool)(arg1)->begin_allow_threads();
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_check_hangup_hook(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
+static int _wrap_Session_end_allow_threads(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("end_allow_threads",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("end_allow_threads",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_end_allow_threads",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  result = (bool)(arg1)->end_allow_threads();
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		SWIG_check_num_args("check_hangup_hook", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("check_hangup_hook", 1, "LUA::Session *");
 
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_check_hangup_hook", 1, SWIGTYPE_p_LUA__Session);
-		}
+static int _wrap_Session_check_hangup_hook(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  
+  SWIG_check_num_args("check_hangup_hook",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("check_hangup_hook",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_check_hangup_hook",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  (arg1)->check_hangup_hook();
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		(arg1)->check_hangup_hook();
-		SWIG_arg = 0;
 
-		return SWIG_arg;
+static int _wrap_Session_run_dtmf_callback(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_input_type_t arg3 ;
+  switch_status_t result;
+  switch_input_type_t *argp3 ;
+  
+  SWIG_check_num_args("run_dtmf_callback",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("run_dtmf_callback",1,"LUA::Session *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("run_dtmf_callback",2,"void *");
+  if(!lua_isuserdata(L,3)) SWIG_fail_arg("run_dtmf_callback",3,"switch_input_type_t");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_run_dtmf_callback",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"Session_run_dtmf_callback");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){
+    SWIG_fail_ptr("Session_run_dtmf_callback",3,SWIGTYPE_p_switch_input_type_t);
+  }
+  arg3 = *argp3;
+  
+  result = (arg1)->run_dtmf_callback(arg2,arg3);
+  SWIG_arg=0;
+  {
+    switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
+    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
+  }
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
-		if (0)
-			SWIG_fail;
 
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_setInputCallback__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  SWIG_check_num_args("setInputCallback",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setInputCallback",1,"LUA::Session *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("setInputCallback",2,"char *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("setInputCallback",3,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_setInputCallback",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  (arg1)->setInputCallback(arg2,arg3);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_run_dtmf_callback(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		void *arg2 = (void *) 0;
-		switch_input_type_t arg3;
-		switch_status_t result;
-		switch_input_type_t *argp3;
-
-		SWIG_check_num_args("run_dtmf_callback", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("run_dtmf_callback", 1, "LUA::Session *");
-		if (!SWIG_isptrtype(L, 2))
-			SWIG_fail_arg("run_dtmf_callback", 2, "void *");
-		if (!lua_isuserdata(L, 3))
-			SWIG_fail_arg("run_dtmf_callback", 3, "switch_input_type_t");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_run_dtmf_callback", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "Session_run_dtmf_callback");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 3, (void **) &argp3, SWIGTYPE_p_switch_input_type_t, 0))) {
-			SWIG_fail_ptr("Session_run_dtmf_callback", 3, SWIGTYPE_p_switch_input_type_t);
-		}
-		arg3 = *argp3;
-
-		result = (arg1)->run_dtmf_callback(arg2, arg3);
-		SWIG_arg = 0;
-		{
-			switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
-			SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
-			SWIG_arg++;
-		}
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_setInputCallback__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("setInputCallback",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setInputCallback",1,"LUA::Session *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("setInputCallback",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_setInputCallback",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  (arg1)->setInputCallback(arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_setInputCallback(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-
-		SWIG_check_num_args("setInputCallback", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setInputCallback", 1, "LUA::Session *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("setInputCallback", 2, "char *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("setInputCallback", 3, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_setInputCallback", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		(arg1)->setInputCallback(arg2, arg3);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_setInputCallback(lua_State* L) {
+  int argc;
+  int argv[4]={
+    1,2,3,4
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_Session_setInputCallback__SWIG_1(L);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          return _wrap_Session_setInputCallback__SWIG_0(L);
+        }
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'Session_setInputCallback'");
+  lua_error(L);return 0;
+}
 
 
-	static int _wrap_Session_setHangupHook__SWIG_0(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-
-		SWIG_check_num_args("setHangupHook", 3, 3)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setHangupHook", 1, "LUA::Session *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("setHangupHook", 2, "char *");
-		if (!lua_isstring(L, 3))
-			SWIG_fail_arg("setHangupHook", 3, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_setHangupHook", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		arg3 = (char *) lua_tostring(L, 3);
-		(arg1)->setHangupHook(arg2, arg3);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_setHangupHook__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  SWIG_check_num_args("setHangupHook",3,3)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"LUA::Session *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("setHangupHook",2,"char *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("setHangupHook",3,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_setHangupHook",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  (arg1)->setHangupHook(arg2,arg3);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_setHangupHook__SWIG_1(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("setHangupHook", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setHangupHook", 1, "LUA::Session *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("setHangupHook", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_setHangupHook", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		(arg1)->setHangupHook(arg2);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_setHangupHook__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("setHangupHook",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"LUA::Session *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("setHangupHook",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_setHangupHook",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  (arg1)->setHangupHook(arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_setHangupHook(lua_State * L) {
-		int argc;
-		int argv[4] = {
-			1, 2, 3, 4
-		};
-
-		argc = lua_gettop(L);
-		if (argc == 2) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					return _wrap_Session_setHangupHook__SWIG_1(L);
-				}
-			}
-		}
-		if (argc == 3) {
-			int _v;
-			{
-				void *ptr;
-				if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
-					_v = 0;
-				} else {
-					_v = 1;
-				}
-			}
-			if (_v) {
-				{
-					_v = lua_isstring(L, argv[1]);
-				}
-				if (_v) {
-					{
-						_v = lua_isstring(L, argv[2]);
-					}
-					if (_v) {
-						return _wrap_Session_setHangupHook__SWIG_0(L);
-					}
-				}
-			}
-		}
-
-		lua_pushstring(L, "No matching function for overloaded 'Session_setHangupHook'");
-		lua_error(L);
-		return 0;
-	}
+static int _wrap_Session_setHangupHook(lua_State* L) {
+  int argc;
+  int argv[4]={
+    1,2,3,4
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_Session_setHangupHook__SWIG_1(L);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          return _wrap_Session_setHangupHook__SWIG_0(L);
+        }
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'Session_setHangupHook'");
+  lua_error(L);return 0;
+}
 
 
-	static int _wrap_Session_ready(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		bool result;
-
-		SWIG_check_num_args("ready", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("ready", 1, "LUA::Session *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_ready", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		result = (bool) (arg1)->ready();
-		SWIG_arg = 0;
-		lua_pushboolean(L, (int) (result == true));
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_ready(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  bool result;
+  
+  SWIG_check_num_args("ready",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ready",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_ready",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  result = (bool)(arg1)->ready();
+  SWIG_arg=0;
+  lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_cb_function_set(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("cb_function", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("cb_function", 1, "LUA::Session *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("cb_function", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_cb_function_set", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		{
-			if (arg1->cb_function)
-				delete[]arg1->cb_function;
-			if (arg2) {
-				arg1->cb_function = (char *) (new char[strlen((const char *)arg2) + 1]);
-				strcpy((char *) arg1->cb_function, (const char *) arg2);
-			} else {
-				arg1->cb_function = 0;
-			}
-		}
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_cb_function_set(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("cb_function",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_function",1,"LUA::Session *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("cb_function",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_cb_function_set",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->cb_function) delete [] arg1->cb_function;
+    if (arg2) {
+      arg1->cb_function = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->cb_function, (const char *)arg2);
+    } else {
+      arg1->cb_function = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_cb_function_get(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("cb_function", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("cb_function", 1, "LUA::Session *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_cb_function_get", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		result = (char *) ((arg1)->cb_function);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_cb_function_get(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("cb_function",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_function",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_cb_function_get",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  result = (char *) ((arg1)->cb_function);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_cb_arg_set(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("cb_arg", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("cb_arg", 1, "LUA::Session *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("cb_arg", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_cb_arg_set", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		{
-			if (arg1->cb_arg)
-				delete[]arg1->cb_arg;
-			if (arg2) {
-				arg1->cb_arg = (char *) (new char[strlen((const char *)arg2) + 1]);
-				strcpy((char *) arg1->cb_arg, (const char *) arg2);
-			} else {
-				arg1->cb_arg = 0;
-			}
-		}
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_cb_arg_set(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("cb_arg",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_arg",1,"LUA::Session *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("cb_arg",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_cb_arg_set",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->cb_arg) delete [] arg1->cb_arg;
+    if (arg2) {
+      arg1->cb_arg = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->cb_arg, (const char *)arg2);
+    } else {
+      arg1->cb_arg = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_cb_arg_get(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("cb_arg", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("cb_arg", 1, "LUA::Session *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_cb_arg_get", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		result = (char *) ((arg1)->cb_arg);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_cb_arg_get(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("cb_arg",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_arg",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_cb_arg_get",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  result = (char *) ((arg1)->cb_arg);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_hangup_func_str_set(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("hangup_func_str", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("hangup_func_str", 1, "LUA::Session *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("hangup_func_str", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_hangup_func_str_set", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		{
-			if (arg1->hangup_func_str)
-				delete[]arg1->hangup_func_str;
-			if (arg2) {
-				arg1->hangup_func_str = (char *) (new char[strlen((const char *)arg2) + 1]);
-				strcpy((char *) arg1->hangup_func_str, (const char *) arg2);
-			} else {
-				arg1->hangup_func_str = 0;
-			}
-		}
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_hangup_func_str_set(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("hangup_func_str",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_str",1,"LUA::Session *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("hangup_func_str",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_hangup_func_str_set",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->hangup_func_str) delete [] arg1->hangup_func_str;
+    if (arg2) {
+      arg1->hangup_func_str = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->hangup_func_str, (const char *)arg2);
+    } else {
+      arg1->hangup_func_str = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_hangup_func_str_get(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("hangup_func_str", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("hangup_func_str", 1, "LUA::Session *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_hangup_func_str_get", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		result = (char *) ((arg1)->hangup_func_str);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_hangup_func_str_get(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("hangup_func_str",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_str",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_hangup_func_str_get",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  result = (char *) ((arg1)->hangup_func_str);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_hangup_func_arg_set(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		char *arg2 = (char *) 0;
-
-		SWIG_check_num_args("hangup_func_arg", 2, 2)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("hangup_func_arg", 1, "LUA::Session *");
-		if (!lua_isstring(L, 2))
-			SWIG_fail_arg("hangup_func_arg", 2, "char *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_hangup_func_arg_set", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		arg2 = (char *) lua_tostring(L, 2);
-		{
-			if (arg1->hangup_func_arg)
-				delete[]arg1->hangup_func_arg;
-			if (arg2) {
-				arg1->hangup_func_arg = (char *) (new char[strlen((const char *)arg2) + 1]);
-				strcpy((char *) arg1->hangup_func_arg, (const char *) arg2);
-			} else {
-				arg1->hangup_func_arg = 0;
-			}
-		}
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_hangup_func_arg_set(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("hangup_func_arg",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_arg",1,"LUA::Session *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("hangup_func_arg",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_hangup_func_arg_set",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  {
+    if (arg1->hangup_func_arg) delete [] arg1->hangup_func_arg;
+    if (arg2) {
+      arg1->hangup_func_arg = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->hangup_func_arg, (const char *)arg2);
+    } else {
+      arg1->hangup_func_arg = 0;
+    }
+  }
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_hangup_func_arg_get(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		char *result = 0;
-
-		SWIG_check_num_args("hangup_func_arg", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("hangup_func_arg", 1, "LUA::Session *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_hangup_func_arg_get", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		result = (char *) ((arg1)->hangup_func_arg);
-		SWIG_arg = 0;
-		lua_pushstring(L, (const char *) result);
-		SWIG_arg++;
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_hangup_func_arg_get(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  char *result = 0 ;
+  
+  SWIG_check_num_args("hangup_func_arg",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_arg",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_hangup_func_arg_get",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  result = (char *) ((arg1)->hangup_func_arg);
+  SWIG_arg=0;
+  lua_pushstring(L,(const char*)result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static int _wrap_Session_setLUA(lua_State * L) {
-		int SWIG_arg = -1;
-		LUA::Session * arg1 = (LUA::Session *) 0;
-		lua_State *arg2 = (lua_State *) 0;
-
-		arg2 = L;
-		SWIG_check_num_args("setLUA", 1, 1)
-			if (!SWIG_isptrtype(L, 1))
-			SWIG_fail_arg("setLUA", 1, "LUA::Session *");
-
-		if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
-			SWIG_fail_ptr("Session_setLUA", 1, SWIGTYPE_p_LUA__Session);
-		}
-
-		(arg1)->setLUA(arg2);
-		SWIG_arg = 0;
-
-		return SWIG_arg;
-
-		if (0)
-			SWIG_fail;
-
-	  fail:
-		lua_error(L);
-		return SWIG_arg;
-	}
+static int _wrap_Session_setLUA(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  lua_State *arg2 = (lua_State *) 0 ;
+  
+  arg2 = L;
+  SWIG_check_num_args("setLUA",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setLUA",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_setLUA",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  (arg1)->setLUA(arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
 
 
-	static void swig_delete_Session(void *obj) {
-		LUA::Session * arg1 = (LUA::Session *) obj;
-		delete arg1;
-	}
-	static swig_lua_method swig_LUA_Session_methods[] = {
-		{"begin_allow_threads", _wrap_Session_begin_allow_threads},
-		{"end_allow_threads", _wrap_Session_end_allow_threads},
-		{"check_hangup_hook", _wrap_Session_check_hangup_hook},
-		{"run_dtmf_callback", _wrap_Session_run_dtmf_callback},
-		{"setInputCallback", _wrap_Session_setInputCallback},
-		{"setHangupHook", _wrap_Session_setHangupHook},
-		{"ready", _wrap_Session_ready},
-		{"setLUA", _wrap_Session_setLUA},
-		{0, 0}
-	};
-	static swig_lua_attribute swig_LUA_Session_attributes[] = {
-		{"cb_function", _wrap_Session_cb_function_get, _wrap_Session_cb_function_set},
-		{"cb_arg", _wrap_Session_cb_arg_get, _wrap_Session_cb_arg_set},
-		{"hangup_func_str", _wrap_Session_hangup_func_str_get, _wrap_Session_hangup_func_str_set},
-		{"hangup_func_arg", _wrap_Session_hangup_func_arg_get, _wrap_Session_hangup_func_arg_set},
-		{0, 0, 0}
-	};
-	static swig_lua_class *swig_LUA_Session_bases[] = { 0, 0 };
-	static const char *swig_LUA_Session_base_names[] = { "CoreSession *", 0 };
-	static swig_lua_class _wrap_class_LUA_Session =
-		{ "Session", &SWIGTYPE_p_LUA__Session, _wrap_new_Session, swig_delete_Session, swig_LUA_Session_methods, swig_LUA_Session_attributes,
-swig_LUA_Session_bases, swig_LUA_Session_base_names };
+static void swig_delete_Session(void *obj) {
+LUA::Session *arg1 = (LUA::Session *) obj;
+delete arg1;
+}
+static swig_lua_method swig_LUA_Session_methods[] = {
+    {"begin_allow_threads", _wrap_Session_begin_allow_threads}, 
+    {"end_allow_threads", _wrap_Session_end_allow_threads}, 
+    {"check_hangup_hook", _wrap_Session_check_hangup_hook}, 
+    {"run_dtmf_callback", _wrap_Session_run_dtmf_callback}, 
+    {"setInputCallback", _wrap_Session_setInputCallback}, 
+    {"setHangupHook", _wrap_Session_setHangupHook}, 
+    {"ready", _wrap_Session_ready}, 
+    {"setLUA", _wrap_Session_setLUA}, 
+    {0,0}
+};
+static swig_lua_attribute swig_LUA_Session_attributes[] = {
+    { "cb_function", _wrap_Session_cb_function_get, _wrap_Session_cb_function_set},
+    { "cb_arg", _wrap_Session_cb_arg_get, _wrap_Session_cb_arg_set},
+    { "hangup_func_str", _wrap_Session_hangup_func_str_get, _wrap_Session_hangup_func_str_set},
+    { "hangup_func_arg", _wrap_Session_hangup_func_arg_get, _wrap_Session_hangup_func_arg_set},
+    {0,0,0}
+};
+static swig_lua_class *swig_LUA_Session_bases[] = {0,0};
+static const char *swig_LUA_Session_base_names[] = {"CoreSession *",0};
+static swig_lua_class _wrap_class_LUA_Session = { "Session", &SWIGTYPE_p_LUA__Session,_wrap_new_Session, swig_delete_Session, swig_LUA_Session_methods, swig_LUA_Session_attributes, swig_LUA_Session_bases, swig_LUA_Session_base_names };
 
 #ifdef __cplusplus
 }
 #endif
 
 static const struct luaL_reg swig_commands[] = {
-	{"consoleLog", _wrap_consoleLog},
-	{"consoleCleanLog", _wrap_consoleCleanLog},
-	{"console_log", _wrap_console_log},
-	{"console_clean_log", _wrap_console_clean_log},
-	{"bridge", _wrap_bridge},
-	{"hanguphook", _wrap_hanguphook},
-	{"dtmf_callback", _wrap_dtmf_callback},
-	{0, 0}
+    { "consoleLog", _wrap_consoleLog},
+    { "consoleCleanLog", _wrap_consoleCleanLog},
+    { "console_log", _wrap_console_log},
+    { "console_clean_log", _wrap_console_clean_log},
+    { "bridge", _wrap_bridge},
+    { "hanguphook", _wrap_hanguphook},
+    { "dtmf_callback", _wrap_dtmf_callback},
+    {0,0}
 };
 
 static swig_lua_var_info swig_variables[] = {
-	{0, 0, 0}
+    {0,0,0}
 };
 
 static swig_lua_const_info swig_constants[] = {
-	{SWIG_LUA_INT, (char *) "S_HUP", (long) S_HUP, 0, 0, 0},
-	{SWIG_LUA_INT, (char *) "S_FREE", (long) S_FREE, 0, 0, 0},
-	{SWIG_LUA_INT, (char *) "S_RDLOCK", (long) S_RDLOCK, 0, 0, 0},
-	{0, 0, 0, 0, 0, 0}
+{ SWIG_LUA_INT,     (char *)"S_HUP", (long) S_HUP, 0, 0, 0},
+{ SWIG_LUA_INT,     (char *)"S_FREE", (long) S_FREE, 0, 0, 0},
+{ SWIG_LUA_INT,     (char *)"S_RDLOCK", (long) S_RDLOCK, 0, 0, 0},
+    {0,0,0,0,0,0}
 };
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
-static void *_p_LUA__SessionTo_p_CoreSession(void *x, int *newmemory)
-{
-	return (void *) ((CoreSession *) ((LUA::Session *) x));
+static void *_p_LUA__SessionTo_p_CoreSession(void *x, int *newmemory) {
+    return (void *)((CoreSession *)  ((LUA::Session *) x));
 }
-static swig_type_info _swigt__p_API = { "_p_API", "API *", 0, 0, (void *) &_wrap_class_API, 0 };
-static swig_type_info _swigt__p_CoreSession = { "_p_CoreSession", "CoreSession *", 0, 0, (void *) &_wrap_class_CoreSession, 0 };
-static swig_type_info _swigt__p_Event = { "_p_Event", "Event *", 0, 0, (void *) &_wrap_class_Event, 0 };
-static swig_type_info _swigt__p_IVRMenu = { "_p_IVRMenu", "IVRMenu *", 0, 0, (void *) &_wrap_class_IVRMenu, 0 };
-static swig_type_info _swigt__p_LUA__Session = { "_p_LUA__Session", "LUA::Session *", 0, 0, (void *) &_wrap_class_LUA_Session, 0 };
-static swig_type_info _swigt__p_Stream = { "_p_Stream", "Stream *", 0, 0, (void *) &_wrap_class_Stream, 0 };
-static swig_type_info _swigt__p_input_callback_state =
-	{ "_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void *) &_wrap_class_input_callback_state_t, 0 };
-static swig_type_info _swigt__p_lua_State = { "_p_lua_State", "lua_State *", 0, 0, (void *) 0, 0 };
-static swig_type_info _swigt__p_session_flag_t = { "_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void *) 0, 0 };
-static swig_type_info _swigt__p_switch_channel_state_t = { "_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void *) 0, 0 };
-static swig_type_info _swigt__p_switch_channel_t = { "_p_switch_channel_t", "switch_channel_t *", 0, 0, (void *) 0, 0 };
-static swig_type_info _swigt__p_switch_core_session_t = { "_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void *) 0, 0 };
-static swig_type_info _swigt__p_switch_event_t = { "_p_switch_event_t", "switch_event_t *", 0, 0, (void *) 0, 0 };
-static swig_type_info _swigt__p_switch_input_args_t = { "_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void *) 0, 0 };
-static swig_type_info _swigt__p_switch_input_type_t = { "_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void *) 0, 0 };
-static swig_type_info _swigt__p_switch_priority_t = { "_p_switch_priority_t", "switch_priority_t *", 0, 0, (void *) 0, 0 };
-static swig_type_info _swigt__p_switch_status_t = { "_p_switch_status_t", "switch_status_t *", 0, 0, (void *) 0, 0 };
-static swig_type_info _swigt__p_switch_stream_handle_t = { "_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void *) 0, 0 };
-static swig_type_info _swigt__p_void = { "_p_void", "void *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)&_wrap_class_API, 0};
+static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)&_wrap_class_CoreSession, 0};
+static swig_type_info _swigt__p_DTMF = {"_p_DTMF", "DTMF *", 0, 0, (void*)&_wrap_class_DTMF, 0};
+static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)&_wrap_class_Event, 0};
+static swig_type_info _swigt__p_EventConsumer = {"_p_EventConsumer", "EventConsumer *", 0, 0, (void*)&_wrap_class_EventConsumer, 0};
+static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)&_wrap_class_IVRMenu, 0};
+static swig_type_info _swigt__p_LUA__Session = {"_p_LUA__Session", "LUA::Session *", 0, 0, (void*)&_wrap_class_LUA_Session, 0};
+static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)&_wrap_class_Stream, 0};
+static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0};
+static swig_type_info _swigt__p_lua_State = {"_p_lua_State", "lua_State *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_event_node_t = {"_p_switch_event_node_t", "switch_event_node_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_event_types_t = {"_p_switch_event_types_t", "switch_event_types_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_queue_t = {"_p_switch_queue_t", "switch_queue_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
 
 static swig_type_info *swig_type_initial[] = {
-	&_swigt__p_API,
-	&_swigt__p_CoreSession,
-	&_swigt__p_Event,
-	&_swigt__p_IVRMenu,
-	&_swigt__p_LUA__Session,
-	&_swigt__p_Stream,
-	&_swigt__p_input_callback_state,
-	&_swigt__p_lua_State,
-	&_swigt__p_session_flag_t,
-	&_swigt__p_switch_channel_state_t,
-	&_swigt__p_switch_channel_t,
-	&_swigt__p_switch_core_session_t,
-	&_swigt__p_switch_event_t,
-	&_swigt__p_switch_input_args_t,
-	&_swigt__p_switch_input_type_t,
-	&_swigt__p_switch_priority_t,
-	&_swigt__p_switch_status_t,
-	&_swigt__p_switch_stream_handle_t,
-	&_swigt__p_void,
+  &_swigt__p_API,
+  &_swigt__p_CoreSession,
+  &_swigt__p_DTMF,
+  &_swigt__p_Event,
+  &_swigt__p_EventConsumer,
+  &_swigt__p_IVRMenu,
+  &_swigt__p_LUA__Session,
+  &_swigt__p_Stream,
+  &_swigt__p_input_callback_state,
+  &_swigt__p_lua_State,
+  &_swigt__p_session_flag_t,
+  &_swigt__p_switch_channel_state_t,
+  &_swigt__p_switch_channel_t,
+  &_swigt__p_switch_core_session_t,
+  &_swigt__p_switch_event_node_t,
+  &_swigt__p_switch_event_t,
+  &_swigt__p_switch_event_types_t,
+  &_swigt__p_switch_input_args_t,
+  &_swigt__p_switch_input_type_t,
+  &_swigt__p_switch_priority_t,
+  &_swigt__p_switch_queue_t,
+  &_swigt__p_switch_status_t,
+  &_swigt__p_switch_stream_handle_t,
+  &_swigt__p_uint32_t,
+  &_swigt__p_void,
 };
 
-static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_CoreSession[] =
-	{ {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_LUA__Session, _p_LUA__SessionTo_p_CoreSession, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_LUA__Session[] = { {&_swigt__p_LUA__Session, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_lua_State[] = { {&_swigt__p_lua_State, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0}, {0, 0, 0, 0} };
-static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_API[] = {  {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_CoreSession[] = {  {&_swigt__p_CoreSession, 0, 0, 0},  {&_swigt__p_LUA__Session, _p_LUA__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_DTMF[] = {  {&_swigt__p_DTMF, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_Event[] = {  {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_EventConsumer[] = {  {&_swigt__p_EventConsumer, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_IVRMenu[] = {  {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_LUA__Session[] = {  {&_swigt__p_LUA__Session, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_Stream[] = {  {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_input_callback_state[] = {  {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_lua_State[] = {  {&_swigt__p_lua_State, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_session_flag_t[] = {  {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_channel_state_t[] = {  {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_channel_t[] = {  {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_core_session_t[] = {  {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_event_node_t[] = {  {&_swigt__p_switch_event_node_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_event_t[] = {  {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_event_types_t[] = {  {&_swigt__p_switch_event_types_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_input_args_t[] = {  {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_input_type_t[] = {  {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_priority_t[] = {  {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_queue_t[] = {  {&_swigt__p_switch_queue_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_status_t[] = {  {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_stream_handle_t[] = {  {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint32_t[] = {  {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
 
 static swig_cast_info *swig_cast_initial[] = {
-	_swigc__p_API,
-	_swigc__p_CoreSession,
-	_swigc__p_Event,
-	_swigc__p_IVRMenu,
-	_swigc__p_LUA__Session,
-	_swigc__p_Stream,
-	_swigc__p_input_callback_state,
-	_swigc__p_lua_State,
-	_swigc__p_session_flag_t,
-	_swigc__p_switch_channel_state_t,
-	_swigc__p_switch_channel_t,
-	_swigc__p_switch_core_session_t,
-	_swigc__p_switch_event_t,
-	_swigc__p_switch_input_args_t,
-	_swigc__p_switch_input_type_t,
-	_swigc__p_switch_priority_t,
-	_swigc__p_switch_status_t,
-	_swigc__p_switch_stream_handle_t,
-	_swigc__p_void,
+  _swigc__p_API,
+  _swigc__p_CoreSession,
+  _swigc__p_DTMF,
+  _swigc__p_Event,
+  _swigc__p_EventConsumer,
+  _swigc__p_IVRMenu,
+  _swigc__p_LUA__Session,
+  _swigc__p_Stream,
+  _swigc__p_input_callback_state,
+  _swigc__p_lua_State,
+  _swigc__p_session_flag_t,
+  _swigc__p_switch_channel_state_t,
+  _swigc__p_switch_channel_t,
+  _swigc__p_switch_core_session_t,
+  _swigc__p_switch_event_node_t,
+  _swigc__p_switch_event_t,
+  _swigc__p_switch_event_types_t,
+  _swigc__p_switch_input_args_t,
+  _swigc__p_switch_input_type_t,
+  _swigc__p_switch_priority_t,
+  _swigc__p_switch_queue_t,
+  _swigc__p_switch_status_t,
+  _swigc__p_switch_stream_handle_t,
+  _swigc__p_uint32_t,
+  _swigc__p_void,
 };
 
 
@@ -6810,163 +7742,161 @@
 #ifdef __cplusplus
 extern "C" {
 #if 0
-}								/* c-mode */
+} /* c-mode */
 #endif
 #endif
+
 #if 0
 #define SWIGRUNTIME_DEBUG
 #endif
-SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
-{
-	size_t i;
-	swig_module_info *module_head, *iter;
-	int found, init;
-
-	clientdata = clientdata;
-
-	/* check to see if the circular list has been setup, if not, set it up */
-	if (swig_module.next == 0) {
-		/* Initialize the swig_module */
-		swig_module.type_initial = swig_type_initial;
-		swig_module.cast_initial = swig_cast_initial;
-		swig_module.next = &swig_module;
-		init = 1;
-	} else {
-		init = 0;
-	}
 
-	/* Try and load any already created modules */
-	module_head = SWIG_GetModule(clientdata);
-	if (!module_head) {
-		/* This is the first module loaded for this interpreter */
-		/* so set the swig module into the interpreter */
-		SWIG_SetModule(clientdata, &swig_module);
-		module_head = &swig_module;
-	} else {
-		/* the interpreter has loaded a SWIG module, but has it loaded this one? */
-		found = 0;
-		iter = module_head;
-		do {
-			if (iter == &swig_module) {
-				found = 1;
-				break;
-			}
-			iter = iter->next;
-		} while (iter != module_head);
-
-		/* if the is found in the list, then all is done and we may leave */
-		if (found)
-			return;
-		/* otherwise we must add out module into the list */
-		swig_module.next = module_head->next;
-		module_head->next = &swig_module;
-	}
 
-	/* When multiple interpeters are used, a module could have already been initialized in
-	   a different interpreter, but not yet have a pointer in this interpreter.
-	   In this case, we do not want to continue adding types... everything should be
-	   set up already */
-	if (init == 0)
-		return;
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+
+  clientdata = clientdata;
+
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+
+  /* When multiple interpeters are used, a module could have already been initialized in
+     a different interpreter, but not yet have a pointer in this interpreter.
+     In this case, we do not want to continue adding types... everything should be
+     set up already */
+  if (init == 0) return;
 
-	/* Now work on filling in swig_module.types */
+  /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
-	printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
 #endif
-	for (i = 0; i < swig_module.size; ++i) {
-		swig_type_info *type = 0;
-		swig_type_info *ret;
-		swig_cast_info *cast;
-
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+  
 #ifdef SWIGRUNTIME_DEBUG
-		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
 #endif
 
-		/* if there is another module already loaded */
-		if (swig_module.next != &swig_module) {
-			type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
-		}
-		if (type) {
-			/* Overwrite clientdata field */
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
 #ifdef SWIGRUNTIME_DEBUG
-			printf("SWIG_InitializeModule: found type %s\n", type->name);
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
 #endif
-			if (swig_module.type_initial[i]->clientdata) {
-				type->clientdata = swig_module.type_initial[i]->clientdata;
+      if (swig_module.type_initial[i]->clientdata) {
+	type->clientdata = swig_module.type_initial[i]->clientdata;
 #ifdef SWIGRUNTIME_DEBUG
-				printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+      printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
 #endif
-			}
-		} else {
-			type = swig_module.type_initial[i];
-		}
-
-		/* Insert casting types */
-		cast = swig_module.cast_initial[i];
-		while (cast->type) {
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
 
-			/* Don't need to add information already in the list */
-			ret = 0;
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+    
+      /* Don't need to add information already in the list */
+      ret = 0;
 #ifdef SWIGRUNTIME_DEBUG
-			printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
 #endif
-			if (swig_module.next != &swig_module) {
-				ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
 #ifdef SWIGRUNTIME_DEBUG
-				if (ret)
-					printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+	if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
 #endif
-			}
-			if (ret) {
-				if (type == swig_module.type_initial[i]) {
+      }
+      if (ret) {
+	if (type == swig_module.type_initial[i]) {
 #ifdef SWIGRUNTIME_DEBUG
-					printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+	  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
 #endif
-					cast->type = ret;
-					ret = 0;
-				} else {
-					/* Check for casting already in the list */
-					swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+	  cast->type = ret;
+	  ret = 0;
+	} else {
+	  /* Check for casting already in the list */
+	  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
 #ifdef SWIGRUNTIME_DEBUG
-					if (ocast)
-						printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+	  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
 #endif
-					if (!ocast)
-						ret = 0;
-				}
-			}
+	  if (!ocast) ret = 0;
+	}
+      }
 
-			if (!ret) {
+      if (!ret) {
 #ifdef SWIGRUNTIME_DEBUG
-				printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+	printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
 #endif
-				if (type->cast) {
-					type->cast->prev = cast;
-					cast->next = type->cast;
-				}
-				type->cast = cast;
-			}
-			cast++;
-		}
-		/* Set entry in modules->types array equal to the type */
-		swig_module.types[i] = type;
-	}
-	swig_module.types[i] = 0;
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
 
 #ifdef SWIGRUNTIME_DEBUG
-	printf("**** SWIG_InitializeModule: Cast List ******\n");
-	for (i = 0; i < swig_module.size; ++i) {
-		int j = 0;
-		swig_cast_info *cast = swig_module.cast_initial[i];
-		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-		while (cast->type) {
-			printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
-			cast++;
-			++j;
-		}
-		printf("---- Total casts: %d\n", j);
-	}
-	printf("**** SWIG_InitializeModule: Cast List ******\n");
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+  printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
 #endif
 }
 
@@ -6975,33 +7905,32 @@
 * of equivalent types.  It is like calling
 * SWIG_TypeClientData(type, clientdata) a second time.
 */
-SWIGRUNTIME void SWIG_PropagateClientData(void)
-{
-	size_t i;
-	swig_cast_info *equiv;
-	static int init_run = 0;
-
-	if (init_run)
-		return;
-	init_run = 1;
-
-	for (i = 0; i < swig_module.size; i++) {
-		if (swig_module.types[i]->clientdata) {
-			equiv = swig_module.types[i]->cast;
-			while (equiv) {
-				if (!equiv->converter) {
-					if (equiv->type && !equiv->type->clientdata)
-						SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
-				}
-				equiv = equiv->next;
-			}
-		}
-	}
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+
+  if (init_run) return;
+  init_run = 1;
+
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+            SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
 }
 
 #ifdef __cplusplus
 #if 0
-{								/* c-mode */
+{ /* c-mode */
 #endif
 }
 #endif
@@ -7009,8 +7938,8 @@
 
 
 /* Forward declaration of where the user's %init{} gets inserted */
-void SWIG_init_user(lua_State * L);
-
+void SWIG_init_user(lua_State* L );
+    
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -7018,58 +7947,61 @@
   added at the very end of the code
   the function is always called SWIG_init, but an eariler #define will rename it
 */
-	SWIGEXPORT int SWIG_init(lua_State * L) {
-		int i;
-		/* start with global table */
-		    lua_pushvalue(L, LUA_GLOBALSINDEX);
-		/* SWIG's internal initalisation */
-		    SWIG_InitializeModule((void *) L);
-		    SWIG_PropagateClientData();
-		/* add a global fn */
-		    SWIG_Lua_add_function(L, "swig_type", SWIG_Lua_type);
-		    SWIG_Lua_add_function(L, "swig_equals", SWIG_Lua_equal);
-		/* begin the module (its a table with the same name as the module) */
-		    SWIG_Lua_module_begin(L, SWIG_name);
-		/* add commands/functions */
-		for (i = 0; swig_commands[i].name; i++) {
-			SWIG_Lua_module_add_function(L, swig_commands[i].name, swig_commands[i].func);
-		}
-		/* add variables */ for (i = 0; swig_variables[i].name; i++) {
-			SWIG_Lua_module_add_variable(L, swig_variables[i].name, swig_variables[i].get, swig_variables[i].set);
-		}
-		/* set up base class pointers (the hierachy) */
-		for (i = 0; swig_types[i]; i++) {
-			if (swig_types[i]->clientdata) {
-				SWIG_Lua_init_base_class(L, (swig_lua_class *) (swig_types[i]->clientdata));
-			}
-		}
-		/* additional registration structs & classes in lua */
-		for (i = 0; swig_types[i]; i++) {
-			if (swig_types[i]->clientdata) {
-				SWIG_Lua_class_register(L, (swig_lua_class *) (swig_types[i]->clientdata));
-			}
-		}
-		/* constants */
-		SWIG_Lua_InstallConstants(L, swig_constants);
-		/* invoke user-specific initialization */
-		SWIG_init_user(L);
-		/* end module */
-		lua_pop(L, 1);			/* tidy stack (remove module table) */
-		lua_pop(L, 1);			/* tidy stack (remove global table) */
-		return 1;
-	}
+SWIGEXPORT int SWIG_init(lua_State* L)
+{
+  int i;
+  /* start with global table */
+  lua_pushvalue(L,LUA_GLOBALSINDEX);
+  /* SWIG's internal initalisation */
+  SWIG_InitializeModule((void*)L);
+  SWIG_PropagateClientData();
+  /* add a global fn */
+  SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
+  SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
+  /* begin the module (its a table with the same name as the module) */
+  SWIG_Lua_module_begin(L,SWIG_name);
+  /* add commands/functions */
+  for (i = 0; swig_commands[i].name; i++){
+    SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
+  }
+  /* add variables */
+  for (i = 0; swig_variables[i].name; i++){
+    SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
+  }
+  /* set up base class pointers (the hierachy) */
+  for (i = 0; swig_types[i]; i++){
+    if (swig_types[i]->clientdata){
+      SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
+    }
+  }
+  /* additional registration structs & classes in lua */
+  for (i = 0; swig_types[i]; i++){
+    if (swig_types[i]->clientdata){
+      SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
+    }
+  }
+  /* constants */
+  SWIG_Lua_InstallConstants(L,swig_constants);
+  /* invoke user-specific initialization */
+  SWIG_init_user(L);
+  /* end module */
+  lua_pop(L,1);  /* tidy stack (remove module table)*/
+  lua_pop(L,1);  /* tidy stack (remove global table)*/
+  return 1;
+}
 
 #ifdef __cplusplus
 }
 #endif
 
 
-const char *SWIG_LUACODE = "";
+const char* SWIG_LUACODE=
+  "";
 
-void SWIG_init_user(lua_State * L)
+void SWIG_init_user(lua_State* L)
 {
-	/* exec Lua code if applicable */
-	SWIG_Lua_dostring(L, SWIG_LUACODE);
+  /* exec Lua code if applicable */
+  SWIG_Lua_dostring(L,SWIG_LUACODE);
 }
 
 #include "mod_lua_extra.c"

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch.i
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch.i	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch.i	Mon Aug  4 21:29:58 2008
@@ -11,6 +11,35 @@
 %typemap(csclassmodifiers) Event "public partial class"
 %typemap(csclassmodifiers) Stream "public partial class"
 
+// Allow bitwise compare on flag fields
+%typemap(csclassmodifiers) session_flag_t "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_application_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_asr_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_bind_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_caller_profile_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_channel_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_codec_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_core_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_core_session_message_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_directory_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_eavesdrop_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_file_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_frame_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_io_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_media_bug_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_media_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_originate_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_port_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_rtp_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_scheduler_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_speech_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_timer_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_unicast_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_vad_flag_enum_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_xml_flag_t  "[System.Flags] public enum"
+%typemap(csclassmodifiers) switch_xml_section_enum_t  "[System.Flags] public enum"
+
+
 // Some things we dont want exposed to managed users directly, since 
 // we're gonna handle them with our own internalcall methods
 %ignore dtmfDelegateHandle;
@@ -23,6 +52,7 @@
 %ignore setDTMFCallback;
 
 // Rename some things to make them more .NET-like
+//%csmethodmodifiers CoreSession::hangup "internal";
 %rename (Answer) CoreSession::answer;
 %rename (Hangup) CoreSession::hangup;
 %rename (Ready) CoreSession::ready;
@@ -44,6 +74,10 @@
 %rename (GetUuid) CoreSession::get_uuid;
 %rename (HookState) CoreSession::hook_state;
 %rename (InternalSession) CoreSession::session;
+%rename (Speak) CoreSession::speak;
+%rename (SetTtsParameters) CoreSession::set_tts_parms;
+%rename (SetAutoHangup) CoreSession::setAutoHangup;
+
 
 %rename (Serialize) Event::serialize;
 %rename (SetPriority) Event::setPriority;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.cpp	Mon Aug  4 21:29:58 2008
@@ -38,71 +38,109 @@
 #include <mono/metadata/threads.h>
 #include <mono/metadata/metadata.h>
 #include "freeswitch_mono.h"
-
MonoSession::MonoSession():CoreSession() 
-{
-
} 

MonoSession::MonoSession(char *uuid):CoreSession(uuid) 
-{
-
} 

MonoSession::MonoSession(switch_core_session_t *session):CoreSession(session) 
-{
-
} 

MonoSession::~MonoSession() 
-{
-	
mono_thread_attach(globals.domain);
-	
if (dtmfDelegateHandle)
-		mono_gchandle_free(dtmfDelegateHandle);
-	
if (hangupDelegateHandle)
-		mono_gchandle_free(hangupDelegateHandle);
-
}
-
-

bool MonoSession::begin_allow_threads() 
-{
-	
return true;
-
}
-
-

bool MonoSession::end_allow_threads() 
-{
-	
return true;
-
}
-

void MonoSession::check_hangup_hook() 
-{
-	
mono_thread_attach(globals.domain);
-	
if (!hangupDelegateHandle) {
-		
return;
-	
}
-	
MonoObject * hangupDelegate = mono_gchandle_get_target(hangupDelegateHandle);
-	
if (!hangupDelegate) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegateHandle didn't get an object.");
-		
return;
-	
}
-	
MonoObject * ex = NULL;
-	
mono_runtime_delegate_invoke(hangupDelegate, NULL, &ex);
-	
if (ex) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegate threw an exception.");
-	
}
-
}
-

switch_status_t MonoSession::run_dtmf_callback(void *input, switch_input_type_t itype) 
-{
-	
mono_thread_attach(globals.domain);
-	
if (!dtmfDelegateHandle) {
-		
return SWITCH_STATUS_SUCCESS;
-	
}
-	
MonoObject * dtmfDelegate = mono_gchandle_get_target(dtmfDelegateHandle);
-	
if (!dtmfDelegate) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegateHandle didn't get an object.");
-		
return SWITCH_STATUS_SUCCESS;
-	
}
-	
void *args[2];
-	
args[0] = &input;
-	
args[1] = &itype;
-	
MonoObject * ex = NULL;
-	
MonoObject * res = mono_runtime_delegate_invoke(dtmfDelegate, args, &ex);
-	
if (ex) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegate threw an exception.");
-		
return SWITCH_STATUS_FALSE;
-	
}
-	
char *resPtr = mono_string_to_utf8((MonoString *) res);
-	
switch_status_t status = process_callback_result(resPtr);
-	

g_free(resPtr);
-	
return status;
-
}
-
+
+MonoSession::MonoSession():CoreSession() 
+{
+
+} 
+
+MonoSession::MonoSession(char *uuid):CoreSession(uuid) 
+{
+
+} 
+
+MonoSession::MonoSession(switch_core_session_t *session):CoreSession(session) 
+{
+
+} 
+
+MonoSession::~MonoSession() 
+{
+	mono_thread_attach(globals.domain);
+		
+	if (dtmfDelegateHandle) {
+		mono_gchandle_free(dtmfDelegateHandle);
+	}
+		
+	if (hangupDelegateHandle) {
+		mono_gchandle_free(hangupDelegateHandle);
+	}
+
+	// Do auto-hangup ourselves because CoreSession can't call check_hangup_hook 
+	// after MonoSession destruction (cause at point it's pure virtual)
+	if (session) {
+		channel = switch_core_session_get_channel(session);
+		if (switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
+			switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+			setAutoHangup(0);
+		}
+		// Don't let any callbacks use this CoreSession anymore
+		switch_channel_set_private(channel, "CoreSession", NULL);
+	}
+}
+
+
+
+bool MonoSession::begin_allow_threads() 
+{
+	return true;
+}
+
+
+
+bool MonoSession::end_allow_threads() 
+{
+	return true;
+}
+
+
+void MonoSession::check_hangup_hook() 
+{
+	mono_thread_attach(globals.domain);
+	if (!hangupDelegateHandle) {
+		return;
+	}
+		
+	MonoObject * hangupDelegate = mono_gchandle_get_target(hangupDelegateHandle);
+	if (!hangupDelegate) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegateHandle didn't get an object.");
+		return;
+	}
+		
+	MonoObject * ex = NULL;
+	mono_runtime_delegate_invoke(hangupDelegate, NULL, &ex);
+	if (ex) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegate threw an exception.");
+	}
+}
+
+
+switch_status_t MonoSession::run_dtmf_callback(void *input, switch_input_type_t itype) 
+{
+	mono_thread_attach(globals.domain);
+	if (!dtmfDelegateHandle) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+	MonoObject * dtmfDelegate = mono_gchandle_get_target(dtmfDelegateHandle);
+	if (!dtmfDelegate) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegateHandle didn't get an object.");
+		return SWITCH_STATUS_SUCCESS;
+	}
+	
+	void *args[2];
+	args[0] = &input;
+	args[1] = &itype;
+	MonoObject * ex = NULL;
+	MonoObject * res = mono_runtime_delegate_invoke(dtmfDelegate, args, &ex);
+	if (ex) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegate threw an exception.");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	char *resPtr = mono_string_to_utf8((MonoString *) res);
+	switch_status_t status = process_callback_result(resPtr);
+	g_free(resPtr);
+	return status;
+}
+
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.h	Mon Aug  4 21:29:58 2008
@@ -64,7 +64,7 @@
 	MonoSession();
 	MonoSession(char *uuid);
 	MonoSession(switch_core_session_t *session);
-	~MonoSession();        
+	virtual ~MonoSession();        
 
 	virtual bool begin_allow_threads();
 	virtual bool end_allow_threads();

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_wrap.cxx
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_wrap.cxx	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_wrap.cxx	Mon Aug  4 21:29:58 2008
@@ -927,6 +927,17 @@
 }
 
 
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "execute_on_ring";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
 SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get() {
   char * jresult ;
   char *result = 0 ;
@@ -4052,7 +4063,7 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_flags_set(void * jarg1, int jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_flags_set(void * jarg1, unsigned long jarg2) {
   switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
   switch_core_session_message_flag_t arg2 ;
   
@@ -4063,14 +4074,14 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message_flags_get(void * jarg1) {
-  int jresult ;
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_message_flags_get(void * jarg1) {
+  unsigned long jresult ;
   switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
   switch_core_session_message_flag_t result;
   
   arg1 = (switch_core_session_message *)jarg1; 
   result = (switch_core_session_message_flag_t) ((arg1)->flags);
-  jresult = result; 
+  jresult = (unsigned long)result; 
   return jresult;
 }
 
@@ -4231,7 +4242,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_add(void * jarg1, void * jarg2, void * jarg3, void * jarg4, int jarg5, void * jarg6) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_add(void * jarg1, void * jarg2, void * jarg3, void * jarg4, unsigned long jarg5, void * jarg6) {
   int jresult ;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   switch_media_bug_callback_t arg2 = (switch_media_bug_callback_t) 0 ;
@@ -4393,7 +4404,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_port_allocator_new(unsigned short jarg1, unsigned short jarg2, int jarg3, void * jarg4) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_port_allocator_new(unsigned short jarg1, unsigned short jarg2, unsigned long jarg3, void * jarg4) {
   int jresult ;
   switch_port_t arg1 ;
   switch_port_t arg2 ;
@@ -4447,7 +4458,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_init(int jarg1, int jarg2, void * jarg3) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_init(unsigned long jarg1, int jarg2, void * jarg3) {
   int jresult ;
   switch_core_flag_t arg1 ;
   switch_bool_t arg2 ;
@@ -4463,7 +4474,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_init_and_modload(int jarg1, int jarg2, void * jarg3) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_init_and_modload(unsigned long jarg1, int jarg2, void * jarg3) {
   int jresult ;
   switch_core_flag_t arg1 ;
   switch_bool_t arg2 ;
@@ -5259,7 +5270,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_outgoing_channel(void * jarg1, void * jarg2, char * jarg3, void * jarg4, void * jarg5, void * jarg6, int jarg7) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_outgoing_channel(void * jarg1, void * jarg2, char * jarg3, void * jarg4, void * jarg5, void * jarg6, unsigned long jarg7) {
   int jresult ;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   switch_event_t *arg2 = (switch_event_t *) 0 ;
@@ -5407,7 +5418,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_frame(void * jarg1, void * jarg2, int jarg3, int jarg4) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
   int jresult ;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   switch_frame_t **arg2 = (switch_frame_t **) 0 ;
@@ -5425,7 +5436,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_video_frame(void * jarg1, void * jarg2, int jarg3, int jarg4) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_video_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
   int jresult ;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   switch_frame_t **arg2 = (switch_frame_t **) 0 ;
@@ -5443,7 +5454,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_write_video_frame(void * jarg1, void * jarg2, int jarg3, int jarg4) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_write_video_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
   int jresult ;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   switch_frame_t *arg2 = (switch_frame_t *) 0 ;
@@ -5471,7 +5482,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_write_frame(void * jarg1, void * jarg2, int jarg3, int jarg4) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_write_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
   int jresult ;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   switch_frame_t *arg2 = (switch_frame_t *) 0 ;
@@ -6542,12 +6553,12 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_flags() {
-  int jresult ;
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_flags() {
+  unsigned long jresult ;
   switch_core_flag_t result;
   
   result = (switch_core_flag_t)switch_core_flags();
-  jresult = result; 
+  jresult = (unsigned long)result; 
   return jresult;
 }
 
@@ -8118,7 +8129,7 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_flags_set(void * jarg1, int jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_flags_set(void * jarg1, unsigned long jarg2) {
   switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
   switch_caller_profile_flag_t arg2 ;
   
@@ -8129,14 +8140,14 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_caller_profile_flags_get(void * jarg1) {
-  int jresult ;
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_caller_profile_flags_get(void * jarg1) {
+  unsigned long jresult ;
   switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
   switch_caller_profile_flag_t result;
   
   arg1 = (switch_caller_profile *)jarg1; 
   result = (switch_caller_profile_flag_t) ((arg1)->flags);
-  jresult = result; 
+  jresult = (unsigned long)result; 
   return jresult;
 }
 
@@ -9069,7 +9080,7 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_flags_set(void * jarg1, int jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_flags_set(void * jarg1, unsigned long jarg2) {
   switch_frame *arg1 = (switch_frame *) 0 ;
   switch_frame_flag_t arg2 ;
   
@@ -9080,14 +9091,14 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_flags_get(void * jarg1) {
-  int jresult ;
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_flags_get(void * jarg1) {
+  unsigned long jresult ;
   switch_frame *arg1 = (switch_frame *) 0 ;
   switch_frame_flag_t result;
   
   arg1 = (switch_frame *)jarg1; 
   result = (switch_frame_flag_t) ((arg1)->flags);
-  jresult = result; 
+  jresult = (unsigned long)result; 
   return jresult;
 }
 
@@ -15203,7 +15214,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_wait_for_flag(void * jarg1, int jarg2, int jarg3, unsigned long jarg4) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_wait_for_flag(void * jarg1, unsigned long jarg2, int jarg3, unsigned long jarg4) {
   int jresult ;
   switch_channel_t *arg1 = (switch_channel_t *) 0 ;
   switch_channel_flag_t arg2 ;
@@ -15541,7 +15552,7 @@
 }
 
 
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_flag(void * jarg1, int jarg2) {
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_flag(void * jarg1, unsigned long jarg2) {
   unsigned long jresult ;
   switch_channel_t *arg1 = (switch_channel_t *) 0 ;
   switch_channel_flag_t arg2 ;
@@ -15555,7 +15566,7 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_flag(void * jarg1, int jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_flag(void * jarg1, unsigned long jarg2) {
   switch_channel_t *arg1 = (switch_channel_t *) 0 ;
   switch_channel_flag_t arg2 ;
   
@@ -15565,7 +15576,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_flag_partner(void * jarg1, int jarg2) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_flag_partner(void * jarg1, unsigned long jarg2) {
   int jresult ;
   switch_channel_t *arg1 = (switch_channel_t *) 0 ;
   switch_channel_flag_t arg2 ;
@@ -15579,7 +15590,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_clear_flag_partner(void * jarg1, int jarg2) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_clear_flag_partner(void * jarg1, unsigned long jarg2) {
   int jresult ;
   switch_channel_t *arg1 = (switch_channel_t *) 0 ;
   switch_channel_flag_t arg2 ;
@@ -15593,7 +15604,7 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_state_flag(void * jarg1, int jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_state_flag(void * jarg1, unsigned long jarg2) {
   switch_channel_t *arg1 = (switch_channel_t *) 0 ;
   switch_channel_flag_t arg2 ;
   
@@ -15603,7 +15614,7 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_flag(void * jarg1, int jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_flag(void * jarg1, unsigned long jarg2) {
   switch_channel_t *arg1 = (switch_channel_t *) 0 ;
   switch_channel_flag_t arg2 ;
   
@@ -18357,7 +18368,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_session(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_session(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4) {
   int jresult ;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -18659,7 +18670,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_originate(void * jarg1, void * jarg2, void * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, char * jarg7, char * jarg8, void * jarg9, int jarg10) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_originate(void * jarg1, void * jarg2, void * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, char * jarg7, char * jarg8, void * jarg9, unsigned long jarg10) {
   int jresult ;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
@@ -18805,7 +18816,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_media(char * jarg1, int jarg2) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_media(char * jarg1, unsigned long jarg2) {
   int jresult ;
   char *arg1 = (char *) 0 ;
   switch_media_flag_t arg2 ;
@@ -18819,7 +18830,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_nomedia(char * jarg1, int jarg2) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_nomedia(char * jarg1, unsigned long jarg2) {
   int jresult ;
   char *arg1 = (char *) 0 ;
   switch_media_flag_t arg2 ;
@@ -18889,7 +18900,7 @@
 }
 
 
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_ivr_schedule_broadcast(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_ivr_schedule_broadcast(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4) {
   unsigned long jresult ;
   time_t arg1 ;
   char *arg2 = (char *) 0 ;
@@ -18913,7 +18924,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_broadcast(char * jarg1, char * jarg2, int jarg3) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_broadcast(char * jarg1, char * jarg2, unsigned long jarg3) {
   int jresult ;
   char *arg1 = (char *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -19357,7 +19368,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_bind_dtmf_meta_session(void * jarg1, unsigned long jarg2, int jarg3, char * jarg4) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_bind_dtmf_meta_session(void * jarg1, unsigned long jarg2, unsigned long jarg3, char * jarg4) {
   int jresult ;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   uint32_t arg2 ;
@@ -19746,7 +19757,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_create(void * jarg1, unsigned char jarg2, unsigned long jarg3, unsigned long jarg4, int jarg5, char * jarg6, void * jarg7, void * jarg8) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_create(void * jarg1, unsigned char jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6, void * jarg7, void * jarg8) {
   int jresult ;
   switch_rtp_t **arg1 = (switch_rtp_t **) 0 ;
   switch_payload_t arg2 ;
@@ -19772,7 +19783,7 @@
 }
 
 
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_new(char * jarg1, unsigned short jarg2, char * jarg3, unsigned short jarg4, unsigned char jarg5, unsigned long jarg6, unsigned long jarg7, int jarg8, char * jarg9, void * jarg10, void * jarg11) {
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_new(char * jarg1, unsigned short jarg2, char * jarg3, unsigned short jarg4, unsigned char jarg5, unsigned long jarg6, unsigned long jarg7, unsigned long jarg8, char * jarg9, void * jarg10, void * jarg11) {
   void * jresult ;
   char *arg1 = (char *) 0 ;
   switch_port_t arg2 ;
@@ -19916,7 +19927,7 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_flag(void * jarg1, int jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_flag(void * jarg1, unsigned long jarg2) {
   switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
   switch_rtp_flag_t arg2 ;
   
@@ -19926,7 +19937,7 @@
 }
 
 
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_test_flag(void * jarg1, int jarg2) {
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_test_flag(void * jarg1, unsigned long jarg2) {
   unsigned long jresult ;
   switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
   switch_rtp_flag_t arg2 ;
@@ -19940,7 +19951,7 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_clear_flag(void * jarg1, int jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_clear_flag(void * jarg1, unsigned long jarg2) {
   switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
   switch_rtp_flag_t arg2 ;
   
@@ -20016,7 +20027,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_read(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5, int jarg6) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_read(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5, unsigned long jarg6) {
   int jresult ;
   switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
   void *arg2 = (void *) 0 ;
@@ -20092,7 +20103,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_zerocopy_read(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5, int jarg6) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_zerocopy_read(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5, unsigned long jarg6) {
   int jresult ;
   switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
   void **arg2 = (void **) 0 ;
@@ -20114,7 +20125,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_zerocopy_read_frame(void * jarg1, void * jarg2, int jarg3) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_zerocopy_read_frame(void * jarg1, void * jarg2, unsigned long jarg3) {
   int jresult ;
   switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
   switch_frame_t *arg2 = (switch_frame_t *) 0 ;
@@ -20130,7 +20141,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_enable_vad(void * jarg1, void * jarg2, void * jarg3, int jarg4) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_enable_vad(void * jarg1, void * jarg2, void * jarg3, unsigned long jarg4) {
   int jresult ;
   switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
   switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
@@ -21332,7 +21343,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_bind_search_function(void * jarg1, int jarg2, void * jarg3) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_bind_search_function(void * jarg1, unsigned long jarg2, void * jarg3) {
   int jresult ;
   switch_xml_search_function_t arg1 = (switch_xml_search_function_t) 0 ;
   switch_xml_section_t arg2 ;
@@ -21348,14 +21359,14 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_parse_section_string(char * jarg1) {
-  int jresult ;
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_xml_parse_section_string(char * jarg1) {
+  unsigned long jresult ;
   char *arg1 = (char *) 0 ;
   switch_xml_section_t result;
   
   arg1 = (char *)jarg1; 
   result = (switch_xml_section_t)switch_xml_parse_section_string((char const *)arg1);
-  jresult = result; 
+  jresult = (unsigned long)result; 
   return jresult;
 }
 
@@ -22935,7 +22946,7 @@
 }
 
 
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_add_task(void * jarg1, void * jarg2, char * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, int jarg7) {
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_add_task(void * jarg1, void * jarg2, char * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, unsigned long jarg7) {
   unsigned long jresult ;
   time_t arg1 ;
   switch_scheduler_func_t arg2 = (switch_scheduler_func_t) 0 ;
@@ -24128,7 +24139,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_speak(void * jarg1, char * jarg2) {
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Speak(void * jarg1, char * jarg2) {
   int jresult ;
   CoreSession *arg1 = (CoreSession *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -24142,7 +24153,7 @@
 }
 
 
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_set_tts_parms(void * jarg1, char * jarg2, char * jarg3) {
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SetTtsParameters(void * jarg1, char * jarg2, char * jarg3) {
   CoreSession *arg1 = (CoreSession *) 0 ;
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) 0 ;
@@ -24294,7 +24305,7 @@
 }
 
 
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_setAutoHangup(void * jarg1, unsigned int jarg2) {
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_SetAutoHangup(void * jarg1, unsigned int jarg2) {
   int jresult ;
   CoreSession *arg1 = (CoreSession *) 0 ;
   bool arg2 ;
@@ -24320,6 +24331,40 @@
 }
 
 
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_answered(void * jarg1) {
+  unsigned int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (bool)(arg1)->answered();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_mediaReady(void * jarg1) {
+  unsigned int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (bool)(arg1)->mediaReady();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_waitForAnswer(void * jarg1, void * jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (CoreSession *)jarg2; 
+  (arg1)->waitForAnswer(arg2);
+}
+
+
 SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_Execute(void * jarg1, char * jarg2, char * jarg3) {
   CoreSession *arg1 = (CoreSession *) 0 ;
   char *arg2 = (char *) 0 ;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.cpp	Mon Aug  4 21:29:58 2008
@@ -33,7 +33,10 @@
  */  
 	
 #include <switch.h>
-	

SWITCH_BEGIN_EXTERN_C 
 
+	
+
+SWITCH_BEGIN_EXTERN_C 
+ 
 #include "freeswitch_mono.h"
 #include <glib.h>
 #include <mono/jit/jit.h>
@@ -47,272 +50,489 @@
 #define EXPORT __declspec(dllexport)
 #elif
 #define EXPORT 
-#endif	/* 
 */
+#endif	/* 
+ */
 	
 #define MOD_MONO_MANAGED_DLL "mod_mono_managed.dll"
-	
mod_mono_globals globals = {
-0};
-
-

SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load);
-
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown);
-
SWITCH_MODULE_DEFINITION(mod_mono, mod_mono_load, mod_mono_shutdown, NULL);
-

SWITCH_STANDARD_API(monorun_api_function);	/* ExecuteBackground */
-
SWITCH_STANDARD_API(mono_api_function);	/* Execute */
-
SWITCH_STANDARD_APP(mono_app_function);	/* Run */
-


+	
+mod_mono_globals globals = {
+0};
+
+
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load);
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown);
+
+SWITCH_MODULE_DEFINITION(mod_mono, mod_mono_load, mod_mono_shutdown, NULL);
+
+
+SWITCH_STANDARD_API(monorun_api_function);	/* ExecuteBackground */
+
+SWITCH_STANDARD_API(mono_api_function);	/* Execute */
+
+SWITCH_STANDARD_APP(mono_app_function);	/* Run */
+
+
 // Sets up delegates (and anything else needed) on the MonoSession object
 // Called via internalcall
-	SWITCH_MOD_DECLARE(void) InitMonoSession(MonoSession * session, MonoObject * dtmfDelegate, MonoObject * hangupDelegate) 
-{
-	
switch_assert(session);
-	
if (!session)
-		return;
-	
session->setDTMFCallback(NULL, "");
-	
session->setHangupHook(NULL);
-	
session->dtmfDelegateHandle = mono_gchandle_new(dtmfDelegate, FALSE);
-	
session->hangupDelegateHandle = mono_gchandle_new(hangupDelegate, FALSE);
-
}
-

switch_status_t setMonoDirs() 
-{
+SWITCH_MOD_DECLARE(void) InitMonoSession(MonoSession * session, MonoObject * dtmfDelegate, MonoObject * hangupDelegate) 
+{
+	switch_assert(session);
+	if (!session) {
+		return;
+	}
+	session->setDTMFCallback(NULL, "");
+	session->setHangupHook(NULL);
+	session->dtmfDelegateHandle = mono_gchandle_new(dtmfDelegate, FALSE);
+	session->hangupDelegateHandle = mono_gchandle_new(hangupDelegate, FALSE);
+}
+
+
+switch_status_t setMonoDirs() 
+{
 	
 #ifdef WIN32	
 		/* Win32 Mono installs can't figure out their own path
 		   // Guys in #mono say we should just deploy all the libs we need
 		   // I think it's much nicer to let the user deal with installing Mono
 		   // and we'll just look for it in program files. */ 
-		HANDLE hFind;
-	
WIN32_FIND_DATA findData;
-	
char progFilesPath[MAX_PATH];
-	
char findPath[MAX_PATH];
-	
SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, progFilesPath);
-	
switch_snprintf(findPath, MAX_PATH, "%s\\Mono-*", progFilesPath);
-	
hFind = FindFirstFile(findPath, &findData);
-	
if (hFind == INVALID_HANDLE_VALUE) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error looking for Mono in Program Files.\n");
-		
return SWITCH_STATUS_FALSE;
-	
}
-	
while ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) {
-		
if (FindNextFile(hFind, &findData) == 0) {
-			
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find Mono directory in Program Files.\n");
-			
FindClose(hFind);
-			
return SWITCH_STATUS_FALSE;
-		
}
-	
}
+		HANDLE hFind;
+	
+WIN32_FIND_DATA findData;
+	
+char progFilesPath[MAX_PATH];
+	
+char findPath[MAX_PATH];
+	
+SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, progFilesPath);
+	
+switch_snprintf(findPath, MAX_PATH, "%s\\Mono-*", progFilesPath);
+	
+hFind = FindFirstFile(findPath, &findData);
+	
+if (hFind == INVALID_HANDLE_VALUE) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error looking for Mono in Program Files.\n");
+		
+return SWITCH_STATUS_FALSE;
+	
+}
+	
+while ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) {
+		
+if (FindNextFile(hFind, &findData) == 0) {
+			
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find Mono directory in Program Files.\n");
+			
+FindClose(hFind);
+			
+return SWITCH_STATUS_FALSE;
+		
+}
+	
+}
 	
 		/* Got it */ 
-	{
-		
char libPath[MAX_PATH];
-		
char etcPath[MAX_PATH];
-		
switch_snprintf(libPath, MAX_PATH, "%s\\%s\\lib", progFilesPath, findData.cFileName);
-		
switch_snprintf(etcPath, MAX_PATH, "%s\\%s\\etc", progFilesPath, findData.cFileName);
-		
FindClose(hFind);
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Using Mono paths '%s' and '%s'.\n", libPath, etcPath);
-		
mono_set_dirs(libPath, etcPath);
-		
return SWITCH_STATUS_SUCCESS;
-	
}
+	{
+		
+char libPath[MAX_PATH];
+		
+char etcPath[MAX_PATH];
+		
+switch_snprintf(libPath, MAX_PATH, "%s\\%s\\lib", progFilesPath, findData.cFileName);
+		
+switch_snprintf(etcPath, MAX_PATH, "%s\\%s\\etc", progFilesPath, findData.cFileName);
+		
+FindClose(hFind);
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Using Mono paths '%s' and '%s'.\n", libPath, etcPath);
+		
+mono_set_dirs(libPath, etcPath);
+		
+return SWITCH_STATUS_SUCCESS;
+	
+}
 	
 #elif
 		// On other platforms, it should just work if it hasn't been relocated
-		mono_set_dirs(NULL, NULL);
-	
return SWITCH_STATUS_SUCCESS;
+		mono_set_dirs(NULL, NULL);
+	
+return SWITCH_STATUS_SUCCESS;
 	
-#endif	/* 
 */
-}
-

switch_status_t loadModMonoManaged() 
-{
+#endif	/* 
+ */
+}
+
+
+switch_status_t loadModMonoManaged() 
+{
 	
 		/* Find and load mod_mono_managed.exe */ 
-	char filename[256];
-	
switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MONO_MANAGED_DLL);
-	
globals.domain = mono_jit_init(filename);
-	

if (!globals.domain) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_jit_init failed.\n");
-		
return SWITCH_STATUS_FALSE;
-	
}
-	

+	char filename[256];
+	
+switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MONO_MANAGED_DLL);
+	
+globals.domain = mono_jit_init(filename);
+	
+
+if (!globals.domain) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_jit_init failed.\n");
+		
+return SWITCH_STATUS_FALSE;
+	
+}
+	
+
 		/* Open the assembly */ 
-		globals.mod_mono_asm = mono_domain_assembly_open(globals.domain, filename);
-	
if (!globals.mod_mono_asm) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_domain_assembly_open failed.\n");
-		
return SWITCH_STATUS_FALSE;
-	
}
-	
return SWITCH_STATUS_SUCCESS;
-
}
-
-

MonoMethod * getMethod(const char *name, MonoClass * klass) 
-{
-	
MonoMethodDesc * desc;
-	
MonoMethod * method;
-	
desc = mono_method_desc_new(name, TRUE);
-	
method = mono_method_desc_search_in_class(desc, klass);
-	
if (!method) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find %s method.\n", name);
-		
return NULL;
-	
}
-	
return method;
-
}
-

switch_status_t findLoader() 
-{
+		globals.mod_mono_asm = mono_domain_assembly_open(globals.domain, filename);
+	
+if (!globals.mod_mono_asm) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_domain_assembly_open failed.\n");
+		
+return SWITCH_STATUS_FALSE;
+	
+}
+	
+return SWITCH_STATUS_SUCCESS;
+
+}
+
+
+
+MonoMethod * getMethod(const char *name, MonoClass * klass) 
+{
+	
+MonoMethodDesc * desc;
+	
+MonoMethod * method;
+	
+desc = mono_method_desc_new(name, TRUE);
+	
+method = mono_method_desc_search_in_class(desc, klass);
+	
+if (!method) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find %s method.\n", name);
+		
+return NULL;
+	
+}
+	
+return method;
+
+}
+
+
+switch_status_t findLoader() 
+{
 	
 		/* Find loader class and methods */ 
-		MonoImage * img;
-	
MonoClass * loaderClass;
-	
img = mono_assembly_get_image(globals.mod_mono_asm);
-	
loaderClass = mono_class_from_name(img, "FreeSWITCH", "Loader");
-	
if (!loaderClass) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find FreeSWITCH.Loader class.\n");
-		
return SWITCH_STATUS_FALSE;
-	
}
-	

globals.loadMethod = getMethod("FreeSWITCH.Loader:Load()", loaderClass);
-	
if (!globals.loadMethod)
-		return SWITCH_STATUS_FALSE;
-	

globals.unloadMethod = getMethod("FreeSWITCH.Loader:Unload()", loaderClass);
-	
if (!globals.unloadMethod)
-		return SWITCH_STATUS_FALSE;
-	

globals.runMethod = getMethod("FreeSWITCH.Loader:Run(string,intptr)", loaderClass);
-	
if (!globals.runMethod)
-		return SWITCH_STATUS_FALSE;
-	

globals.executeMethod = getMethod("FreeSWITCH.Loader:Execute(string,intptr,intptr)", loaderClass);
-	
if (!globals.executeMethod)
-		return SWITCH_STATUS_FALSE;
-	

globals.executeBackgroundMethod = getMethod("FreeSWITCH.Loader:ExecuteBackground(string)", loaderClass);
-	
if (!globals.executeBackgroundMethod)
-		return SWITCH_STATUS_FALSE;
-	

switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found all loader functions.\n");
-	
return SWITCH_STATUS_SUCCESS;
-
}
-
-

SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load) 
-{
+		MonoImage * img;
+	
+MonoClass * loaderClass;
+	
+img = mono_assembly_get_image(globals.mod_mono_asm);
+	
+loaderClass = mono_class_from_name(img, "FreeSWITCH", "Loader");
+	
+if (!loaderClass) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find FreeSWITCH.Loader class.\n");
+		
+return SWITCH_STATUS_FALSE;
+	
+}
+	
+
+globals.loadMethod = getMethod("FreeSWITCH.Loader:Load()", loaderClass);
+	
+if (!globals.loadMethod)
+		return SWITCH_STATUS_FALSE;
+	
+
+globals.unloadMethod = getMethod("FreeSWITCH.Loader:Unload()", loaderClass);
+	
+if (!globals.unloadMethod)
+		return SWITCH_STATUS_FALSE;
+	
+
+globals.runMethod = getMethod("FreeSWITCH.Loader:Run(string,intptr)", loaderClass);
+	
+if (!globals.runMethod)
+		return SWITCH_STATUS_FALSE;
+	
+
+globals.executeMethod = getMethod("FreeSWITCH.Loader:Execute(string,intptr,intptr)", loaderClass);
+	
+if (!globals.executeMethod)
+		return SWITCH_STATUS_FALSE;
+	
+
+globals.executeBackgroundMethod = getMethod("FreeSWITCH.Loader:ExecuteBackground(string)", loaderClass);
+	
+if (!globals.executeBackgroundMethod)
+		return SWITCH_STATUS_FALSE;
+	
+
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found all loader functions.\n");
+	
+return SWITCH_STATUS_SUCCESS;
+
+}
+
+
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load) 
+{
 	
 		/* connect my internal structure to the blank pointer passed to me */ 
-		*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-	
globals.pool = pool;
-	

if (setMonoDirs() != SWITCH_STATUS_SUCCESS) {
-		
return SWITCH_STATUS_FALSE;
-	
}
-	
if (loadModMonoManaged() != SWITCH_STATUS_SUCCESS) {
-		
return SWITCH_STATUS_FALSE;
-	
}
-	
if (findLoader() != SWITCH_STATUS_SUCCESS) {
-		
return SWITCH_STATUS_FALSE;
-	
}
-	

+		*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	
+globals.pool = pool;
+	
+
+if (setMonoDirs() != SWITCH_STATUS_SUCCESS) {
+		
+return SWITCH_STATUS_FALSE;
+	
+}
+	
+if (loadModMonoManaged() != SWITCH_STATUS_SUCCESS) {
+		
+return SWITCH_STATUS_FALSE;
+	
+}
+	
+if (findLoader() != SWITCH_STATUS_SUCCESS) {
+		
+return SWITCH_STATUS_FALSE;
+	
+}
+	
+
 		/* Not sure if this is necesary on the loading thread */ 
-		mono_thread_attach(globals.domain);
-	
mono_add_internal_call("FreeSWITCH.Native.MonoSession::InitMonoSession", InitMonoSession);
-	

+		mono_thread_attach(globals.domain);
+	
+mono_add_internal_call("FreeSWITCH.Native.MonoSession::InitMonoSession", InitMonoSession);
+	
+
 		/* Run loader */ 
-		MonoObject * objResult;
-	
MonoObject * exception = NULL;
-	
objResult = mono_runtime_invoke(globals.loadMethod, NULL, NULL, &exception);
-	
if (exception) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load threw an exception.\n");
-		
mono_print_unhandled_exception(exception);
-		
return SWITCH_STATUS_FALSE;
-	
}
-	
if (*(int *) mono_object_unbox(objResult)) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Load completed successfully.\n");
-	
} else {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load did not return true.\n");
-		
return SWITCH_STATUS_FALSE;
-	
}
-	


+		MonoObject * objResult;
+	
+MonoObject * exception = NULL;
+	
+objResult = mono_runtime_invoke(globals.loadMethod, NULL, NULL, &exception);
+	
+if (exception) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load threw an exception.\n");
+		
+mono_print_unhandled_exception(exception);
+		
+return SWITCH_STATUS_FALSE;
+	
+}
+	
+if (*(int *) mono_object_unbox(objResult)) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Load completed successfully.\n");
+	
+} else {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load did not return true.\n");
+		
+return SWITCH_STATUS_FALSE;
+	
+}
+	
+
+
 		/* We're good to register */ 
-	switch_api_interface_t *api_interface;
-	
switch_application_interface_t *app_interface;
-	

SWITCH_ADD_API(api_interface, "monorun", "Run a module (ExecuteBackground)", monorun_api_function, "<module> [<args>]");
-	
SWITCH_ADD_API(api_interface, "mono", "Run a module as an API function (Execute)", mono_api_function, "<module> [<args>]");
-	
SWITCH_ADD_APP(app_interface, "mono", "Run Mono IVR", "Run a Mono IVR on a channel", mono_app_function, "<modulename> [<args>]", SAF_NONE);
-	

return SWITCH_STATUS_SUCCESS;
-
}
-
-

SWITCH_STANDARD_API(monorun_api_function) 
-{
+	switch_api_interface_t *api_interface;
+	
+switch_application_interface_t *app_interface;
+	
+
+SWITCH_ADD_API(api_interface, "monorun", "Run a module (ExecuteBackground)", monorun_api_function, "<module> [<args>]");
+	
+SWITCH_ADD_API(api_interface, "mono", "Run a module as an API function (Execute)", mono_api_function, "<module> [<args>]");
+	
+SWITCH_ADD_APP(app_interface, "mono", "Run Mono IVR", "Run a Mono IVR on a channel", mono_app_function, "<modulename> [<args>]", SAF_NONE);
+	
+
+return SWITCH_STATUS_SUCCESS;
+
+}
+
+
+
+SWITCH_STANDARD_API(monorun_api_function) 
+{
 	
 		// TODO: Should we be detaching after all this?
-		mono_thread_attach(globals.domain);
-	
if (switch_strlen_zero(cmd)) {
-		
stream->write_function(stream, "-ERR no args specified!\n");
-		
return SWITCH_STATUS_SUCCESS;
-	
}
-	

+		mono_thread_attach(globals.domain);
+	
+if (switch_strlen_zero(cmd)) {
+		
+stream->write_function(stream, "-ERR no args specified!\n");
+		
+return SWITCH_STATUS_SUCCESS;
+	
+}
+	
+
 		// ExecuteBackground(string command)
-	void *args[1];
-	
args[0] = mono_string_new(globals.domain, cmd);
-	
MonoObject * exception = NULL;
-	
MonoObject * objResult = mono_runtime_invoke(globals.executeBackgroundMethod, NULL, args, &exception);
-	
if (exception) {
-		
stream->write_function(stream, "-ERR FreeSWITCH.Loader.ExecuteBackground threw an exception.\n");
-		
mono_print_unhandled_exception(exception);
-		
return SWITCH_STATUS_SUCCESS;
-	
}
-	
if (*(int *) mono_object_unbox(objResult)) {
-		
stream->write_function(stream, "+OK\n");
-	
} else {
-		
stream->write_function(stream, "-ERR ExecuteBackground returned false (unknown module?).\n");
-	
}
-	
return SWITCH_STATUS_SUCCESS;
-
}
-
-

SWITCH_STANDARD_API(mono_api_function) 
-{
-	
mono_thread_attach(globals.domain);
-	
if (switch_strlen_zero(cmd)) {
-		
stream->write_function(stream, "-ERR no args specified!\n");
-		
return SWITCH_STATUS_SUCCESS;
-	
}
-	

+	void *args[1];
+	
+args[0] = mono_string_new(globals.domain, cmd);
+	
+MonoObject * exception = NULL;
+	
+MonoObject * objResult = mono_runtime_invoke(globals.executeBackgroundMethod, NULL, args, &exception);
+	
+if (exception) {
+		
+stream->write_function(stream, "-ERR FreeSWITCH.Loader.ExecuteBackground threw an exception.\n");
+		
+mono_print_unhandled_exception(exception);
+		
+return SWITCH_STATUS_SUCCESS;
+	
+}
+	
+if (*(int *) mono_object_unbox(objResult)) {
+		
+stream->write_function(stream, "+OK\n");
+	
+} else {
+		
+stream->write_function(stream, "-ERR ExecuteBackground returned false (unknown module?).\n");
+	
+}
+	
+return SWITCH_STATUS_SUCCESS;
+
+}
+
+
+
+SWITCH_STANDARD_API(mono_api_function) 
+{
+	
+mono_thread_attach(globals.domain);
+	
+if (switch_strlen_zero(cmd)) {
+		
+stream->write_function(stream, "-ERR no args specified!\n");
+		
+return SWITCH_STATUS_SUCCESS;
+	
+}
+	
+
 		// Method is: Execute(string command, IntPtr streamPtr, IntPtr eventPtr)
-	void *args[3];
-	
args[0] = mono_string_new(globals.domain, cmd);
-	
args[1] = &stream;			// Address of the arguments
-	args[2] = &(stream->param_event);
-	

MonoObject * exception = NULL;
-	
MonoObject * objResult = mono_runtime_invoke(globals.executeMethod, NULL, args, &exception);
-	
if (exception) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute mono %s.\n", cmd);
-		
mono_print_unhandled_exception(exception);
-	
}
-	
if (!(*(int *) mono_object_unbox(objResult))) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module?).\n", cmd);
-	
}
-	
return SWITCH_STATUS_SUCCESS;
-
}
-
-

SWITCH_STANDARD_APP(mono_app_function) 
-{
-	
mono_thread_attach(globals.domain);
-	
if (switch_strlen_zero(data)) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");
-	
}
-	

+	void *args[3];
+	
+args[0] = mono_string_new(globals.domain, cmd);
+	
+args[1] = &stream;			// Address of the arguments
+	args[2] = &(stream->param_event);
+	
+
+MonoObject * exception = NULL;
+	
+MonoObject * objResult = mono_runtime_invoke(globals.executeMethod, NULL, args, &exception);
+	
+if (exception) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute mono %s.\n", cmd);
+		
+mono_print_unhandled_exception(exception);
+	
+}
+	
+if (!(*(int *) mono_object_unbox(objResult))) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module?).\n", cmd);
+	
+}
+	
+return SWITCH_STATUS_SUCCESS;
+
+}
+
+
+
+SWITCH_STANDARD_APP(mono_app_function) 
+{
+	
+mono_thread_attach(globals.domain);
+	
+if (switch_strlen_zero(data)) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");
+	
+}
+	
+
 		// bool Run(string command, IntPtr sessionHandle)
-	void *args[2];
-	
args[0] = mono_string_new(globals.domain, data);
-	
args[1] = &session;
-	

MonoObject * exception = NULL;
-	
MonoObject * objResult = mono_runtime_invoke(globals.runMethod, NULL, args, &exception);
-	
if (exception) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute application mono %s.\n", data);
-		
mono_print_unhandled_exception(exception);
-	
}
-	
if (!(*(int *) mono_object_unbox(objResult))) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application run failed for %s (unknown module?).\n", data);
-	
}
-
} 

SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown) 
-{
-	
mono_thread_attach(globals.domain);
-	
MonoObject * ex;
-	
mono_runtime_invoke(globals.unloadMethod, NULL, NULL, &ex);
-	
if (ex) {
-		
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception occurred in Loader::Unload.\n");
-		
mono_print_unhandled_exception(ex);
-	
}
-	
mono_runtime_set_shutting_down();
-	
mono_runtime_cleanup(globals.domain);
-	
mono_runtime_quit();
-	
return SWITCH_STATUS_SUCCESS;
-
}
-
-

SWITCH_END_EXTERN_C
+	void *args[2];
+	
+args[0] = mono_string_new(globals.domain, data);
+	
+args[1] = &session;
+	
+
+MonoObject * exception = NULL;
+	
+MonoObject * objResult = mono_runtime_invoke(globals.runMethod, NULL, args, &exception);
+	
+if (exception) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute application mono %s.\n", data);
+		
+mono_print_unhandled_exception(exception);
+	
+}
+	
+if (!(*(int *) mono_object_unbox(objResult))) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application run failed for %s (unknown module?).\n", data);
+	
+}
+
+} 
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown) 
+{
+	
+mono_thread_attach(globals.domain);
+	
+MonoObject * ex;
+	
+mono_runtime_invoke(globals.unloadMethod, NULL, NULL, &ex);
+	
+if (ex) {
+		
+switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception occurred in Loader::Unload.\n");
+		
+mono_print_unhandled_exception(ex);
+	
+}
+	
+mono_runtime_set_shutting_down();
+	
+mono_runtime_cleanup(globals.domain);
+	
+mono_runtime_quit();
+	
+return SWITCH_STATUS_SUCCESS;
+
+}
+
+
+
+SWITCH_END_EXTERN_C

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.vcproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.vcproj	Mon Aug  4 21:29:58 2008
@@ -211,6 +211,10 @@
 			RelativePath=".\freeswitch.i"
 			>
 		</File>
+		<File
+			RelativePath=".\switch_platform.i"
+			>
+		</File>
 	</Files>
 	<Globals>
 	</Globals>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/AppFunction.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/AppFunction.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/AppFunction.cs	Mon Aug  4 21:29:58 2008
@@ -43,53 +43,6 @@
 
         protected static void Unload() { }
 
-        void hangupCallback()
-        {
-            Log.WriteLine(LogLevel.Debug, "AppFunction is in hangupCallback.");
-            var f = HangupFunction;
-            if (f != null) f();
-        }
-
-        protected Action HangupFunction { get; set; }
-
-        protected Func<Char, TimeSpan, string> DtmfReceivedFunction { get; set; }
-
-        protected Func<Native.Event, string> EventReceivedFunction { get; set; }
-
-        string inputCallback(IntPtr input, Native.switch_input_type_t inputType)
-        {
-            switch (inputType) {
-                case FreeSWITCH.Native.switch_input_type_t.SWITCH_INPUT_TYPE_DTMF:
-                    using (var dtmf = new Native.switch_dtmf_t(input, false)) {
-                        return dtmfCallback(dtmf);
-                    }
-                case FreeSWITCH.Native.switch_input_type_t.SWITCH_INPUT_TYPE_EVENT:
-                    using (var swevt = new Native.switch_event(input, false)) {
-                        return eventCallback(swevt);
-                    }
-                default: 
-                    return "";
-            }
-        }
-
-        string dtmfCallback(Native.switch_dtmf_t dtmf)
-        {
-            var f = DtmfReceivedFunction;
-            return f == null ?
-                "-ERR No DtmfReceivedFunction set." :
-                f(((char)(byte)dtmf.digit), TimeSpan.FromMilliseconds(dtmf.duration));
-        }
-
-        string eventCallback(Native.switch_event swevt)
-        {
-            using (var evt = new FreeSWITCH.Native.Event(swevt, 0)) {
-                var f = EventReceivedFunction;
-                return f == null ?
-                    "-ERR No EventReceivedFunction set." :
-                    f(evt);
-            }
-        }
-
         protected Native.MonoSession Session { get; private set; }
 
         protected string Arguments { get; private set; }
@@ -103,16 +56,51 @@
             }
         }
 
+        /// <summary>Determines if the thread used for Run will have Abort called on it on hangup. Defaults to false.</summary>
+        protected virtual bool AbortOnHangup { get { return false; } }
+        bool abortable = false;
+        readonly object abortLock = new object();
+        Thread runThread;
+        internal void AbortRun()
+        {
+            if (!AbortOnHangup) return;
+            if (runThread == Thread.CurrentThread) {
+                Log.WriteLine(LogLevel.Warning, "Thread will not be aborted because Hangup was called from the Run thread.");
+                return;
+            }
+            lock (abortLock) {
+                if (abortable) {
+                    Log.WriteLine(LogLevel.Critical, "Aborting run thread.");
+                    runThread.Abort();
+                }
+            }
+        }
+
         protected Guid Uuid { get; private set; }
 
         internal void RunInternal(FreeSWITCH.Native.MonoSession session, string args)
         {
             this.Session = session;
             this.Arguments = args;
-            Session.SetDelegates(this.inputCallback, this.hangupCallback);
+            Session.AppToAbort = this;
             try { this.Uuid = new Guid(Session.GetUuid()); }
             catch { }
-            Run();
+            try {
+                runThread = Thread.CurrentThread;
+                lock (abortLock) abortable = true;
+                Run();
+            }
+            catch (ThreadAbortException) {
+                Log.WriteLine(LogLevel.Critical, "Run thread aborted.");
+                Thread.ResetAbort();
+            }
+            finally {
+                lock (abortLock) { abortable = false; }
+                if (runThread.ThreadState == ThreadState.AbortRequested) {
+                    try { Thread.ResetAbort(); }
+                    catch { }
+                }
+            }
         }
 
         protected abstract void Run();

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Demo.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Demo.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Demo.cs	Mon Aug  4 21:29:58 2008
@@ -42,26 +42,25 @@
     {
         new protected static bool Load()
         {
-            Log.WriteLine(LogLevel.Debug, "Inside AppDemo::Load.");
+            Log.WriteLine(LogLevel.Info, "Inside AppDemo::Load.");
             return true;
         }
 
         new protected static void Unload()
         {
-            Log.WriteLine(LogLevel.Debug, "Inside AppDemo::Unload.");
+            Log.WriteLine(LogLevel.Info, "Inside AppDemo::Unload.");
         }
 
         protected override void Run()
         {
-            HangupFunction = hangupHook;
             Session.Answer();
-            this.DtmfReceivedFunction = (d, t) => {
+            Session.DtmfReceivedFunction = (d, t) => {
                 Log.WriteLine(LogLevel.Info, "Received {0} for {1}.", d, t);
                 return "";
             };
-            Log.WriteLine(LogLevel.Debug, "Inside AppDemo.Run (args '{0}'); HookState is {1}.", Arguments, Session.HookState);
-            Session.CollectDigits(5000);
-            if (!IsAvailable) return; // Hungup
+            Log.WriteLine(LogLevel.Info, "Inside AppDemo.Run (args '{0}'); HookState is {1}. Now will collect digits.", Arguments, Session.HookState);
+            Session.CollectDigits(5000); // Hanging up here will cause an abort and the next line won't be written
+            Log.WriteLine(LogLevel.Info, "AppDemo is finishing its run and will now hang up.");
             Session.Hangup("USER_BUSY");
         }
         
@@ -69,6 +68,8 @@
         {
             Log.WriteLine(LogLevel.Debug, "AppDemo hanging up, UUID: {0}.", this.Uuid);
         }
+
+        protected override bool AbortOnHangup { get { return true; } } 
     }
 
     public class ApiDemo : ApiFunction

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Loader.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Loader.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Loader.cs	Mon Aug  4 21:29:58 2008
@@ -227,6 +227,8 @@
             if (fType == null) return false;
 
             using (var session = new Native.MonoSession(new Native.SWIGTYPE_p_switch_core_session(sessionHandle, false))) {
+                session.Initialize();
+                session.SetAutoHangup(false);
                 try {
                     var f = (AppFunction)Activator.CreateInstance(fType);
                     f.RunInternal(session, args);

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/MonoSession.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/MonoSession.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/MonoSession.cs	Mon Aug  4 21:29:58 2008
@@ -35,7 +35,7 @@
 
 namespace FreeSWITCH.Native
 {
-    //switch_status_t MonoSession::run_dtmf_callback(void *input, switch_input_type_t itype)
+    // switch_status_t MonoSession::run_dtmf_callback(void *input, switch_input_type_t itype)
     // But, process_callback_result is used to turn a string into a switch_status_t
     using DtmfCallback = Func<IntPtr, Native.switch_input_type_t, string>;
     public partial class MonoSession
@@ -44,9 +44,69 @@
         [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
         static extern void InitMonoSession(IntPtr sessionPtr, DtmfCallback dtmfDelegate, Action hangupDelegate);
 
-        internal void SetDelegates(DtmfCallback dtmfCallback, Action hangupHook)
+        /// <summary>Initializes the native MonoSession. Must be called after Originate.</summary>
+        public void Initialize()
         {
-            InitMonoSession(MonoSession.getCPtr(this).Handle, dtmfCallback, hangupHook);
+            InitMonoSession(MonoSession.getCPtr(this).Handle, inputCallback, hangupCallback);
         }
+
+        /// <summary>Function to execute when this session hangs up.</summary>
+        public Action HangupFunction { get; set; }
+
+        /// <summary>Sets the application that should have it's run thread aborted (if enabled) when this session is hungup.</summary>
+        internal AppFunction AppToAbort { get; set; }
+
+        void hangupCallback()
+        {
+            Log.WriteLine(LogLevel.Debug, "AppFunction is in hangupCallback.");
+            try {
+                if (AppToAbort != null) AppToAbort.AbortRun();
+                var f = HangupFunction;
+                if (f != null) f();
+            }
+            catch (Exception ex) {
+                Log.WriteLine(LogLevel.Warning, "Exception in hangupCallback: {0}", ex.ToString());
+                throw;
+            }
+        }
+
+        public Func<Char, TimeSpan, string> DtmfReceivedFunction { get; set; }
+
+        public Func<Native.Event, string> EventReceivedFunction { get; set; }
+
+        string inputCallback(IntPtr input, Native.switch_input_type_t inputType)
+        {
+            switch (inputType) {
+                case FreeSWITCH.Native.switch_input_type_t.SWITCH_INPUT_TYPE_DTMF:
+                    using (var dtmf = new Native.switch_dtmf_t(input, false)) {
+                        return dtmfCallback(dtmf);
+                    }
+                case FreeSWITCH.Native.switch_input_type_t.SWITCH_INPUT_TYPE_EVENT:
+                    using (var swevt = new Native.switch_event(input, false)) {
+                        return eventCallback(swevt);
+                    }
+                default:
+                    return "";
+            }
+        }
+
+        string dtmfCallback(Native.switch_dtmf_t dtmf)
+        {
+            var f = DtmfReceivedFunction;
+            return f == null ?
+                "-ERR No DtmfReceivedFunction set." :
+                f(((char)(byte)dtmf.digit), TimeSpan.FromMilliseconds(dtmf.duration));
+        }
+
+        string eventCallback(Native.switch_event swevt)
+        {
+            using (var evt = new FreeSWITCH.Native.Event(swevt, 0)) {
+                var f = EventReceivedFunction;
+                return f == null ?
+                    "-ERR No EventReceivedFunction set." :
+                    f(evt);
+            }
+        }
+
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/mod_mono_managed.csproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/mod_mono_managed.csproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/mod_mono_managed.csproj	Mon Aug  4 21:29:58 2008
@@ -81,28 +81,28 @@
     <Compile Include="swig\SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_enum_switch_asr_flag_t__switch_status_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_enum_switch_asr_flag_t__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_enum_switch_asr_flag_t__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_flag_t_p_q_const__switch_codec_settings__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_codec__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_enum_switch_originate_flag_t__switch_call_cause_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long__switch_call_cause_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_core_session__switch_status_t.cs" />
@@ -122,11 +122,11 @@
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_scheduler_task__void.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_enum_switch_speech_flag_t__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle_p_enum_switch_speech_flag_t__switch_status_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_enum_switch_speech_flag_t__switch_status_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_enum_switch_speech_flag_t__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t.cs" />
+    <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_speech_handle__void.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t.cs" />
@@ -167,7 +167,6 @@
     <Compile Include="swig\SWIGTYPE_p_short.cs" />
     <Compile Include="swig\SWIGTYPE_p_sqlite3.cs" />
     <Compile Include="swig\SWIGTYPE_p_sqlite3_stmt.cs" />
-    <Compile Include="swig\SWIGTYPE_p_switch_asr_flag_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_buffer.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_call_cause_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_channel.cs" />
@@ -175,7 +174,6 @@
     <Compile Include="swig\SWIGTYPE_p_switch_core_session.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_event_types_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_file_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_switch_frame_flag_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_hash.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_ivr_action_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_ivr_digit_stream.cs" />
@@ -192,7 +190,6 @@
     <Compile Include="swig\SWIGTYPE_p_switch_size_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_sockaddr_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_socket_t.cs" />
-    <Compile Include="swig\SWIGTYPE_p_switch_speech_flag_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_ssize_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_switch_time_t.cs" />
     <Compile Include="swig\SWIGTYPE_p_time_t.cs" />
@@ -203,59 +200,59 @@
     <Compile Include="swig\SWIGTYPE_p_void.cs" />
     <Compile Include="swig\switch_abc_type_t.cs" />
     <Compile Include="swig\switch_api_interface.cs" />
-    <Compile Include="swig\switch_application_flag_t.cs" />
+    <Compile Include="swig\switch_application_flag_enum_t.cs" />
     <Compile Include="swig\switch_application_interface.cs" />
     <Compile Include="swig\switch_app_log.cs" />
-    <Compile Include="swig\switch_asr_flag_t.cs" />
+    <Compile Include="swig\switch_asr_flag_enum_t.cs" />
     <Compile Include="swig\switch_asr_handle.cs" />
     <Compile Include="swig\switch_asr_interface.cs" />
     <Compile Include="swig\switch_audio_col_t.cs" />
     <Compile Include="swig\switch_audio_resampler_t.cs" />
-    <Compile Include="swig\switch_bind_flag_t.cs" />
+    <Compile Include="swig\switch_bind_flag_enum_t.cs" />
     <Compile Include="swig\switch_bitpack_mode_t.cs" />
     <Compile Include="swig\switch_bitpack_t.cs" />
     <Compile Include="swig\switch_bool_t.cs" />
     <Compile Include="swig\switch_caller_application.cs" />
     <Compile Include="swig\switch_caller_extension.cs" />
     <Compile Include="swig\switch_caller_profile.cs" />
-    <Compile Include="swig\switch_caller_profile_flag_t.cs" />
+    <Compile Include="swig\switch_caller_profile_flag_enum_t.cs" />
     <Compile Include="swig\switch_call_cause_t.cs" />
-    <Compile Include="swig\switch_channel_flag_t.cs" />
+    <Compile Include="swig\switch_channel_flag_enum_t.cs" />
     <Compile Include="swig\switch_channel_state_t.cs" />
     <Compile Include="swig\switch_channel_timetable.cs" />
     <Compile Include="swig\switch_chat_interface.cs" />
     <Compile Include="swig\switch_codec.cs" />
-    <Compile Include="swig\switch_codec_flag_t.cs" />
+    <Compile Include="swig\switch_codec_flag_enum_t.cs" />
     <Compile Include="swig\switch_codec_implementation.cs" />
     <Compile Include="swig\switch_codec_interface.cs" />
     <Compile Include="swig\switch_codec_settings.cs" />
     <Compile Include="swig\switch_codec_type_t.cs" />
     <Compile Include="swig\switch_config.cs" />
-    <Compile Include="swig\switch_core_flag_t.cs" />
+    <Compile Include="swig\switch_core_flag_enum_t.cs" />
     <Compile Include="swig\switch_core_session_message.cs" />
-    <Compile Include="swig\switch_core_session_message_flag_t.cs" />
+    <Compile Include="swig\switch_core_session_message_flag_enum_t.cs" />
     <Compile Include="swig\switch_core_session_message_types_t.cs" />
     <Compile Include="swig\switch_core_thread_session.cs" />
     <Compile Include="swig\switch_core_time_duration.cs" />
     <Compile Include="swig\switch_dialplan_interface.cs" />
     <Compile Include="swig\switch_directories.cs" />
-    <Compile Include="swig\switch_directory_flag_t.cs" />
+    <Compile Include="swig\switch_directory_flag_enum_t.cs" />
     <Compile Include="swig\switch_directory_handle.cs" />
     <Compile Include="swig\switch_directory_interface.cs" />
     <Compile Include="swig\switch_dtmf_direction_t.cs" />
     <Compile Include="swig\switch_dtmf_t.cs" />
-    <Compile Include="swig\switch_eavesdrop_flag_t.cs" />
+    <Compile Include="swig\switch_eavesdrop_flag_enum_t.cs" />
     <Compile Include="swig\switch_endpoint_interface.cs" />
     <Compile Include="swig\switch_event.cs" />
     <Compile Include="swig\switch_event_header.cs" />
     <Compile Include="swig\switch_event_node.cs" />
     <Compile Include="swig\switch_event_subclass.cs" />
     <Compile Include="swig\switch_event_types_t.cs" />
-    <Compile Include="swig\switch_file_flag_t.cs" />
+    <Compile Include="swig\switch_file_flag_enum_t.cs" />
     <Compile Include="swig\switch_file_handle.cs" />
     <Compile Include="swig\switch_file_interface.cs" />
     <Compile Include="swig\switch_frame.cs" />
-    <Compile Include="swig\switch_frame_flag_t.cs" />
+    <Compile Include="swig\switch_frame_flag_enum_t.cs" />
     <Compile Include="swig\switch_input_args_t.cs" />
     <Compile Include="swig\switch_input_type_t.cs" />
     <Compile Include="swig\switch_io_event_hooks.cs" />
@@ -271,36 +268,36 @@
     <Compile Include="swig\switch_io_event_hook_video_read_frame.cs" />
     <Compile Include="swig\switch_io_event_hook_video_write_frame.cs" />
     <Compile Include="swig\switch_io_event_hook_write_frame.cs" />
-    <Compile Include="swig\switch_io_flag_t.cs" />
+    <Compile Include="swig\switch_io_flag_enum_t.cs" />
     <Compile Include="swig\switch_io_routines.cs" />
     <Compile Include="swig\switch_io_routine_name_t.cs" />
     <Compile Include="swig\switch_ivr_action_t.cs" />
     <Compile Include="swig\switch_ivr_menu_flags.cs" />
-    <Compile Include="swig\switch_ivr_option_t.cs" />
+    <Compile Include="swig\switch_ivr_option_enum_t.cs" />
     <Compile Include="swig\switch_loadable_module_function_table_t.cs" />
     <Compile Include="swig\switch_log_level_t.cs" />
     <Compile Include="swig\switch_log_node_t.cs" />
     <Compile Include="swig\switch_management_action_t.cs" />
     <Compile Include="swig\switch_management_interface.cs" />
-    <Compile Include="swig\switch_media_bug_flag_t.cs" />
-    <Compile Include="swig\switch_media_flag_t.cs" />
+    <Compile Include="swig\switch_media_bug_flag_enum_t.cs" />
+    <Compile Include="swig\switch_media_flag_enum_t.cs" />
     <Compile Include="swig\switch_module_interface_name_t.cs" />
-    <Compile Include="swig\switch_originate_flag_t.cs" />
-    <Compile Include="swig\switch_port_flag_t.cs" />
+    <Compile Include="swig\switch_originate_flag_enum_t.cs" />
+    <Compile Include="swig\switch_port_flag_enum_t.cs" />
     <Compile Include="swig\switch_priority_t.cs" />
     <Compile Include="swig\switch_rtp_crypto_direction_t.cs" />
     <Compile Include="swig\switch_rtp_crypto_key.cs" />
     <Compile Include="swig\switch_rtp_crypto_key_type_t.cs" />
-    <Compile Include="swig\switch_rtp_flag_t.cs" />
+    <Compile Include="swig\switch_rtp_flag_enum_t.cs" />
     <Compile Include="swig\switch_rtp_hdr_t.cs" />
     <Compile Include="swig\switch_say_interface.cs" />
     <Compile Include="swig\switch_say_method_t.cs" />
     <Compile Include="swig\switch_say_type_t.cs" />
-    <Compile Include="swig\switch_scheduler_flag_t.cs" />
+    <Compile Include="swig\switch_scheduler_flag_enum_t.cs" />
     <Compile Include="swig\switch_scheduler_task.cs" />
     <Compile Include="swig\switch_session_ctl_t.cs" />
     <Compile Include="swig\switch_signal_t.cs" />
-    <Compile Include="swig\switch_speech_flag_t.cs" />
+    <Compile Include="swig\switch_speech_flag_enum_t.cs" />
     <Compile Include="swig\switch_speech_handle.cs" />
     <Compile Include="swig\switch_speech_interface.cs" />
     <Compile Include="swig\switch_stack_t.cs" />
@@ -310,15 +307,15 @@
     <Compile Include="swig\switch_stream_handle.cs" />
     <Compile Include="swig\switch_text_channel_t.cs" />
     <Compile Include="swig\switch_timer.cs" />
-    <Compile Include="swig\switch_timer_flag_t.cs" />
+    <Compile Include="swig\switch_timer_flag_enum_t.cs" />
     <Compile Include="swig\switch_timer_func_name_t.cs" />
     <Compile Include="swig\switch_timer_interface.cs" />
     <Compile Include="swig\switch_unicast_conninfo.cs" />
-    <Compile Include="swig\switch_unicast_flag_t.cs" />
-    <Compile Include="swig\switch_vad_flag_t.cs" />
+    <Compile Include="swig\switch_unicast_flag_enum_t.cs" />
+    <Compile Include="swig\switch_vad_flag_enum_t.cs" />
     <Compile Include="swig\switch_xml.cs" />
     <Compile Include="swig\switch_xml_flag_t.cs" />
-    <Compile Include="swig\switch_xml_section_t.cs" />
+    <Compile Include="swig\switch_xml_section_enum_t.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/CoreSession.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/CoreSession.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/CoreSession.cs	Mon Aug  4 21:29:58 2008
@@ -157,13 +157,13 @@
     return ret;
   }
 
-  public int speak(string text) {
-    int ret = freeswitchPINVOKE.CoreSession_speak(swigCPtr, text);
+  public int Speak(string text) {
+    int ret = freeswitchPINVOKE.CoreSession_Speak(swigCPtr, text);
     return ret;
   }
 
-  public void set_tts_parms(string tts_name, string voice_name) {
-    freeswitchPINVOKE.CoreSession_set_tts_parms(swigCPtr, tts_name, voice_name);
+  public void SetTtsParameters(string tts_name, string voice_name) {
+    freeswitchPINVOKE.CoreSession_SetTtsParameters(swigCPtr, tts_name, voice_name);
   }
 
   public int CollectDigits(int timeout) {
@@ -206,8 +206,8 @@
     return ret;
   }
 
-  public int setAutoHangup(bool val) {
-    int ret = freeswitchPINVOKE.CoreSession_setAutoHangup(swigCPtr, val);
+  public int SetAutoHangup(bool val) {
+    int ret = freeswitchPINVOKE.CoreSession_SetAutoHangup(swigCPtr, val);
     return ret;
   }
 
@@ -216,6 +216,20 @@
     return ret;
   }
 
+  public bool answered() {
+    bool ret = freeswitchPINVOKE.CoreSession_answered(swigCPtr);
+    return ret;
+  }
+
+  public bool mediaReady() {
+    bool ret = freeswitchPINVOKE.CoreSession_mediaReady(swigCPtr);
+    return ret;
+  }
+
+  public void waitForAnswer(CoreSession calling_session) {
+    freeswitchPINVOKE.CoreSession_waitForAnswer(swigCPtr, CoreSession.getCPtr(calling_session));
+  }
+
   public void Execute(string app, string data) {
     freeswitchPINVOKE.CoreSession_Execute(swigCPtr, app, data);
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitch.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitch.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitch.cs	Mon Aug  4 21:29:58 2008
@@ -157,8 +157,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_core_media_bug_add(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t callback, SWIGTYPE_p_void user_data, SWIGTYPE_p_time_t stop_time, switch_media_bug_flag_t flags, SWIGTYPE_p_p_switch_media_bug new_bug) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_add(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data), SWIGTYPE_p_time_t.getCPtr(stop_time), (int)flags, SWIGTYPE_p_p_switch_media_bug.getCPtr(new_bug));
+  public static switch_status_t switch_core_media_bug_add(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t callback, SWIGTYPE_p_void user_data, SWIGTYPE_p_time_t stop_time, uint flags, SWIGTYPE_p_p_switch_media_bug new_bug) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_add(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data), SWIGTYPE_p_time_t.getCPtr(stop_time), flags, SWIGTYPE_p_p_switch_media_bug.getCPtr(new_bug));
     if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
     return ret;
   }
@@ -220,8 +220,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_core_port_allocator_new(ushort start, ushort end, switch_port_flag_t flags, SWIGTYPE_p_p_switch_core_port_allocator new_allocator) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_port_allocator_new(start, end, (int)flags, SWIGTYPE_p_p_switch_core_port_allocator.getCPtr(new_allocator));
+  public static switch_status_t switch_core_port_allocator_new(ushort start, ushort end, uint flags, SWIGTYPE_p_p_switch_core_port_allocator new_allocator) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_port_allocator_new(start, end, flags, SWIGTYPE_p_p_switch_core_port_allocator.getCPtr(new_allocator));
     return ret;
   }
 
@@ -239,13 +239,13 @@
     freeswitchPINVOKE.switch_core_port_allocator_destroy(SWIGTYPE_p_p_switch_core_port_allocator.getCPtr(alloc));
   }
 
-  public static switch_status_t switch_core_init(switch_core_flag_t flags, switch_bool_t console, SWIGTYPE_p_p_char err) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_init((int)flags, (int)console, SWIGTYPE_p_p_char.getCPtr(err));
+  public static switch_status_t switch_core_init(uint flags, switch_bool_t console, SWIGTYPE_p_p_char err) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_init(flags, (int)console, SWIGTYPE_p_p_char.getCPtr(err));
     return ret;
   }
 
-  public static switch_status_t switch_core_init_and_modload(switch_core_flag_t flags, switch_bool_t console, SWIGTYPE_p_p_char err) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_init_and_modload((int)flags, (int)console, SWIGTYPE_p_p_char.getCPtr(err));
+  public static switch_status_t switch_core_init_and_modload(uint flags, switch_bool_t console, SWIGTYPE_p_p_char err) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_init_and_modload(flags, (int)console, SWIGTYPE_p_p_char.getCPtr(err));
     return ret;
   }
 
@@ -543,8 +543,8 @@
     freeswitchPINVOKE.switch_core_service_session(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_core_thread_session.getCPtr(thread_session), stream_id);
   }
 
-  public static switch_call_cause_t switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session session, switch_event var_event, string endpoint_name, switch_caller_profile caller_profile, SWIGTYPE_p_p_switch_core_session new_session, SWIGTYPE_p_p_apr_pool_t pool, switch_originate_flag_t flags) {
-    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_event.getCPtr(var_event), endpoint_name, switch_caller_profile.getCPtr(caller_profile), SWIGTYPE_p_p_switch_core_session.getCPtr(new_session), SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), (int)flags);
+  public static switch_call_cause_t switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session session, switch_event var_event, string endpoint_name, switch_caller_profile caller_profile, SWIGTYPE_p_p_switch_core_session new_session, SWIGTYPE_p_p_apr_pool_t pool, uint flags) {
+    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_event.getCPtr(var_event), endpoint_name, switch_caller_profile.getCPtr(caller_profile), SWIGTYPE_p_p_switch_core_session.getCPtr(new_session), SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), flags);
     return ret;
   }
 
@@ -593,18 +593,18 @@
     return ret;
   }
 
-  public static switch_status_t switch_core_session_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_frame frame, switch_io_flag_t flags, int stream_id) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_frame.getCPtr(frame), (int)flags, stream_id);
+  public static switch_status_t switch_core_session_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_frame frame, uint flags, int stream_id) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_frame.getCPtr(frame), flags, stream_id);
     return ret;
   }
 
-  public static switch_status_t switch_core_session_read_video_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_frame frame, switch_io_flag_t flags, int stream_id) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_video_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_frame.getCPtr(frame), (int)flags, stream_id);
+  public static switch_status_t switch_core_session_read_video_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_frame frame, uint flags, int stream_id) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_video_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_frame.getCPtr(frame), flags, stream_id);
     return ret;
   }
 
-  public static switch_status_t switch_core_session_write_video_frame(SWIGTYPE_p_switch_core_session session, switch_frame frame, switch_io_flag_t flags, int stream_id) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_write_video_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_frame.getCPtr(frame), (int)flags, stream_id);
+  public static switch_status_t switch_core_session_write_video_frame(SWIGTYPE_p_switch_core_session session, switch_frame frame, uint flags, int stream_id) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_write_video_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_frame.getCPtr(frame), flags, stream_id);
     return ret;
   }
 
@@ -612,8 +612,8 @@
     freeswitchPINVOKE.switch_core_session_reset(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)flush_dtmf);
   }
 
-  public static switch_status_t switch_core_session_write_frame(SWIGTYPE_p_switch_core_session session, switch_frame frame, switch_io_flag_t flags, int stream_id) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_frame.getCPtr(frame), (int)flags, stream_id);
+  public static switch_status_t switch_core_session_write_frame(SWIGTYPE_p_switch_core_session session, switch_frame frame, uint flags, int stream_id) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_frame.getCPtr(frame), flags, stream_id);
     return ret;
   }
 
@@ -844,13 +844,13 @@
     return ret;
   }
 
-  public static switch_status_t switch_core_speech_open(switch_speech_handle sh, string module_name, string voice_name, uint rate, uint interval, SWIGTYPE_p_switch_speech_flag_t flags, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_open(switch_speech_handle.getCPtr(sh), module_name, voice_name, rate, interval, SWIGTYPE_p_switch_speech_flag_t.getCPtr(flags), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+  public static switch_status_t switch_core_speech_open(switch_speech_handle sh, string module_name, string voice_name, uint rate, uint interval, SWIGTYPE_p_unsigned_long flags, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_open(switch_speech_handle.getCPtr(sh), module_name, voice_name, rate, interval, SWIGTYPE_p_unsigned_long.getCPtr(flags), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
     return ret;
   }
 
-  public static switch_status_t switch_core_speech_feed_tts(switch_speech_handle sh, string text, SWIGTYPE_p_switch_speech_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_feed_tts(switch_speech_handle.getCPtr(sh), text, SWIGTYPE_p_switch_speech_flag_t.getCPtr(flags));
+  public static switch_status_t switch_core_speech_feed_tts(switch_speech_handle sh, string text, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_feed_tts(switch_speech_handle.getCPtr(sh), text, SWIGTYPE_p_unsigned_long.getCPtr(flags));
     return ret;
   }
 
@@ -870,38 +870,38 @@
     freeswitchPINVOKE.switch_core_speech_float_param_tts(switch_speech_handle.getCPtr(sh), param, val);
   }
 
-  public static switch_status_t switch_core_speech_read_tts(switch_speech_handle sh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen, SWIGTYPE_p_unsigned_long rate, SWIGTYPE_p_switch_speech_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_read_tts(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen), SWIGTYPE_p_unsigned_long.getCPtr(rate), SWIGTYPE_p_switch_speech_flag_t.getCPtr(flags));
+  public static switch_status_t switch_core_speech_read_tts(switch_speech_handle sh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen, SWIGTYPE_p_unsigned_long rate, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_read_tts(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen), SWIGTYPE_p_unsigned_long.getCPtr(rate), SWIGTYPE_p_unsigned_long.getCPtr(flags));
     return ret;
   }
 
-  public static switch_status_t switch_core_speech_close(switch_speech_handle sh, SWIGTYPE_p_switch_speech_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_close(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_switch_speech_flag_t.getCPtr(flags));
+  public static switch_status_t switch_core_speech_close(switch_speech_handle sh, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_close(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_unsigned_long.getCPtr(flags));
     return ret;
   }
 
-  public static switch_status_t switch_core_asr_open(switch_asr_handle ah, string module_name, string codec, int rate, string dest, SWIGTYPE_p_switch_asr_flag_t flags, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_open(switch_asr_handle.getCPtr(ah), module_name, codec, rate, dest, SWIGTYPE_p_switch_asr_flag_t.getCPtr(flags), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+  public static switch_status_t switch_core_asr_open(switch_asr_handle ah, string module_name, string codec, int rate, string dest, SWIGTYPE_p_unsigned_long flags, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_open(switch_asr_handle.getCPtr(ah), module_name, codec, rate, dest, SWIGTYPE_p_unsigned_long.getCPtr(flags), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
     return ret;
   }
 
-  public static switch_status_t switch_core_asr_close(switch_asr_handle ah, SWIGTYPE_p_switch_asr_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_close(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_switch_asr_flag_t.getCPtr(flags));
+  public static switch_status_t switch_core_asr_close(switch_asr_handle ah, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_close(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_unsigned_long.getCPtr(flags));
     return ret;
   }
 
-  public static switch_status_t switch_core_asr_feed(switch_asr_handle ah, SWIGTYPE_p_void data, uint len, SWIGTYPE_p_switch_asr_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_feed(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_void.getCPtr(data), len, SWIGTYPE_p_switch_asr_flag_t.getCPtr(flags));
+  public static switch_status_t switch_core_asr_feed(switch_asr_handle ah, SWIGTYPE_p_void data, uint len, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_feed(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_void.getCPtr(data), len, SWIGTYPE_p_unsigned_long.getCPtr(flags));
     return ret;
   }
 
-  public static switch_status_t switch_core_asr_check_results(switch_asr_handle ah, SWIGTYPE_p_switch_asr_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_check_results(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_switch_asr_flag_t.getCPtr(flags));
+  public static switch_status_t switch_core_asr_check_results(switch_asr_handle ah, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_check_results(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_unsigned_long.getCPtr(flags));
     return ret;
   }
 
-  public static switch_status_t switch_core_asr_get_results(switch_asr_handle ah, SWIGTYPE_p_p_char xmlstr, SWIGTYPE_p_switch_asr_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_get_results(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_p_char.getCPtr(xmlstr), SWIGTYPE_p_switch_asr_flag_t.getCPtr(flags));
+  public static switch_status_t switch_core_asr_get_results(switch_asr_handle ah, SWIGTYPE_p_p_char xmlstr, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_get_results(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_p_char.getCPtr(xmlstr), SWIGTYPE_p_unsigned_long.getCPtr(flags));
     return ret;
   }
 
@@ -961,8 +961,8 @@
     return ret;
   }
 
-  public static switch_core_flag_t switch_core_flags() {
-    switch_core_flag_t ret = (switch_core_flag_t)freeswitchPINVOKE.switch_core_flags();
+  public static uint switch_core_flags() {
+    uint ret = freeswitchPINVOKE.switch_core_flags();
     return ret;
   }
 
@@ -1371,8 +1371,8 @@
     freeswitchPINVOKE.switch_channel_wait_for_state(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(other_channel), (int)want_state);
   }
 
-  public static switch_status_t switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint to) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)want_flag, (int)pres, to);
+  public static switch_status_t switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel channel, uint want_flag, switch_bool_t pres, uint to) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), want_flag, (int)pres, to);
     return ret;
   }
 
@@ -1500,31 +1500,31 @@
     return ret;
   }
 
-  public static uint switch_channel_test_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flags) {
-    uint ret = freeswitchPINVOKE.switch_channel_test_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flags);
+  public static uint switch_channel_test_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    uint ret = freeswitchPINVOKE.switch_channel_test_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
     return ret;
   }
 
-  public static void switch_channel_set_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flags) {
-    freeswitchPINVOKE.switch_channel_set_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flags);
+  public static void switch_channel_set_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    freeswitchPINVOKE.switch_channel_set_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
   }
 
-  public static switch_bool_t switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flags) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flags);
+  public static switch_bool_t switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel channel, uint flags) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
     return ret;
   }
 
-  public static switch_bool_t switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flags) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flags);
+  public static switch_bool_t switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel channel, uint flags) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
     return ret;
   }
 
-  public static void switch_channel_set_state_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flags) {
-    freeswitchPINVOKE.switch_channel_set_state_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flags);
+  public static void switch_channel_set_state_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    freeswitchPINVOKE.switch_channel_set_state_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
   }
 
-  public static void switch_channel_clear_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flags) {
-    freeswitchPINVOKE.switch_channel_clear_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flags);
+  public static void switch_channel_clear_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    freeswitchPINVOKE.switch_channel_clear_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
   }
 
   public static switch_status_t switch_channel_perform_answer(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
@@ -1995,8 +1995,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session session, string uuid, string require_group, switch_eavesdrop_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session.getCPtr(session), uuid, require_group, (int)flags);
+  public static switch_status_t switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session session, string uuid, string require_group, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session.getCPtr(session), uuid, require_group, flags);
     return ret;
   }
 
@@ -2084,8 +2084,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_ivr_originate(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session bleg, SWIGTYPE_p_switch_call_cause_t cause, string bridgeto, uint timelimit_sec, switch_state_handler_table table, string cid_name_override, string cid_num_override, switch_caller_profile caller_profile_override, switch_originate_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_originate(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(bleg), SWIGTYPE_p_switch_call_cause_t.getCPtr(cause), bridgeto, timelimit_sec, switch_state_handler_table.getCPtr(table), cid_name_override, cid_num_override, switch_caller_profile.getCPtr(caller_profile_override), (int)flags);
+  public static switch_status_t switch_ivr_originate(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session bleg, SWIGTYPE_p_switch_call_cause_t cause, string bridgeto, uint timelimit_sec, switch_state_handler_table table, string cid_name_override, string cid_num_override, switch_caller_profile caller_profile_override, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_originate(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(bleg), SWIGTYPE_p_switch_call_cause_t.getCPtr(cause), bridgeto, timelimit_sec, switch_state_handler_table.getCPtr(table), cid_name_override, cid_num_override, switch_caller_profile.getCPtr(caller_profile_override), flags);
     return ret;
   }
 
@@ -2121,13 +2121,13 @@
     return ret;
   }
 
-  public static switch_status_t switch_ivr_media(string uuid, switch_media_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_media(uuid, (int)flags);
+  public static switch_status_t switch_ivr_media(string uuid, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_media(uuid, flags);
     return ret;
   }
 
-  public static switch_status_t switch_ivr_nomedia(string uuid, switch_media_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_nomedia(uuid, (int)flags);
+  public static switch_status_t switch_ivr_nomedia(string uuid, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_nomedia(uuid, flags);
     return ret;
   }
 
@@ -2151,14 +2151,14 @@
     return ret;
   }
 
-  public static uint switch_ivr_schedule_broadcast(SWIGTYPE_p_time_t runtime, string uuid, string path, switch_media_flag_t flags) {
-    uint ret = freeswitchPINVOKE.switch_ivr_schedule_broadcast(SWIGTYPE_p_time_t.getCPtr(runtime), uuid, path, (int)flags);
+  public static uint switch_ivr_schedule_broadcast(SWIGTYPE_p_time_t runtime, string uuid, string path, uint flags) {
+    uint ret = freeswitchPINVOKE.switch_ivr_schedule_broadcast(SWIGTYPE_p_time_t.getCPtr(runtime), uuid, path, flags);
     if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
     return ret;
   }
 
-  public static switch_status_t switch_ivr_broadcast(string uuid, string path, switch_media_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_broadcast(uuid, path, (int)flags);
+  public static switch_status_t switch_ivr_broadcast(string uuid, string path, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_broadcast(uuid, path, flags);
     return ret;
   }
 
@@ -2292,8 +2292,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_ivr_bind_dtmf_meta_session(SWIGTYPE_p_switch_core_session session, uint key, switch_bind_flag_t bind_flags, string app) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_bind_dtmf_meta_session(SWIGTYPE_p_switch_core_session.getCPtr(session), key, (int)bind_flags, app);
+  public static switch_status_t switch_ivr_bind_dtmf_meta_session(SWIGTYPE_p_switch_core_session session, uint key, uint bind_flags, string app) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_bind_dtmf_meta_session(SWIGTYPE_p_switch_core_session.getCPtr(session), key, bind_flags, app);
     return ret;
   }
 
@@ -2359,13 +2359,13 @@
     freeswitchPINVOKE.switch_rtp_release_port(ip, port);
   }
 
-  public static switch_status_t switch_rtp_create(SWIGTYPE_p_p_switch_rtp new_rtp_session, byte payload, uint samples_per_interval, uint ms_per_packet, switch_rtp_flag_t flags, string timer_name, SWIGTYPE_p_p_char err, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_create(SWIGTYPE_p_p_switch_rtp.getCPtr(new_rtp_session), payload, samples_per_interval, ms_per_packet, (int)flags, timer_name, SWIGTYPE_p_p_char.getCPtr(err), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+  public static switch_status_t switch_rtp_create(SWIGTYPE_p_p_switch_rtp new_rtp_session, byte payload, uint samples_per_interval, uint ms_per_packet, uint flags, string timer_name, SWIGTYPE_p_p_char err, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_create(SWIGTYPE_p_p_switch_rtp.getCPtr(new_rtp_session), payload, samples_per_interval, ms_per_packet, flags, timer_name, SWIGTYPE_p_p_char.getCPtr(err), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
     return ret;
   }
 
-  public static SWIGTYPE_p_switch_rtp switch_rtp_new(string rx_host, ushort rx_port, string tx_host, ushort tx_port, byte payload, uint samples_per_interval, uint ms_per_packet, switch_rtp_flag_t flags, string timer_name, SWIGTYPE_p_p_char err, SWIGTYPE_p_apr_pool_t pool) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_rtp_new(rx_host, rx_port, tx_host, tx_port, payload, samples_per_interval, ms_per_packet, (int)flags, timer_name, SWIGTYPE_p_p_char.getCPtr(err), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+  public static SWIGTYPE_p_switch_rtp switch_rtp_new(string rx_host, ushort rx_port, string tx_host, ushort tx_port, byte payload, uint samples_per_interval, uint ms_per_packet, uint flags, string timer_name, SWIGTYPE_p_p_char err, SWIGTYPE_p_apr_pool_t pool) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_rtp_new(rx_host, rx_port, tx_host, tx_port, payload, samples_per_interval, ms_per_packet, flags, timer_name, SWIGTYPE_p_p_char.getCPtr(err), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
     SWIGTYPE_p_switch_rtp ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_rtp(cPtr, false);
     return ret;
   }
@@ -2411,17 +2411,17 @@
     return ret;
   }
 
-  public static void switch_rtp_set_flag(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_flag_t flags) {
-    freeswitchPINVOKE.switch_rtp_set_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)flags);
+  public static void switch_rtp_set_flag(SWIGTYPE_p_switch_rtp rtp_session, uint flags) {
+    freeswitchPINVOKE.switch_rtp_set_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), flags);
   }
 
-  public static uint switch_rtp_test_flag(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_flag_t flags) {
-    uint ret = freeswitchPINVOKE.switch_rtp_test_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)flags);
+  public static uint switch_rtp_test_flag(SWIGTYPE_p_switch_rtp rtp_session, uint flags) {
+    uint ret = freeswitchPINVOKE.switch_rtp_test_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), flags);
     return ret;
   }
 
-  public static void switch_rtp_clear_flag(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_flag_t flags) {
-    freeswitchPINVOKE.switch_rtp_clear_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)flags);
+  public static void switch_rtp_clear_flag(SWIGTYPE_p_switch_rtp rtp_session, uint flags) {
+    freeswitchPINVOKE.switch_rtp_clear_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), flags);
   }
 
   public static SWIGTYPE_p_switch_socket_t switch_rtp_get_rtp_socket(SWIGTYPE_p_switch_rtp rtp_session) {
@@ -2452,8 +2452,8 @@
     freeswitchPINVOKE.switch_rtp_set_invald_handler(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void.getCPtr(on_invalid));
   }
 
-  public static switch_status_t switch_rtp_read(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_void data, SWIGTYPE_p_unsigned_long datalen, SWIGTYPE_p_unsigned_char payload_type, SWIGTYPE_p_switch_frame_flag_t flags, switch_io_flag_t io_flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_read(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_unsigned_long.getCPtr(datalen), SWIGTYPE_p_unsigned_char.getCPtr(payload_type), SWIGTYPE_p_switch_frame_flag_t.getCPtr(flags), (int)io_flags);
+  public static switch_status_t switch_rtp_read(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_void data, SWIGTYPE_p_unsigned_long datalen, SWIGTYPE_p_unsigned_char payload_type, SWIGTYPE_p_unsigned_long flags, uint io_flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_read(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_unsigned_long.getCPtr(datalen), SWIGTYPE_p_unsigned_char.getCPtr(payload_type), SWIGTYPE_p_unsigned_long.getCPtr(flags), io_flags);
     return ret;
   }
 
@@ -2477,18 +2477,18 @@
     return ret;
   }
 
-  public static switch_status_t switch_rtp_zerocopy_read(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_p_void data, SWIGTYPE_p_unsigned_long datalen, SWIGTYPE_p_unsigned_char payload_type, SWIGTYPE_p_switch_frame_flag_t flags, switch_io_flag_t io_flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_zerocopy_read(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_p_void.getCPtr(data), SWIGTYPE_p_unsigned_long.getCPtr(datalen), SWIGTYPE_p_unsigned_char.getCPtr(payload_type), SWIGTYPE_p_switch_frame_flag_t.getCPtr(flags), (int)io_flags);
+  public static switch_status_t switch_rtp_zerocopy_read(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_p_void data, SWIGTYPE_p_unsigned_long datalen, SWIGTYPE_p_unsigned_char payload_type, SWIGTYPE_p_unsigned_long flags, uint io_flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_zerocopy_read(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_p_void.getCPtr(data), SWIGTYPE_p_unsigned_long.getCPtr(datalen), SWIGTYPE_p_unsigned_char.getCPtr(payload_type), SWIGTYPE_p_unsigned_long.getCPtr(flags), io_flags);
     return ret;
   }
 
-  public static switch_status_t switch_rtp_zerocopy_read_frame(SWIGTYPE_p_switch_rtp rtp_session, switch_frame frame, switch_io_flag_t io_flagsm) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_zerocopy_read_frame(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_frame.getCPtr(frame), (int)io_flagsm);
+  public static switch_status_t switch_rtp_zerocopy_read_frame(SWIGTYPE_p_switch_rtp rtp_session, switch_frame frame, uint io_flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_zerocopy_read_frame(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_frame.getCPtr(frame), io_flags);
     return ret;
   }
 
-  public static switch_status_t switch_rtp_enable_vad(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_switch_core_session session, switch_codec codec, switch_vad_flag_t flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_enable_vad(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec), (int)flags);
+  public static switch_status_t switch_rtp_enable_vad(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_switch_core_session session, switch_codec codec, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_enable_vad(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec), flags);
     return ret;
   }
 
@@ -2502,8 +2502,8 @@
     return ret;
   }
 
-  public static int switch_rtp_write_manual(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_void data, uint datalen, byte m, byte payload, uint ts, SWIGTYPE_p_switch_frame_flag_t flags) {
-    int ret = freeswitchPINVOKE.switch_rtp_write_manual(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_void.getCPtr(data), datalen, m, payload, ts, SWIGTYPE_p_switch_frame_flag_t.getCPtr(flags));
+  public static int switch_rtp_write_manual(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_void data, uint datalen, byte m, byte payload, uint ts, SWIGTYPE_p_unsigned_long flags) {
+    int ret = freeswitchPINVOKE.switch_rtp_write_manual(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_void.getCPtr(data), datalen, m, payload, ts, SWIGTYPE_p_unsigned_long.getCPtr(flags));
     return ret;
   }
 
@@ -2732,18 +2732,18 @@
     return ret;
   }
 
-  public static switch_status_t switch_xml_bind_search_function(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml function, switch_xml_section_t sections, SWIGTYPE_p_void user_data) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_bind_search_function(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml.getCPtr(function), (int)sections, SWIGTYPE_p_void.getCPtr(user_data));
+  public static switch_status_t switch_xml_bind_search_function(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml function, uint sections, SWIGTYPE_p_void user_data) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_bind_search_function(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml.getCPtr(function), sections, SWIGTYPE_p_void.getCPtr(user_data));
     return ret;
   }
 
-  public static switch_xml_section_t switch_xml_parse_section_string(string str) {
-    switch_xml_section_t ret = (switch_xml_section_t)freeswitchPINVOKE.switch_xml_parse_section_string(str);
+  public static uint switch_xml_parse_section_string(string str) {
+    uint ret = freeswitchPINVOKE.switch_xml_parse_section_string(str);
     return ret;
   }
 
-  public static switch_status_t switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t outgoing_channel) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t.getCPtr(outgoing_channel));
+  public static switch_status_t switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t outgoing_channel) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.getCPtr(outgoing_channel));
     return ret;
   }
 
@@ -2762,23 +2762,23 @@
     return ret;
   }
 
-  public static switch_status_t switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t read_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(read_frame));
+  public static switch_status_t switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame));
     return ret;
   }
 
-  public static switch_status_t switch_core_event_hook_add_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t write_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(write_frame));
+  public static switch_status_t switch_core_event_hook_add_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(write_frame));
     return ret;
   }
 
-  public static switch_status_t switch_core_event_hook_add_video_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t video_read_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_video_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(video_read_frame));
+  public static switch_status_t switch_core_event_hook_add_video_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t video_read_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_video_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_read_frame));
     return ret;
   }
 
-  public static switch_status_t switch_core_event_hook_add_video_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t video_write_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_video_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(video_write_frame));
+  public static switch_status_t switch_core_event_hook_add_video_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t video_write_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_video_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_write_frame));
     return ret;
   }
 
@@ -2802,8 +2802,8 @@
     return ret;
   }
 
-  public static switch_status_t switch_core_event_hook_remove_outgoing_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t outgoing_channel) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t.getCPtr(outgoing_channel));
+  public static switch_status_t switch_core_event_hook_remove_outgoing_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t outgoing_channel) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.getCPtr(outgoing_channel));
     return ret;
   }
 
@@ -2822,23 +2822,23 @@
     return ret;
   }
 
-  public static switch_status_t switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t read_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(read_frame));
+  public static switch_status_t switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame));
     return ret;
   }
 
-  public static switch_status_t switch_core_event_hook_remove_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t write_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(write_frame));
+  public static switch_status_t switch_core_event_hook_remove_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(write_frame));
     return ret;
   }
 
-  public static switch_status_t switch_core_event_hook_remove_video_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t video_read_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_video_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(video_read_frame));
+  public static switch_status_t switch_core_event_hook_remove_video_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t video_read_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_video_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_read_frame));
     return ret;
   }
 
-  public static switch_status_t switch_core_event_hook_remove_video_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t video_write_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_video_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(video_write_frame));
+  public static switch_status_t switch_core_event_hook_remove_video_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t video_write_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_video_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_write_frame));
     return ret;
   }
 
@@ -2862,8 +2862,8 @@
     return ret;
   }
 
-  public static uint switch_scheduler_add_task(SWIGTYPE_p_time_t task_runtime, SWIGTYPE_p_f_p_switch_scheduler_task__void func, string desc, string group, uint cmd_id, SWIGTYPE_p_void cmd_arg, switch_scheduler_flag_t flags) {
-    uint ret = freeswitchPINVOKE.switch_scheduler_add_task(SWIGTYPE_p_time_t.getCPtr(task_runtime), SWIGTYPE_p_f_p_switch_scheduler_task__void.getCPtr(func), desc, group, cmd_id, SWIGTYPE_p_void.getCPtr(cmd_arg), (int)flags);
+  public static uint switch_scheduler_add_task(SWIGTYPE_p_time_t task_runtime, SWIGTYPE_p_f_p_switch_scheduler_task__void func, string desc, string group, uint cmd_id, SWIGTYPE_p_void cmd_arg, uint flags) {
+    uint ret = freeswitchPINVOKE.switch_scheduler_add_task(SWIGTYPE_p_time_t.getCPtr(task_runtime), SWIGTYPE_p_f_p_switch_scheduler_task__void.getCPtr(func), desc, group, cmd_id, SWIGTYPE_p_void.getCPtr(cmd_arg), flags);
     if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
     return ret;
   }
@@ -2990,6 +2990,7 @@
   public static readonly string SWITCH_URL_SEPARATOR = freeswitchPINVOKE.SWITCH_URL_SEPARATOR_get();
   public static readonly string SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE = freeswitchPINVOKE.SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get();
   public static readonly string SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE_get();
+  public static readonly string SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get();
   public static readonly string SWITCH_CALL_TIMEOUT_VARIABLE = freeswitchPINVOKE.SWITCH_CALL_TIMEOUT_VARIABLE_get();
   public static readonly string SWITCH_HOLDING_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_HOLDING_UUID_VARIABLE_get();
   public static readonly string SWITCH_API_BRIDGE_END_VARIABLE = freeswitchPINVOKE.SWITCH_API_BRIDGE_END_VARIABLE_get();

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE.cs	Mon Aug  4 21:29:58 2008
@@ -362,6 +362,9 @@
   [DllImport("mod_mono", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE_get")]
   public static extern string SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE_get();
 
+  [DllImport("mod_mono", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get")]
+  public static extern string SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get();
+
   [DllImport("mod_mono", EntryPoint="CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get")]
   public static extern string SWITCH_CALL_TIMEOUT_VARIABLE_get();
 
@@ -1140,10 +1143,10 @@
   public static extern IntPtr switch_core_session_message_pointer_reply_size_get(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_message_flags_set")]
-  public static extern void switch_core_session_message_flags_set(HandleRef jarg1, int jarg2);
+  public static extern void switch_core_session_message_flags_set(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_message_flags_get")]
-  public static extern int switch_core_session_message_flags_get(HandleRef jarg1);
+  public static extern uint switch_core_session_message_flags_get(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_new_switch_core_session_message")]
   public static extern IntPtr new_switch_core_session_message();
@@ -1188,7 +1191,7 @@
   public static extern void delete_switch_core_thread_session(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_media_bug_add")]
-  public static extern int switch_core_media_bug_add(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, int jarg5, HandleRef jarg6);
+  public static extern int switch_core_media_bug_add(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5, HandleRef jarg6);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_media_bug_get_user_data")]
   public static extern IntPtr switch_core_media_bug_get_user_data(HandleRef jarg1);
@@ -1224,7 +1227,7 @@
   public static extern int switch_core_media_bug_read(HandleRef jarg1, HandleRef jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_port_allocator_new")]
-  public static extern int switch_core_port_allocator_new(ushort jarg1, ushort jarg2, int jarg3, HandleRef jarg4);
+  public static extern int switch_core_port_allocator_new(ushort jarg1, ushort jarg2, uint jarg3, HandleRef jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_port_allocator_request_port")]
   public static extern int switch_core_port_allocator_request_port(HandleRef jarg1, HandleRef jarg2);
@@ -1236,10 +1239,10 @@
   public static extern void switch_core_port_allocator_destroy(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_init")]
-  public static extern int switch_core_init(int jarg1, int jarg2, HandleRef jarg3);
+  public static extern int switch_core_init(uint jarg1, int jarg2, HandleRef jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_init_and_modload")]
-  public static extern int switch_core_init_and_modload(int jarg1, int jarg2, HandleRef jarg3);
+  public static extern int switch_core_init_and_modload(uint jarg1, int jarg2, HandleRef jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_limit")]
   public static extern uint switch_core_session_limit(uint jarg1);
@@ -1416,7 +1419,7 @@
   public static extern void switch_core_service_session(HandleRef jarg1, HandleRef jarg2, int jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_outgoing_channel")]
-  public static extern int switch_core_session_outgoing_channel(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6, int jarg7);
+  public static extern int switch_core_session_outgoing_channel(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6, uint jarg7);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_resurrect_channel")]
   public static extern int switch_core_session_resurrect_channel(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
@@ -1446,19 +1449,19 @@
   public static extern uint switch_core_session_flush_private_events(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_read_frame")]
-  public static extern int switch_core_session_read_frame(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
+  public static extern int switch_core_session_read_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_read_video_frame")]
-  public static extern int switch_core_session_read_video_frame(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
+  public static extern int switch_core_session_read_video_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_write_video_frame")]
-  public static extern int switch_core_session_write_video_frame(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
+  public static extern int switch_core_session_write_video_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_reset")]
   public static extern void switch_core_session_reset(HandleRef jarg1, int jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_write_frame")]
-  public static extern int switch_core_session_write_frame(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
+  public static extern int switch_core_session_write_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_perform_kill_channel")]
   public static extern int switch_core_session_perform_kill_channel(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
@@ -1668,7 +1671,7 @@
   public static extern int switch_core_ready();
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_flags")]
-  public static extern int switch_core_flags();
+  public static extern uint switch_core_flags();
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_management_exec")]
   public static extern int switch_core_management_exec(string jarg1, int jarg2, string jarg3, HandleRef jarg4);
@@ -2022,10 +2025,10 @@
   public static extern string switch_caller_profile_profile_index_get(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_caller_profile_flags_set")]
-  public static extern void switch_caller_profile_flags_set(HandleRef jarg1, int jarg2);
+  public static extern void switch_caller_profile_flags_set(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_caller_profile_flags_get")]
-  public static extern int switch_caller_profile_flags_get(HandleRef jarg1);
+  public static extern uint switch_caller_profile_flags_get(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_caller_profile_originator_caller_profile_set")]
   public static extern void switch_caller_profile_originator_caller_profile_set(HandleRef jarg1, HandleRef jarg2);
@@ -2253,10 +2256,10 @@
   public static extern int switch_frame_m_get(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_frame_flags_set")]
-  public static extern void switch_frame_flags_set(HandleRef jarg1, int jarg2);
+  public static extern void switch_frame_flags_set(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_frame_flags_get")]
-  public static extern int switch_frame_flags_get(HandleRef jarg1);
+  public static extern uint switch_frame_flags_get(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_new_switch_frame")]
   public static extern IntPtr new_switch_frame();
@@ -3801,7 +3804,7 @@
   public static extern void switch_channel_wait_for_state(HandleRef jarg1, HandleRef jarg2, int jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_wait_for_flag")]
-  public static extern int switch_channel_wait_for_flag(HandleRef jarg1, int jarg2, int jarg3, uint jarg4);
+  public static extern int switch_channel_wait_for_flag(HandleRef jarg1, uint jarg2, int jarg3, uint jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_perform_set_state")]
   public static extern int switch_channel_perform_set_state(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
@@ -3879,22 +3882,22 @@
   public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_test_flag")]
-  public static extern uint switch_channel_test_flag(HandleRef jarg1, int jarg2);
+  public static extern uint switch_channel_test_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_set_flag")]
-  public static extern void switch_channel_set_flag(HandleRef jarg1, int jarg2);
+  public static extern void switch_channel_set_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_set_flag_partner")]
-  public static extern int switch_channel_set_flag_partner(HandleRef jarg1, int jarg2);
+  public static extern int switch_channel_set_flag_partner(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_clear_flag_partner")]
-  public static extern int switch_channel_clear_flag_partner(HandleRef jarg1, int jarg2);
+  public static extern int switch_channel_clear_flag_partner(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_set_state_flag")]
-  public static extern void switch_channel_set_state_flag(HandleRef jarg1, int jarg2);
+  public static extern void switch_channel_set_state_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_clear_flag")]
-  public static extern void switch_channel_clear_flag(HandleRef jarg1, int jarg2);
+  public static extern void switch_channel_clear_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_perform_answer")]
   public static extern int switch_channel_perform_answer(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
@@ -4503,7 +4506,7 @@
   public static extern int switch_ivr_record_session(HandleRef jarg1, string jarg2, uint jarg3, HandleRef jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_eavesdrop_session")]
-  public static extern int switch_ivr_eavesdrop_session(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+  public static extern int switch_ivr_eavesdrop_session(HandleRef jarg1, string jarg2, string jarg3, uint jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_displace_session")]
   public static extern int switch_ivr_displace_session(HandleRef jarg1, string jarg2, uint jarg3, string jarg4);
@@ -4557,7 +4560,7 @@
   public static extern int switch_ivr_speak_text(HandleRef jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_originate")]
-  public static extern int switch_ivr_originate(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, string jarg4, uint jarg5, HandleRef jarg6, string jarg7, string jarg8, HandleRef jarg9, int jarg10);
+  public static extern int switch_ivr_originate(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, string jarg4, uint jarg5, HandleRef jarg6, string jarg7, string jarg8, HandleRef jarg9, uint jarg10);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_multi_threaded_bridge")]
   public static extern int switch_ivr_multi_threaded_bridge(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5);
@@ -4578,10 +4581,10 @@
   public static extern int switch_ivr_uuid_bridge(string jarg1, string jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_media")]
-  public static extern int switch_ivr_media(string jarg1, int jarg2);
+  public static extern int switch_ivr_media(string jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_nomedia")]
-  public static extern int switch_ivr_nomedia(string jarg1, int jarg2);
+  public static extern int switch_ivr_nomedia(string jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_hold_uuid")]
   public static extern int switch_ivr_hold_uuid(string jarg1, string jarg2, int jarg3);
@@ -4596,10 +4599,10 @@
   public static extern int switch_ivr_unhold(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_schedule_broadcast")]
-  public static extern uint switch_ivr_schedule_broadcast(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+  public static extern uint switch_ivr_schedule_broadcast(HandleRef jarg1, string jarg2, string jarg3, uint jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_broadcast")]
-  public static extern int switch_ivr_broadcast(string jarg1, string jarg2, int jarg3);
+  public static extern int switch_ivr_broadcast(string jarg1, string jarg2, uint jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_transfer_variable")]
   public static extern int switch_ivr_transfer_variable(HandleRef jarg1, HandleRef jarg2, string jarg3);
@@ -4680,7 +4683,7 @@
   public static extern int switch_ivr_read(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4, string jarg5, string jarg6, HandleRef jarg7, uint jarg8, string jarg9);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_bind_dtmf_meta_session")]
-  public static extern int switch_ivr_bind_dtmf_meta_session(HandleRef jarg1, uint jarg2, int jarg3, string jarg4);
+  public static extern int switch_ivr_bind_dtmf_meta_session(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_unbind_dtmf_meta_session")]
   public static extern int switch_ivr_unbind_dtmf_meta_session(HandleRef jarg1);
@@ -4773,10 +4776,10 @@
   public static extern void switch_rtp_release_port(string jarg1, ushort jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_create")]
-  public static extern int switch_rtp_create(HandleRef jarg1, byte jarg2, uint jarg3, uint jarg4, int jarg5, string jarg6, HandleRef jarg7, HandleRef jarg8);
+  public static extern int switch_rtp_create(HandleRef jarg1, byte jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6, HandleRef jarg7, HandleRef jarg8);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_new")]
-  public static extern IntPtr switch_rtp_new(string jarg1, ushort jarg2, string jarg3, ushort jarg4, byte jarg5, uint jarg6, uint jarg7, int jarg8, string jarg9, HandleRef jarg10, HandleRef jarg11);
+  public static extern IntPtr switch_rtp_new(string jarg1, ushort jarg2, string jarg3, ushort jarg4, byte jarg5, uint jarg6, uint jarg7, uint jarg8, string jarg9, HandleRef jarg10, HandleRef jarg11);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_set_remote_address")]
   public static extern int switch_rtp_set_remote_address(HandleRef jarg1, string jarg2, ushort jarg3, HandleRef jarg4);
@@ -4806,13 +4809,13 @@
   public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_set_flag")]
-  public static extern void switch_rtp_set_flag(HandleRef jarg1, int jarg2);
+  public static extern void switch_rtp_set_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_test_flag")]
-  public static extern uint switch_rtp_test_flag(HandleRef jarg1, int jarg2);
+  public static extern uint switch_rtp_test_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_clear_flag")]
-  public static extern void switch_rtp_clear_flag(HandleRef jarg1, int jarg2);
+  public static extern void switch_rtp_clear_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_get_rtp_socket")]
   public static extern IntPtr switch_rtp_get_rtp_socket(HandleRef jarg1);
@@ -4833,7 +4836,7 @@
   public static extern void switch_rtp_set_invald_handler(HandleRef jarg1, HandleRef jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_read")]
-  public static extern int switch_rtp_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, int jarg6);
+  public static extern int switch_rtp_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, uint jarg6);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_queue_rfc2833")]
   public static extern int switch_rtp_queue_rfc2833(HandleRef jarg1, HandleRef jarg2);
@@ -4848,13 +4851,13 @@
   public static extern IntPtr switch_rtp_dequeue_dtmf(HandleRef jarg1, HandleRef jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_zerocopy_read")]
-  public static extern int switch_rtp_zerocopy_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, int jarg6);
+  public static extern int switch_rtp_zerocopy_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, uint jarg6);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_zerocopy_read_frame")]
-  public static extern int switch_rtp_zerocopy_read_frame(HandleRef jarg1, HandleRef jarg2, int jarg3);
+  public static extern int switch_rtp_zerocopy_read_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_enable_vad")]
-  public static extern int switch_rtp_enable_vad(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, int jarg4);
+  public static extern int switch_rtp_enable_vad(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, uint jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_disable_vad")]
   public static extern int switch_rtp_disable_vad(HandleRef jarg1);
@@ -5118,10 +5121,10 @@
   public static extern IntPtr switch_xml_open_cfg(string jarg1, HandleRef jarg2, HandleRef jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_xml_bind_search_function")]
-  public static extern int switch_xml_bind_search_function(HandleRef jarg1, int jarg2, HandleRef jarg3);
+  public static extern int switch_xml_bind_search_function(HandleRef jarg1, uint jarg2, HandleRef jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_xml_parse_section_string")]
-  public static extern int switch_xml_parse_section_string(string jarg1);
+  public static extern uint switch_xml_parse_section_string(string jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_set")]
   public static extern void switch_io_event_hook_outgoing_channel_outgoing_channel_set(HandleRef jarg1, HandleRef jarg2);
@@ -5532,7 +5535,7 @@
   public static extern void delete_switch_scheduler_task(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_scheduler_add_task")]
-  public static extern uint switch_scheduler_add_task(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, uint jarg5, HandleRef jarg6, int jarg7);
+  public static extern uint switch_scheduler_add_task(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, uint jarg5, HandleRef jarg6, uint jarg7);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_scheduler_del_task_id")]
   public static extern uint switch_scheduler_del_task_id(uint jarg1);
@@ -5855,6 +5858,15 @@
   [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_Ready")]
   public static extern bool CoreSession_Ready(HandleRef jarg1);
 
+  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_answered")]
+  public static extern bool CoreSession_answered(HandleRef jarg1);
+
+  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_mediaReady")]
+  public static extern bool CoreSession_mediaReady(HandleRef jarg1);
+
+  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_waitForAnswer")]
+  public static extern void CoreSession_waitForAnswer(HandleRef jarg1, HandleRef jarg2);
+
   [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_Execute")]
   public static extern void CoreSession_Execute(HandleRef jarg1, string jarg2, string jarg3);
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE_fixed.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE_fixed.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE_fixed.cs	Mon Aug  4 21:29:58 2008
@@ -617,6 +617,14 @@
 System.Runtime.InteropServices.Marshal.FreeCoTaskMem(_ptr); 
 return _res; }
 
+  [DllImport("mod_mono", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get")]
+  public static extern IntPtr __SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get();
+  public static  string SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get(){ 
+var _ptr = __SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get(); 
+var _res = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(_ptr); 
+System.Runtime.InteropServices.Marshal.FreeCoTaskMem(_ptr); 
+return _res; }
+
   [DllImport("mod_mono", EntryPoint="CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get")]
   public static extern IntPtr __SWITCH_CALL_TIMEOUT_VARIABLE_get();
   public static  string SWITCH_CALL_TIMEOUT_VARIABLE_get(){ 
@@ -1680,10 +1688,10 @@
   public static extern IntPtr switch_core_session_message_pointer_reply_size_get(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_message_flags_set")]
-  public static extern void switch_core_session_message_flags_set(HandleRef jarg1, int jarg2);
+  public static extern void switch_core_session_message_flags_set(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_message_flags_get")]
-  public static extern int switch_core_session_message_flags_get(HandleRef jarg1);
+  public static extern uint switch_core_session_message_flags_get(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_new_switch_core_session_message")]
   public static extern IntPtr new_switch_core_session_message();
@@ -1728,7 +1736,7 @@
   public static extern void delete_switch_core_thread_session(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_media_bug_add")]
-  public static extern int switch_core_media_bug_add(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, int jarg5, HandleRef jarg6);
+  public static extern int switch_core_media_bug_add(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5, HandleRef jarg6);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_media_bug_get_user_data")]
   public static extern IntPtr switch_core_media_bug_get_user_data(HandleRef jarg1);
@@ -1764,7 +1772,7 @@
   public static extern int switch_core_media_bug_read(HandleRef jarg1, HandleRef jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_port_allocator_new")]
-  public static extern int switch_core_port_allocator_new(ushort jarg1, ushort jarg2, int jarg3, HandleRef jarg4);
+  public static extern int switch_core_port_allocator_new(ushort jarg1, ushort jarg2, uint jarg3, HandleRef jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_port_allocator_request_port")]
   public static extern int switch_core_port_allocator_request_port(HandleRef jarg1, HandleRef jarg2);
@@ -1776,10 +1784,10 @@
   public static extern void switch_core_port_allocator_destroy(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_init")]
-  public static extern int switch_core_init(int jarg1, int jarg2, HandleRef jarg3);
+  public static extern int switch_core_init(uint jarg1, int jarg2, HandleRef jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_init_and_modload")]
-  public static extern int switch_core_init_and_modload(int jarg1, int jarg2, HandleRef jarg3);
+  public static extern int switch_core_init_and_modload(uint jarg1, int jarg2, HandleRef jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_limit")]
   public static extern uint switch_core_session_limit(uint jarg1);
@@ -1996,7 +2004,7 @@
   public static extern void switch_core_service_session(HandleRef jarg1, HandleRef jarg2, int jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_outgoing_channel")]
-  public static extern int switch_core_session_outgoing_channel(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6, int jarg7);
+  public static extern int switch_core_session_outgoing_channel(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6, uint jarg7);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_resurrect_channel")]
   public static extern int switch_core_session_resurrect_channel(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
@@ -2026,19 +2034,19 @@
   public static extern uint switch_core_session_flush_private_events(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_read_frame")]
-  public static extern int switch_core_session_read_frame(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
+  public static extern int switch_core_session_read_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_read_video_frame")]
-  public static extern int switch_core_session_read_video_frame(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
+  public static extern int switch_core_session_read_video_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_write_video_frame")]
-  public static extern int switch_core_session_write_video_frame(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
+  public static extern int switch_core_session_write_video_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_reset")]
   public static extern void switch_core_session_reset(HandleRef jarg1, int jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_write_frame")]
-  public static extern int switch_core_session_write_frame(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
+  public static extern int switch_core_session_write_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_session_perform_kill_channel")]
   public static extern int switch_core_session_perform_kill_channel(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
@@ -2253,7 +2261,7 @@
   public static extern int switch_core_ready();
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_flags")]
-  public static extern int switch_core_flags();
+  public static extern uint switch_core_flags();
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_core_management_exec")]
   public static extern int switch_core_management_exec(string jarg1, int jarg2, string jarg3, HandleRef jarg4);
@@ -2747,10 +2755,10 @@
 return _res; }
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_caller_profile_flags_set")]
-  public static extern void switch_caller_profile_flags_set(HandleRef jarg1, int jarg2);
+  public static extern void switch_caller_profile_flags_set(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_caller_profile_flags_get")]
-  public static extern int switch_caller_profile_flags_get(HandleRef jarg1);
+  public static extern uint switch_caller_profile_flags_get(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_caller_profile_originator_caller_profile_set")]
   public static extern void switch_caller_profile_originator_caller_profile_set(HandleRef jarg1, HandleRef jarg2);
@@ -3008,10 +3016,10 @@
   public static extern int switch_frame_m_get(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_frame_flags_set")]
-  public static extern void switch_frame_flags_set(HandleRef jarg1, int jarg2);
+  public static extern void switch_frame_flags_set(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_frame_flags_get")]
-  public static extern int switch_frame_flags_get(HandleRef jarg1);
+  public static extern uint switch_frame_flags_get(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_new_switch_frame")]
   public static extern IntPtr new_switch_frame();
@@ -4721,7 +4729,7 @@
   public static extern void switch_channel_wait_for_state(HandleRef jarg1, HandleRef jarg2, int jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_wait_for_flag")]
-  public static extern int switch_channel_wait_for_flag(HandleRef jarg1, int jarg2, int jarg3, uint jarg4);
+  public static extern int switch_channel_wait_for_flag(HandleRef jarg1, uint jarg2, int jarg3, uint jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_perform_set_state")]
   public static extern int switch_channel_perform_set_state(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
@@ -4819,22 +4827,22 @@
   public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_test_flag")]
-  public static extern uint switch_channel_test_flag(HandleRef jarg1, int jarg2);
+  public static extern uint switch_channel_test_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_set_flag")]
-  public static extern void switch_channel_set_flag(HandleRef jarg1, int jarg2);
+  public static extern void switch_channel_set_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_set_flag_partner")]
-  public static extern int switch_channel_set_flag_partner(HandleRef jarg1, int jarg2);
+  public static extern int switch_channel_set_flag_partner(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_clear_flag_partner")]
-  public static extern int switch_channel_clear_flag_partner(HandleRef jarg1, int jarg2);
+  public static extern int switch_channel_clear_flag_partner(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_set_state_flag")]
-  public static extern void switch_channel_set_state_flag(HandleRef jarg1, int jarg2);
+  public static extern void switch_channel_set_state_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_clear_flag")]
-  public static extern void switch_channel_clear_flag(HandleRef jarg1, int jarg2);
+  public static extern void switch_channel_clear_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_channel_perform_answer")]
   public static extern int switch_channel_perform_answer(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
@@ -5533,7 +5541,7 @@
   public static extern int switch_ivr_record_session(HandleRef jarg1, string jarg2, uint jarg3, HandleRef jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_eavesdrop_session")]
-  public static extern int switch_ivr_eavesdrop_session(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+  public static extern int switch_ivr_eavesdrop_session(HandleRef jarg1, string jarg2, string jarg3, uint jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_displace_session")]
   public static extern int switch_ivr_displace_session(HandleRef jarg1, string jarg2, uint jarg3, string jarg4);
@@ -5587,7 +5595,7 @@
   public static extern int switch_ivr_speak_text(HandleRef jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_originate")]
-  public static extern int switch_ivr_originate(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, string jarg4, uint jarg5, HandleRef jarg6, string jarg7, string jarg8, HandleRef jarg9, int jarg10);
+  public static extern int switch_ivr_originate(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, string jarg4, uint jarg5, HandleRef jarg6, string jarg7, string jarg8, HandleRef jarg9, uint jarg10);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_multi_threaded_bridge")]
   public static extern int switch_ivr_multi_threaded_bridge(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5);
@@ -5608,10 +5616,10 @@
   public static extern int switch_ivr_uuid_bridge(string jarg1, string jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_media")]
-  public static extern int switch_ivr_media(string jarg1, int jarg2);
+  public static extern int switch_ivr_media(string jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_nomedia")]
-  public static extern int switch_ivr_nomedia(string jarg1, int jarg2);
+  public static extern int switch_ivr_nomedia(string jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_hold_uuid")]
   public static extern int switch_ivr_hold_uuid(string jarg1, string jarg2, int jarg3);
@@ -5626,10 +5634,10 @@
   public static extern int switch_ivr_unhold(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_schedule_broadcast")]
-  public static extern uint switch_ivr_schedule_broadcast(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+  public static extern uint switch_ivr_schedule_broadcast(HandleRef jarg1, string jarg2, string jarg3, uint jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_broadcast")]
-  public static extern int switch_ivr_broadcast(string jarg1, string jarg2, int jarg3);
+  public static extern int switch_ivr_broadcast(string jarg1, string jarg2, uint jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_transfer_variable")]
   public static extern int switch_ivr_transfer_variable(HandleRef jarg1, HandleRef jarg2, string jarg3);
@@ -5710,7 +5718,7 @@
   public static extern int switch_ivr_read(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4, string jarg5, string jarg6, HandleRef jarg7, uint jarg8, string jarg9);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_bind_dtmf_meta_session")]
-  public static extern int switch_ivr_bind_dtmf_meta_session(HandleRef jarg1, uint jarg2, int jarg3, string jarg4);
+  public static extern int switch_ivr_bind_dtmf_meta_session(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_ivr_unbind_dtmf_meta_session")]
   public static extern int switch_ivr_unbind_dtmf_meta_session(HandleRef jarg1);
@@ -5813,10 +5821,10 @@
   public static extern void switch_rtp_release_port(string jarg1, ushort jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_create")]
-  public static extern int switch_rtp_create(HandleRef jarg1, byte jarg2, uint jarg3, uint jarg4, int jarg5, string jarg6, HandleRef jarg7, HandleRef jarg8);
+  public static extern int switch_rtp_create(HandleRef jarg1, byte jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6, HandleRef jarg7, HandleRef jarg8);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_new")]
-  public static extern IntPtr switch_rtp_new(string jarg1, ushort jarg2, string jarg3, ushort jarg4, byte jarg5, uint jarg6, uint jarg7, int jarg8, string jarg9, HandleRef jarg10, HandleRef jarg11);
+  public static extern IntPtr switch_rtp_new(string jarg1, ushort jarg2, string jarg3, ushort jarg4, byte jarg5, uint jarg6, uint jarg7, uint jarg8, string jarg9, HandleRef jarg10, HandleRef jarg11);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_set_remote_address")]
   public static extern int switch_rtp_set_remote_address(HandleRef jarg1, string jarg2, ushort jarg3, HandleRef jarg4);
@@ -5846,13 +5854,13 @@
   public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_set_flag")]
-  public static extern void switch_rtp_set_flag(HandleRef jarg1, int jarg2);
+  public static extern void switch_rtp_set_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_test_flag")]
-  public static extern uint switch_rtp_test_flag(HandleRef jarg1, int jarg2);
+  public static extern uint switch_rtp_test_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_clear_flag")]
-  public static extern void switch_rtp_clear_flag(HandleRef jarg1, int jarg2);
+  public static extern void switch_rtp_clear_flag(HandleRef jarg1, uint jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_get_rtp_socket")]
   public static extern IntPtr switch_rtp_get_rtp_socket(HandleRef jarg1);
@@ -5873,7 +5881,7 @@
   public static extern void switch_rtp_set_invald_handler(HandleRef jarg1, HandleRef jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_read")]
-  public static extern int switch_rtp_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, int jarg6);
+  public static extern int switch_rtp_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, uint jarg6);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_queue_rfc2833")]
   public static extern int switch_rtp_queue_rfc2833(HandleRef jarg1, HandleRef jarg2);
@@ -5888,13 +5896,13 @@
   public static extern IntPtr switch_rtp_dequeue_dtmf(HandleRef jarg1, HandleRef jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_zerocopy_read")]
-  public static extern int switch_rtp_zerocopy_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, int jarg6);
+  public static extern int switch_rtp_zerocopy_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, uint jarg6);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_zerocopy_read_frame")]
-  public static extern int switch_rtp_zerocopy_read_frame(HandleRef jarg1, HandleRef jarg2, int jarg3);
+  public static extern int switch_rtp_zerocopy_read_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_enable_vad")]
-  public static extern int switch_rtp_enable_vad(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, int jarg4);
+  public static extern int switch_rtp_enable_vad(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, uint jarg4);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_rtp_disable_vad")]
   public static extern int switch_rtp_disable_vad(HandleRef jarg1);
@@ -6228,10 +6236,10 @@
   public static extern IntPtr switch_xml_open_cfg(string jarg1, HandleRef jarg2, HandleRef jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_xml_bind_search_function")]
-  public static extern int switch_xml_bind_search_function(HandleRef jarg1, int jarg2, HandleRef jarg3);
+  public static extern int switch_xml_bind_search_function(HandleRef jarg1, uint jarg2, HandleRef jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_xml_parse_section_string")]
-  public static extern int switch_xml_parse_section_string(string jarg1);
+  public static extern uint switch_xml_parse_section_string(string jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_set")]
   public static extern void switch_io_event_hook_outgoing_channel_outgoing_channel_set(HandleRef jarg1, HandleRef jarg2);
@@ -6647,7 +6655,7 @@
   public static extern void delete_switch_scheduler_task(HandleRef jarg1);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_scheduler_add_task")]
-  public static extern uint switch_scheduler_add_task(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, uint jarg5, HandleRef jarg6, int jarg7);
+  public static extern uint switch_scheduler_add_task(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, uint jarg5, HandleRef jarg6, uint jarg7);
 
   [DllImport("mod_mono", EntryPoint="CSharp_switch_scheduler_del_task_id")]
   public static extern uint switch_scheduler_del_task_id(uint jarg1);
@@ -7004,11 +7012,11 @@
   [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_Originate")]
   public static extern int CoreSession_Originate(HandleRef jarg1, HandleRef jarg2, string jarg3, int jarg4);
 
-  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_speak")]
-  public static extern int CoreSession_speak(HandleRef jarg1, string jarg2);
+  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_Speak")]
+  public static extern int CoreSession_Speak(HandleRef jarg1, string jarg2);
 
-  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_set_tts_parms")]
-  public static extern void CoreSession_set_tts_parms(HandleRef jarg1, string jarg2, string jarg3);
+  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_SetTtsParameters")]
+  public static extern void CoreSession_SetTtsParameters(HandleRef jarg1, string jarg2, string jarg3);
 
   [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_CollectDigits")]
   public static extern int CoreSession_CollectDigits(HandleRef jarg1, int jarg2);
@@ -7049,12 +7057,21 @@
   [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_flushDigits")]
   public static extern int CoreSession_flushDigits(HandleRef jarg1);
 
-  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_setAutoHangup")]
-  public static extern int CoreSession_setAutoHangup(HandleRef jarg1, bool jarg2);
+  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_SetAutoHangup")]
+  public static extern int CoreSession_SetAutoHangup(HandleRef jarg1, bool jarg2);
 
   [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_Ready")]
   public static extern bool CoreSession_Ready(HandleRef jarg1);
 
+  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_answered")]
+  public static extern bool CoreSession_answered(HandleRef jarg1);
+
+  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_mediaReady")]
+  public static extern bool CoreSession_mediaReady(HandleRef jarg1);
+
+  [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_waitForAnswer")]
+  public static extern void CoreSession_waitForAnswer(HandleRef jarg1, HandleRef jarg2);
+
   [DllImport("mod_mono", EntryPoint="CSharp_CoreSession_Execute")]
   public static extern void CoreSession_Execute(HandleRef jarg1, string jarg2, string jarg3);
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/session_flag_t.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/session_flag_t.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/session_flag_t.cs	Mon Aug  4 21:29:58 2008
@@ -8,7 +8,7 @@
 
 namespace FreeSWITCH.Native {
 
-public enum session_flag_t {
+[System.Flags] public enum session_flag_t {
   S_HUP = (1 << 0),
   S_FREE = (1 << 1),
   S_RDLOCK = (1 << 2)

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_asr_interface.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_asr_interface.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_asr_interface.cs	Mon Aug  4 21:29:58 2008
@@ -49,13 +49,13 @@
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_enum_switch_asr_flag_t__switch_status_t asr_open {
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t asr_open {
     set {
-      freeswitchPINVOKE.switch_asr_interface_asr_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_enum_switch_asr_flag_t__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_asr_interface_asr_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_open_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_enum_switch_asr_flag_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_enum_switch_asr_flag_t__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t(cPtr, false);
       return ret;
     } 
   }
@@ -82,24 +82,24 @@
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t asr_close {
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t asr_close {
     set {
-      freeswitchPINVOKE.switch_asr_interface_asr_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_asr_interface_asr_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_close_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(cPtr, false);
       return ret;
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_enum_switch_asr_flag_t__switch_status_t asr_feed {
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t asr_feed {
     set {
-      freeswitchPINVOKE.switch_asr_interface_asr_feed_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_enum_switch_asr_flag_t__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_asr_interface_asr_feed_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_feed_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_enum_switch_asr_flag_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_enum_switch_asr_flag_t__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t(cPtr, false);
       return ret;
     } 
   }
@@ -126,24 +126,24 @@
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t asr_check_results {
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t asr_check_results {
     set {
-      freeswitchPINVOKE.switch_asr_interface_asr_check_results_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_asr_interface_asr_check_results_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_check_results_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(cPtr, false);
       return ret;
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_enum_switch_asr_flag_t__switch_status_t asr_get_results {
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t asr_get_results {
     set {
-      freeswitchPINVOKE.switch_asr_interface_asr_get_results_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_enum_switch_asr_flag_t__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_asr_interface_asr_get_results_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_get_results_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_enum_switch_asr_flag_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_enum_switch_asr_flag_t__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t(cPtr, false);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_caller_profile.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_caller_profile.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_caller_profile.cs	Mon Aug  4 21:29:58 2008
@@ -259,12 +259,12 @@
     } 
   }
 
-  public switch_caller_profile_flag_t flags {
+  public uint flags {
     set {
-      freeswitchPINVOKE.switch_caller_profile_flags_set(swigCPtr, (int)value);
+      freeswitchPINVOKE.switch_caller_profile_flags_set(swigCPtr, value);
     } 
     get {
-      switch_caller_profile_flag_t ret = (switch_caller_profile_flag_t)freeswitchPINVOKE.switch_caller_profile_flags_get(swigCPtr);
+      uint ret = freeswitchPINVOKE.switch_caller_profile_flags_get(swigCPtr);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec_implementation.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec_implementation.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec_implementation.cs	Mon Aug  4 21:29:58 2008
@@ -179,13 +179,13 @@
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_flag_t_p_q_const__switch_codec_settings__switch_status_t init {
+  public SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t init {
     set {
-      freeswitchPINVOKE.switch_codec_implementation_init_set(swigCPtr, SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_flag_t_p_q_const__switch_codec_settings__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_codec_implementation_init_set(swigCPtr, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_init_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_flag_t_p_q_const__switch_codec_settings__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_flag_t_p_q_const__switch_codec_settings__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t(cPtr, false);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_session_message.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_session_message.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_session_message.cs	Mon Aug  4 21:29:58 2008
@@ -169,12 +169,12 @@
     } 
   }
 
-  public switch_core_session_message_flag_t flags {
+  public uint flags {
     set {
-      freeswitchPINVOKE.switch_core_session_message_flags_set(swigCPtr, (int)value);
+      freeswitchPINVOKE.switch_core_session_message_flags_set(swigCPtr, value);
     } 
     get {
-      switch_core_session_message_flag_t ret = (switch_core_session_message_flag_t)freeswitchPINVOKE.switch_core_session_message_flags_get(swigCPtr);
+      uint ret = freeswitchPINVOKE.switch_core_session_message_flags_get(swigCPtr);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_frame.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_frame.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_frame.cs	Mon Aug  4 21:29:58 2008
@@ -184,12 +184,12 @@
     } 
   }
 
-  public switch_frame_flag_t flags {
+  public uint flags {
     set {
-      freeswitchPINVOKE.switch_frame_flags_set(swigCPtr, (int)value);
+      freeswitchPINVOKE.switch_frame_flags_set(swigCPtr, value);
     } 
     get {
-      switch_frame_flag_t ret = (switch_frame_flag_t)freeswitchPINVOKE.switch_frame_flags_get(swigCPtr);
+      uint ret = freeswitchPINVOKE.switch_frame_flags_get(swigCPtr);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_outgoing_channel.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_outgoing_channel.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_outgoing_channel.cs	Mon Aug  4 21:29:58 2008
@@ -39,13 +39,13 @@
     }
   }
 
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t outgoing_channel {
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t outgoing_channel {
     set {
-      freeswitchPINVOKE.switch_io_event_hook_outgoing_channel_outgoing_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_io_event_hook_outgoing_channel_outgoing_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_outgoing_channel_outgoing_channel_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t(cPtr, false);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_read_frame.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_read_frame.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_read_frame.cs	Mon Aug  4 21:29:58 2008
@@ -39,13 +39,13 @@
     }
   }
 
-  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t read_frame {
+  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame {
     set {
-      freeswitchPINVOKE.switch_io_event_hook_read_frame_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_io_event_hook_read_frame_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_read_frame_read_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_read_frame.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_read_frame.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_read_frame.cs	Mon Aug  4 21:29:58 2008
@@ -39,13 +39,13 @@
     }
   }
 
-  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t video_read_frame {
+  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t video_read_frame {
     set {
-      freeswitchPINVOKE.switch_io_event_hook_video_read_frame_video_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_io_event_hook_video_read_frame_video_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_video_read_frame_video_read_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_write_frame.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_write_frame.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_write_frame.cs	Mon Aug  4 21:29:58 2008
@@ -39,13 +39,13 @@
     }
   }
 
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t video_write_frame {
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t video_write_frame {
     set {
-      freeswitchPINVOKE.switch_io_event_hook_video_write_frame_video_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_io_event_hook_video_write_frame_video_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_video_write_frame_video_write_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_write_frame.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_write_frame.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_write_frame.cs	Mon Aug  4 21:29:58 2008
@@ -39,13 +39,13 @@
     }
   }
 
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t write_frame {
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame {
     set {
-      freeswitchPINVOKE.switch_io_event_hook_write_frame_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_io_event_hook_write_frame_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_write_frame_write_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_routines.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_routines.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_routines.cs	Mon Aug  4 21:29:58 2008
@@ -39,35 +39,35 @@
     }
   }
 
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_enum_switch_originate_flag_t__switch_call_cause_t outgoing_channel {
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long__switch_call_cause_t outgoing_channel {
     set {
-      freeswitchPINVOKE.switch_io_routines_outgoing_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_enum_switch_originate_flag_t__switch_call_cause_t.getCPtr(value));
+      freeswitchPINVOKE.switch_io_routines_outgoing_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long__switch_call_cause_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_outgoing_channel_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_enum_switch_originate_flag_t__switch_call_cause_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_enum_switch_originate_flag_t__switch_call_cause_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long__switch_call_cause_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long__switch_call_cause_t(cPtr, false);
       return ret;
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t read_frame {
+  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame {
     set {
-      freeswitchPINVOKE.switch_io_routines_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_io_routines_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_read_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
       return ret;
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t write_frame {
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame {
     set {
-      freeswitchPINVOKE.switch_io_routines_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_io_routines_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_write_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
       return ret;
     } 
   }
@@ -127,24 +127,24 @@
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t read_video_frame {
+  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_video_frame {
     set {
-      freeswitchPINVOKE.switch_io_routines_read_video_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_io_routines_read_video_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_read_video_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
       return ret;
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t write_video_frame {
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_video_frame {
     set {
-      freeswitchPINVOKE.switch_io_routines_write_video_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_io_routines_write_video_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_write_video_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_speech_interface.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_speech_interface.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_speech_interface.cs	Mon Aug  4 21:29:58 2008
@@ -49,46 +49,46 @@
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_enum_switch_speech_flag_t__switch_status_t speech_open {
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t speech_open {
     set {
-      freeswitchPINVOKE.switch_speech_interface_speech_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_enum_switch_speech_flag_t__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_speech_interface_speech_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_open_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_enum_switch_speech_flag_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_enum_switch_speech_flag_t__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t(cPtr, false);
       return ret;
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_enum_switch_speech_flag_t__switch_status_t speech_close {
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t speech_close {
     set {
-      freeswitchPINVOKE.switch_speech_interface_speech_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_enum_switch_speech_flag_t__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_speech_interface_speech_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_close_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_enum_switch_speech_flag_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_enum_switch_speech_flag_t__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t(cPtr, false);
       return ret;
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_enum_switch_speech_flag_t__switch_status_t speech_feed_tts {
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t speech_feed_tts {
     set {
-      freeswitchPINVOKE.switch_speech_interface_speech_feed_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_enum_switch_speech_flag_t__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_speech_interface_speech_feed_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_feed_tts_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_enum_switch_speech_flag_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_enum_switch_speech_flag_t__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t(cPtr, false);
       return ret;
     } 
   }
 
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_enum_switch_speech_flag_t__switch_status_t speech_read_tts {
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t speech_read_tts {
     set {
-      freeswitchPINVOKE.switch_speech_interface_speech_read_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_enum_switch_speech_flag_t__switch_status_t.getCPtr(value));
+      freeswitchPINVOKE.switch_speech_interface_speech_read_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t.getCPtr(value));
     } 
     get {
       IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_read_tts_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_enum_switch_speech_flag_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_enum_switch_speech_flag_t__switch_status_t(cPtr, false);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t(cPtr, false);
       return ret;
     } 
   }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_xml_flag_t.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_xml_flag_t.cs	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_xml_flag_t.cs	Mon Aug  4 21:29:58 2008
@@ -8,7 +8,7 @@
 
 namespace FreeSWITCH.Native {
 
-public enum switch_xml_flag_t {
+[System.Flags] public enum switch_xml_flag_t {
   SWITCH_XML_ROOT = (1 << 0),
   SWITCH_XML_NAMEM = (1 << 1),
   SWITCH_XML_TXTM = (1 << 2),

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/Makefile	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/Makefile	Mon Aug  4 21:29:58 2008
@@ -10,15 +10,18 @@
 include $(BASE)/build/modmake.rules
 
 
+reswig:	swigclean mod_perl_wrap.cpp
+
 swigclean: clean
 	rm -f mod_perl_wrap.* freeswitch.so freeswitch.pm
 
 mod_perl_wrap.cpp:
 	swig -static -shadow -perl5 -c++ -DMULTIPLICITY -I../../../../src/include -o mod_perl_wrap.cpp freeswitch.i
 	echo "#include \"mod_perl_extra.c\"" >> mod_perl_wrap.cpp
-	#	patch -s -p0 -i hack.diff
-
+	patch -s -p0 -i hack.diff
 
+orig: mod_perl_wrap.cpp
+	patch -R -s -p0 -i hack.diff
 
 freeswitch.$(DYNAMIC_LIB_EXTEN): $(LOCAL_OBJS) $(LOCAL_LIBADD)
 	$(LINK) $(SOLINK) -o freeswitch.$(DYNAMIC_LIB_EXTEN)  $(LOCAL_OBJS) $(LOCAL_LIBADD) $(LDFLAGS)

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm	Mon Aug  4 21:29:58 2008
@@ -179,6 +179,47 @@
 }
 
 
+############# Class : freeswitch::DTMF ##############
+
+package freeswitch::DTMF;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( freeswitch );
+%OWNER = ();
+%ITERATORS = ();
+*swig_digit_get = *freeswitchc::DTMF_digit_get;
+*swig_digit_set = *freeswitchc::DTMF_digit_set;
+*swig_duration_get = *freeswitchc::DTMF_duration_get;
+*swig_duration_set = *freeswitchc::DTMF_duration_set;
+sub new {
+    my $pkg = shift;
+    my $self = freeswitchc::new_DTMF(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        freeswitchc::delete_DTMF($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
 ############# Class : freeswitch::Stream ##############
 
 package freeswitch::Stream;
@@ -270,6 +311,56 @@
 }
 
 
+############# Class : freeswitch::EventConsumer ##############
+
+package freeswitch::EventConsumer;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( freeswitch );
+%OWNER = ();
+%ITERATORS = ();
+*swig_events_get = *freeswitchc::EventConsumer_events_get;
+*swig_events_set = *freeswitchc::EventConsumer_events_set;
+*swig_e_event_id_get = *freeswitchc::EventConsumer_e_event_id_get;
+*swig_e_event_id_set = *freeswitchc::EventConsumer_e_event_id_set;
+*swig_node_get = *freeswitchc::EventConsumer_node_get;
+*swig_node_set = *freeswitchc::EventConsumer_node_set;
+*swig_e_callback_get = *freeswitchc::EventConsumer_e_callback_get;
+*swig_e_callback_set = *freeswitchc::EventConsumer_e_callback_set;
+*swig_e_subclass_name_get = *freeswitchc::EventConsumer_e_subclass_name_get;
+*swig_e_subclass_name_set = *freeswitchc::EventConsumer_e_subclass_name_set;
+*swig_e_cb_arg_get = *freeswitchc::EventConsumer_e_cb_arg_get;
+*swig_e_cb_arg_set = *freeswitchc::EventConsumer_e_cb_arg_set;
+sub new {
+    my $pkg = shift;
+    my $self = freeswitchc::new_EventConsumer(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        freeswitchc::delete_EventConsumer($self);
+        delete $OWNER{$self};
+    }
+}
+
+*pop = *freeswitchc::EventConsumer_pop;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
 ############# Class : freeswitch::CoreSession ##############
 
 package freeswitch::CoreSession;
@@ -300,6 +391,12 @@
 *swig_cb_state_set = *freeswitchc::CoreSession_cb_state_set;
 *swig_hook_state_get = *freeswitchc::CoreSession_hook_state_get;
 *swig_hook_state_set = *freeswitchc::CoreSession_hook_state_set;
+*swig_uuid_get = *freeswitchc::CoreSession_uuid_get;
+*swig_uuid_set = *freeswitchc::CoreSession_uuid_set;
+*swig_tts_name_get = *freeswitchc::CoreSession_tts_name_get;
+*swig_tts_name_set = *freeswitchc::CoreSession_tts_name_set;
+*swig_voice_name_get = *freeswitchc::CoreSession_voice_name_get;
+*swig_voice_name_set = *freeswitchc::CoreSession_voice_name_set;
 *answer = *freeswitchc::CoreSession_answer;
 *preAnswer = *freeswitchc::CoreSession_preAnswer;
 *hangup = *freeswitchc::CoreSession_hangup;
@@ -322,11 +419,15 @@
 *read = *freeswitchc::CoreSession_read;
 *playAndGetDigits = *freeswitchc::CoreSession_playAndGetDigits;
 *streamFile = *freeswitchc::CoreSession_streamFile;
+*sleep = *freeswitchc::CoreSession_sleep;
 *flushEvents = *freeswitchc::CoreSession_flushEvents;
 *flushDigits = *freeswitchc::CoreSession_flushDigits;
 *setAutoHangup = *freeswitchc::CoreSession_setAutoHangup;
 *setHangupHook = *freeswitchc::CoreSession_setHangupHook;
 *ready = *freeswitchc::CoreSession_ready;
+*answered = *freeswitchc::CoreSession_answered;
+*mediaReady = *freeswitchc::CoreSession_mediaReady;
+*waitForAnswer = *freeswitchc::CoreSession_waitForAnswer;
 *execute = *freeswitchc::CoreSession_execute;
 *sendEvent = *freeswitchc::CoreSession_sendEvent;
 *setEventData = *freeswitchc::CoreSession_setEventData;
@@ -378,9 +479,12 @@
 *end_allow_threads = *freeswitchc::Session_end_allow_threads;
 *check_hangup_hook = *freeswitchc::Session_check_hangup_hook;
 *run_dtmf_callback = *freeswitchc::Session_run_dtmf_callback;
+*setME = *freeswitchc::Session_setME;
 *setInputCallback = *freeswitchc::Session_setInputCallback;
 *setHangupHook = *freeswitchc::Session_setHangupHook;
 *ready = *freeswitchc::Session_ready;
+*swig_suuid_get = *freeswitchc::Session_suuid_get;
+*swig_suuid_set = *freeswitchc::Session_suuid_set;
 *swig_cb_function_get = *freeswitchc::Session_cb_function_get;
 *swig_cb_function_set = *freeswitchc::Session_cb_function_set;
 *swig_cb_arg_get = *freeswitchc::Session_cb_arg_get;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.cpp	Mon Aug  4 21:29:58 2008
@@ -13,14 +13,35 @@
 	init_me();
 }
 
-Session::Session(char *uuid):CoreSession(uuid)
+Session::Session(char *uuid, CoreSession *a_leg):CoreSession(uuid, a_leg)
 {
 	init_me();
+	if (session && allocated) {
+		suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session));
+		for (char *p = suuid; p && *p; p++) {
+			if (*p == '-') {
+				*p = '_';
+			}
+			if (*p == '\n') {
+				*p = '\0';
+			}
+		}
+	}
 }
 
 Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
 {
 	init_me();
+	if (session) {
+		suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session));
+		for (char *p = suuid; p && *p; p++) {
+			if (*p == '-') {
+				*p = '_';
+			}
+		}
+	} else {
+		//handle failure
+	}
 }
 static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup);
 Session::~Session()
@@ -51,9 +72,17 @@
 
 void Session::setPERL(PerlInterpreter * pi)
 {
+	sanity_check_noreturn;
 	my_perl = pi;
 }
 
+void Session::setME(SV *p)
+{
+	sanity_check_noreturn;
+
+	me = p;
+}
+
 PerlInterpreter *Session::getPERL()
 {
 	if (!my_perl) {
@@ -92,13 +121,13 @@
 		}
 
 		if (hangup_func_arg) {
-			code = switch_mprintf("%s(%s,%s)", hangup_func_str, hook_state == CS_HANGUP ? "hangup" : "transfer", hangup_func_arg);
-		} else {
-			code = switch_mprintf("%s(%s)", hangup_func_str, hook_state == CS_HANGUP ? "hangup" : "transfer");
-		}
+            code = switch_mprintf("%s($%s,\"%s\",%s)", hangup_func_str, suuid, hook_state == CS_HANGUP ? "hangup" : "transfer", hangup_func_arg);
+        } else {
+            code = switch_mprintf("%s($%s,\"%s\")", hangup_func_str, suuid, hook_state == CS_HANGUP ? "hangup" : "transfer");
+        }
 
-		Perl_eval_pv(my_perl, code, TRUE);
-		free(code);
+        Perl_eval_pv(my_perl, code, TRUE);
+        free(code);
 	}
 }
 
@@ -189,7 +218,7 @@
 			sv_setpv(this_sv, str);
 			hv_store(hash, "duration", 8, this_sv, 0);
 
-			code = switch_mprintf("$__RV = %s('dtmf', \\%%__dtmf, %s);", cb_function, switch_str_nil(cb_arg));
+			code = switch_mprintf("$__RV = %s($%s, 'dtmf', \\%%__dtmf, %s);", cb_function, suuid, switch_str_nil(cb_arg));
 			Perl_eval_pv(my_perl, code, FALSE);
 			free(code);
 
@@ -204,7 +233,7 @@
 
 			mod_perl_conjure_event(my_perl, event, "__Input_Event__");
 
-			code = switch_mprintf("$__RV = %s('event', $__Input_Event__, %s);", cb_function, switch_str_nil(cb_arg));
+			code = switch_mprintf("$__RV = %s($%s, 'event', $__Input_Event__, %s);", cb_function, suuid, switch_str_nil(cb_arg));
 			Perl_eval_pv(my_perl, code, TRUE);
 			free(code);
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.h	Mon Aug  4 21:29:58 2008
@@ -25,9 +25,10 @@
 	PerlInterpreter *my_perl;
 	int hh;
 	int mark;
+	SV *me;
  public:
     Session();
-    Session(char *uuid);
+    Session(char *uuid, CoreSession *a_leg = NULL);
     Session(switch_core_session_t *session);
     ~Session();        
 	
@@ -36,10 +37,11 @@
 	virtual void check_hangup_hook();
 
 	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
-	void setInputCallback(char *cbfunc, char *funcargs);
+	void setME(SV *p);
+	void setInputCallback(char *cbfunc = "on_input", char *funcargs = NULL);
 	void setHangupHook(char *func, char *arg=NULL);
 	bool ready();
-	
+	char *suuid;
 	char *cb_function;
 	char *cb_arg;
 	char *hangup_func_str;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/hack.diff
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/hack.diff	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/hack.diff	Mon Aug  4 21:29:58 2008
@@ -1,29 +1,109 @@
---- mod_perl_wrap2.cpp	2008-05-11 20:28:24.000000000 -0400
-+++ mod_perl_wrap.cpp	2008-05-11 20:26:06.000000000 -0400
-@@ -6754,7 +6754,7 @@
+--- mod_perl_wrap.cpp	2008-07-16 16:55:53.000000000 -0400
++++ old.cpp	2008-07-16 16:55:38.000000000 -0400
+@@ -8852,13 +8852,18 @@
+   {
+     PERL::Session *result = 0 ;
+     int argvi = 0;
++    SV *foo;
+     dXSARGS;
+-    
++
      if ((items < 0) || (items > 0)) {
        SWIG_croak("Usage: new_Session();");
      }
--    result = (PERL::Session *)new PERL::Session(); result->setPERL(my_perl);
-+    result = (PERL::Session *)new PERL::Session();
-     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+-    result = (PERL::Session *)new PERL::Session();
+-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
++    result = (PERL::Session *)new PERL::Session(); 
++	result->setPERL(my_perl);
++	foo = sv_newmortal();
++	SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++	result->setME(foo);	
++	ST(argvi) = foo; argvi++ ;
      XSRETURN(argvi);
    fail:
-@@ -6781,7 +6781,7 @@
+     SWIG_croak_null();
+@@ -8877,6 +8882,7 @@
+     void *argp2 = 0 ;
+     int res2 = 0 ;
+     int argvi = 0;
++	SV *foo;
+     dXSARGS;
+     
+     if ((items < 2) || (items > 2)) {
+@@ -8893,7 +8899,16 @@
+     }
+     arg2 = reinterpret_cast< CoreSession * >(argp2);
+     result = (PERL::Session *)new PERL::Session(arg1,arg2);
+-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
++	if (result->allocated) {
++		result->setPERL(my_perl);
++		foo = get_sv(result->suuid, TRUE);
++		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++		result->setME(foo);	
++	} else {
++		foo = sv_newmortal();
++		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++	}
++	ST(argvi) = foo; argvi++ ;
+     if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+     
+     XSRETURN(argvi);
+@@ -8913,6 +8928,7 @@
+     char *buf1 = 0 ;
+     int alloc1 = 0 ;
+     int argvi = 0;
++	SV *foo;
+     dXSARGS;
+     
+     if ((items < 1) || (items > 1)) {
+@@ -8923,9 +8939,19 @@
        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
      }
      arg1 = reinterpret_cast< char * >(buf1);
--    result = (PERL::Session *)new PERL::Session(arg1); result->setPERL(my_perl);
-+    result = (PERL::Session *)new PERL::Session(arg1);
-     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+-    result = (PERL::Session *)new PERL::Session(arg1);
+-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
++    result = (PERL::Session *)new PERL::Session(arg1); 
++	if (result->allocated) {
++		result->setPERL(my_perl);
++		foo = get_sv(result->suuid, TRUE);
++		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++		result->setME(foo);	
++	} else {
++		foo = sv_newmortal();
++		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++	}
++	ST(argvi) = foo; argvi++ ;
      if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
++
      XSRETURN(argvi);
-@@ -6809,7 +6809,7 @@
-       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
+   fail:
+     if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+@@ -8941,6 +8967,7 @@
+     void *argp1 = 0 ;
+     int res1 = 0 ;
+     int argvi = 0;
++    SV *foo;
+     dXSARGS;
+     
+     if ((items < 1) || (items > 1)) {
+@@ -8952,8 +8979,18 @@
      }
      arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
--    result = (PERL::Session *)new PERL::Session(arg1); result->setPERL(my_perl);
-+    result = (PERL::Session *)new PERL::Session(arg1);
-     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-     
+     result = (PERL::Session *)new PERL::Session(arg1);
+-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+-    
++	if (result->allocated) {
++		result->setPERL(my_perl);
++		foo = get_sv(result->suuid, TRUE);
++		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++		result->setME(foo);	
++	} else {
++		foo = sv_newmortal();
++		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++	}
++
++	ST(argvi) = foo; argvi++ ;
++	
      XSRETURN(argvi);
+   fail:
+     

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c	Mon Aug  4 21:29:58 2008
@@ -54,6 +54,7 @@
 	PerlInterpreter *my_perl;
 	switch_memory_pool_t *pool;
 	char *xml_handler;
+	switch_event_node_t *node;
 } globals;
 
 
@@ -139,8 +140,11 @@
 	return error;
 }
 
+#define HACK_CLEAN_CODE "foreach my $kl(keys %main::) {undef($$kl) if (defined($$kl) && ($kl =~ /^\\w+[\\w\\d_]+$/))}"
+
 static void destroy_perl(PerlInterpreter ** to_destroy)
 {
+	Perl_safe_eval(*to_destroy, HACK_CLEAN_CODE);
 	perl_destruct(*to_destroy);
 	perl_free(*to_destroy);
 	*to_destroy = NULL;
@@ -189,14 +193,20 @@
 }
 #endif
 
+
+
+
+
+
+
+
 static void perl_function(switch_core_session_t *session, char *data)
 {
 	char *uuid = switch_core_session_get_uuid(session);
 	PerlInterpreter *my_perl = clone_perl();
-	char code[1024];
+	char code[1024] = "";
 
 	perl_parse(my_perl, xs_init, 3, embedding, NULL);
-	Perl_safe_eval(my_perl, code);
 
 	switch_snprintf(code, sizeof(code),
 					"use lib '%s/perl';\n"
@@ -204,8 +214,6 @@
 					"$SWITCH_ENV{UUID} = \"%s\";\n" "$session = new freeswitch::Session(\"%s\")", SWITCH_GLOBAL_dirs.base_dir, uuid, uuid);
 
 	perl_parse_and_execute(my_perl, data, code);
-	Perl_safe_eval(my_perl, "undef $session;");
-	Perl_safe_eval(my_perl, "undef (*);");
 	destroy_perl(&my_perl);
 }
 
@@ -264,12 +272,6 @@
 		perl_parse_and_execute(my_perl, cmd, NULL);
 	}
 
-	if (uuid) {
-		switch_snprintf(code, sizeof(code), "undef $session;", uuid);
-		Perl_safe_eval(my_perl, code);
-	}
-
-	Perl_safe_eval(my_perl, "undef(*);");
 	destroy_perl(&my_perl);
 
 	switch_safe_free(cmd);
@@ -277,7 +279,7 @@
 	if (po->d) {
 		free(po);
 	}
-
+	
 	return NULL;
 }
 
@@ -427,6 +429,26 @@
 	return xml;
 }
 
+static void message_query_handler(switch_event_t *event)
+{
+	char *account = switch_event_get_header(event, "message-account");
+	
+	if (account) {
+		char *path, *cmd;
+
+		path = switch_mprintf("%s%smwi.pl", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
+		switch_assert(path != NULL);
+
+		if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
+			cmd = switch_mprintf("%s %s", path, account);
+			switch_assert(cmd != NULL);
+			perl_thread(cmd);
+			switch_safe_free(cmd);
+		}
+		switch_safe_free(path);
+	}
+}
+
 static switch_status_t do_config(void)
 {
 	char *cf = "perl.conf";
@@ -449,6 +471,10 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, var);
 					switch_xml_bind_search_function(perl_fetch, switch_xml_parse_section_string(val), NULL);
 				}
+			} else if (!strcmp(var, "startup-script")) {
+				if (val) {
+					perl_thread(val);
+				}
 			}
 		}
 	}
@@ -467,10 +493,17 @@
 
 	globals.pool = pool;
 
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL, &globals.node)
+		!= SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
 	if (!(my_perl = perl_alloc())) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate perl intrepreter\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate perl interpreter\n");
 		return SWITCH_STATUS_MEMERR;
 	}
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Allocated perl intrepreter.\n");
 
 	perl_construct(my_perl);

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp	Mon Aug  4 21:29:58 2008
@@ -12,35 +12,22 @@
 #define SWIG_CASTRANK_MODE
 
 #ifdef __cplusplus
-template < typename T > class SwigValueWrapper {
-	T *tt;
-  public:
-  SwigValueWrapper():tt(0) {
-	}
-	SwigValueWrapper(const SwigValueWrapper < T > &rhs):tt(new T(*rhs.tt)) {
-	}
-	SwigValueWrapper(const T & t):tt(new T(t)) {
-	}
-	~SwigValueWrapper() {
-		delete tt;
-	}
-	SwigValueWrapper & operator=(const T & t) {
-		delete tt;
-		tt = new T(t);
-		return *this;
-	}
-	operator  T & () const {
-		return *tt;
-	} T *operator&() {
-		return tt;
-	}
-  private:
-	SwigValueWrapper & operator=(const SwigValueWrapper < T > &rhs);
+template<typename T> class SwigValueWrapper {
+    T *tt;
+public:
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
 };
 
-template < typename T > T SwigValueInit()
-{
-	return T();
+template <typename T> T SwigValueInit() {
+  return T();
 }
 #endif
 
@@ -75,14 +62,14 @@
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__))
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
 # else
-#   define SWIGUNUSED
+#   define SWIGUNUSED 
 # endif
 #endif
 
@@ -90,7 +77,7 @@
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
 # endif
 #endif
 
@@ -133,7 +120,7 @@
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif
+# endif 
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -277,10 +264,10 @@
 
 
  */
-#define SWIG_OK                    (0)
+#define SWIG_OK                    (0) 
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
 
 /* The CastRankLimit says how many bits are used for the cast rank */
 #define SWIG_CASTRANKLIMIT         (1 << 8)
@@ -307,18 +294,16 @@
 #  ifndef SWIG_TypeRank
 #    define SWIG_TypeRank             unsigned long
 #  endif
-#  ifndef SWIG_MAXCASTRANK		/* Default cast allowed */
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
 #    define SWIG_MAXCASTRANK          (2)
 #  endif
 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r)
-{
-	return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 }
-SWIGINTERNINLINE int SWIG_CheckState(int r)
-{
-	return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
 }
 #else /* no cast-rank mode */
 #  define SWIG_AddCast
@@ -334,38 +319,38 @@
 extern "C" {
 #endif
 
-	typedef void *(*swig_converter_func) (void *, int *);
-	typedef struct swig_type_info *(*swig_dycast_func) (void **);
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
 /* Structure to store information on one type */
-	typedef struct swig_type_info {
-		const char *name;		/* mangled name of this type */
-		const char *str;		/* human readable name of this type */
-		swig_dycast_func dcast;	/* dynamic cast function down a hierarchy */
-		struct swig_cast_info *cast;	/* linked list of types that can cast into this type */
-		void *clientdata;		/* language specific type data */
-		int owndata;			/* flag if the structure owns the clientdata */
-	} swig_type_info;
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
 
 /* Structure to store a type and conversion function used for casting */
-	typedef struct swig_cast_info {
-		swig_type_info *type;	/* pointer to type that is equivalent to this type */
-		swig_converter_func converter;	/* function to cast the void pointers */
-		struct swig_cast_info *next;	/* pointer to next cast in linked list */
-		struct swig_cast_info *prev;	/* pointer to the previous cast */
-	} swig_cast_info;
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
 
 /* Structure used to store module information
  * Each module generates one structure like this, and the runtime collects
  * all of these structures and stores them in a circularly linked list.*/
-	typedef struct swig_module_info {
-		swig_type_info **types;	/* Array of pointers to swig_type_info structures that are in this module */
-		size_t size;			/* Number of types in this module */
-		struct swig_module_info *next;	/* Pointer to next element in circularly linked list */
-		swig_type_info **type_initial;	/* Array of initially generated type structures */
-		swig_cast_info **cast_initial;	/* Array of initially generated casting structures */
-		void *clientdata;		/* Language specific module data */
-	} swig_module_info;
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
 
 /* 
   Compare two type names skipping the space characters, therefore
@@ -374,56 +359,54 @@
   Return 0 when the two name types are equivalent, as in
   strncmp, but skipping ' '.
 */
-	SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) {
-		for (; (f1 != l1) && (f2 != l2); ++f1, ++f2) {
-			while ((*f1 == ' ') && (f1 != l1))
-				++f1;
-			while ((*f2 == ' ') && (f2 != l2))
-				++f2;
-			if (*f1 != *f2)
-				return (*f1 > *f2) ? 1 : -1;
-		} return (int) ((l1 - f1) - (l2 - f2));
-	}
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if not equal, 1 if equal
 */
-	SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) {
-		int equiv = 0;
-		const char *te = tb + strlen(tb);
-		const char *ne = nb;
-		while (!equiv && *ne) {
-			for (nb = ne; *ne; ++ne) {
-				if (*ne == '|')
-					break;
-			}
-			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-			if (*ne)
-				++ne;
-		}
-		return equiv;
-	}
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 */
-	SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) {
-		int equiv = 0;
-		const char *te = tb + strlen(tb);
-		const char *ne = nb;
-		while (!equiv && *ne) {
-			for (nb = ne; *ne; ++ne) {
-				if (*ne == '|')
-					break;
-			}
-			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-			if (*ne)
-				++ne;
-		}
-		return equiv;
-	}
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
 
 
 /* think of this as a c++ template<> or a scheme macro */
@@ -451,89 +434,94 @@
 /*
   Check the typename
 */
-	SWIGRUNTIME swig_cast_info *SWIG_TypeCheck(const char *c, swig_type_info * ty) {
-		SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-	}
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
 
 /* Same as previous function, except strcmp is replaced with a pointer comparison */
-	SWIGRUNTIME swig_cast_info *SWIG_TypeCheckStruct(swig_type_info * from, swig_type_info * into) {
-		SWIG_TypeCheck_Template(iter->type == from, into);
-	}
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
 
 /*
   Cast a pointer up an inheritance hierarchy
 */
-	SWIGRUNTIMEINLINE void *SWIG_TypeCast(swig_cast_info * ty, void *ptr, int *newmemory) {
-		return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter) (ptr, newmemory);
-	}
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
 
 /* 
    Dynamic pointer casting. Down an inheritance hierarchy
 */
-	SWIGRUNTIME swig_type_info *SWIG_TypeDynamicCast(swig_type_info * ty, void **ptr) {
-		swig_type_info *lastty = ty;
-		if (!ty || !ty->dcast)
-			return ty;
-		while (ty && (ty->dcast)) {
-			ty = (*ty->dcast) (ptr);
-			if (ty)
-				lastty = ty;
-		}
-		return lastty;
-	}
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
 
 /*
   Return the name associated with this type
 */
-	SWIGRUNTIMEINLINE const char *SWIG_TypeName(const swig_type_info * ty) {
-		return ty->name;
-	}
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
 
 /*
   Return the pretty name associated with this type,
   that is an unmangled type name in a form presentable to the user.
 */
-	SWIGRUNTIME const char *SWIG_TypePrettyName(const swig_type_info * type) {
-		/* The "str" field contains the equivalent pretty names of the
-		   type, separated by vertical-bar characters.  We choose
-		   to print the last name, as it is often (?) the most
-		   specific. */
-		if (!type)
-			return NULL;
-		if (type->str != NULL) {
-			const char *last_name = type->str;
-			const char *s;
-			for (s = type->str; *s; s++)
-				if (*s == '|')
-					last_name = s + 1;
-			return last_name;
-		} else
-			return type->name;
-	}
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
 
 /* 
    Set the clientdata field for a type
 */
-	SWIGRUNTIME void SWIG_TypeClientData(swig_type_info * ti, void *clientdata) {
-		swig_cast_info *cast = ti->cast;
-		/* if (ti->clientdata == clientdata) return; */
-		ti->clientdata = clientdata;
-
-		while (cast) {
-			if (!cast->converter) {
-				swig_type_info *tc = cast->type;
-				if (!tc->clientdata) {
-					SWIG_TypeClientData(tc, clientdata);
-				}
-			}
-			cast = cast->next;
-		}
-	}
-	SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info * ti, void *clientdata) {
-		SWIG_TypeClientData(ti, clientdata);
-		ti->owndata = 1;
-	}
-
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
 /*
   Search for a swig_type_info structure only by mangled name
   Search is a O(log #types)
@@ -542,38 +530,41 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-	SWIGRUNTIME swig_type_info *SWIG_MangledTypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
-		swig_module_info *iter = start;
-		do {
-			if (iter->size) {
-				register size_t l = 0;
-				register size_t r = iter->size - 1;
-				do {
-					/* since l+r >= 0, we can (>> 1) instead (/ 2) */
-					register size_t i = (l + r) >> 1;
-					const char *iname = iter->types[i]->name;
-					if (iname) {
-						register int compare = strcmp(name, iname);
-						if (compare == 0) {
-							return iter->types[i];
-						} else if (compare < 0) {
-							if (i) {
-								r = i - 1;
-							} else {
-								break;
-							}
-						} else if (compare > 0) {
-							l = i + 1;
-						}
-					} else {
-						break;	/* should never happen */
-					}
-				} while (l <= r);
-			}
-			iter = iter->next;
-		} while (iter != end);
-		return 0;
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1; 
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {	    
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
 	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
 
 /*
   Search for a swig_type_info structure for either a mangled name or a human readable name.
@@ -584,142 +575,148 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-	SWIGRUNTIME swig_type_info *SWIG_TypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
-		/* STEP 1: Search the name field using binary search */
-		swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
-		if (ret) {
-			return ret;
-		} else {
-			/* STEP 2: If the type hasn't been found, do a complete search
-			   of the str field (the human readable name) */
-			swig_module_info *iter = start;
-			do {
-				register size_t i = 0;
-				for (; i < iter->size; ++i) {
-					if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
-						return iter->types[i];
-				}
-				iter = iter->next;
-			} while (iter != end);
-		}
-
-		/* neither found a match */
-		return 0;
-	}
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
 
 /* 
    Pack binary data into a string
 */
-	SWIGRUNTIME char *SWIG_PackData(char *c, void *ptr, size_t sz) {
-		static const char hex[17] = "0123456789abcdef";
-		register const unsigned char *u = (unsigned char *) ptr;
-		register const unsigned char *eu = u + sz;
-		for (; u != eu; ++u) {
-			register unsigned char uu = *u;
-			*(c++) = hex[(uu & 0xf0) >> 4];
-			*(c++) = hex[uu & 0xf];
-		}
-		return c;
-	}
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
 
 /* 
    Unpack binary data from a string
 */
-	SWIGRUNTIME const char *SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
-		register unsigned char *u = (unsigned char *) ptr;
-		register const unsigned char *eu = u + sz;
-		for (; u != eu; ++u) {
-			register char d = *(c++);
-			register unsigned char uu;
-			if ((d >= '0') && (d <= '9'))
-				uu = ((d - '0') << 4);
-			else if ((d >= 'a') && (d <= 'f'))
-				uu = ((d - ('a' - 10)) << 4);
-			else
-				return (char *) 0;
-			d = *(c++);
-			if ((d >= '0') && (d <= '9'))
-				uu |= (d - '0');
-			else if ((d >= 'a') && (d <= 'f'))
-				uu |= (d - ('a' - 10));
-			else
-				return (char *) 0;
-			*u = uu;
-		}
-		return c;
-	}
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
 
 /* 
    Pack 'void *' into a string buffer.
 */
-	SWIGRUNTIME char *SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
-		char *r = buff;
-		if ((2 * sizeof(void *) + 2) > bsz)
-			return 0;
-		*(r++) = '_';
-		r = SWIG_PackData(r, &ptr, sizeof(void *));
-		if (strlen(name) + 1 > (bsz - (r - buff)))
-			return 0;
-		strcpy(r, name);
-		return buff;
-	}
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
 
-	SWIGRUNTIME const char *SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
-		if (*c != '_') {
-			if (strcmp(c, "NULL") == 0) {
-				*ptr = (void *) 0;
-				return name;
-			} else {
-				return 0;
-			}
-		}
-		return SWIG_UnpackData(++c, ptr, sizeof(void *));
-	}
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
 
-	SWIGRUNTIME char *SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
-		char *r = buff;
-		size_t lname = (name ? strlen(name) : 0);
-		if ((2 * sz + 2 + lname) > bsz)
-			return 0;
-		*(r++) = '_';
-		r = SWIG_PackData(r, ptr, sz);
-		if (lname) {
-			strncpy(r, name, lname + 1);
-		} else {
-			*r = 0;
-		}
-		return buff;
-	}
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
 
-	SWIGRUNTIME const char *SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
-		if (*c != '_') {
-			if (strcmp(c, "NULL") == 0) {
-				memset(ptr, 0, sz);
-				return name;
-			} else {
-				return 0;
-			}
-		}
-		return SWIG_UnpackData(++c, ptr, sz);
-	}
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
 
 #ifdef __cplusplus
 }
 #endif
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1
-#define  SWIG_IOError        	   -2
-#define  SWIG_RuntimeError   	   -3
-#define  SWIG_IndexError     	   -4
-#define  SWIG_TypeError      	   -5
-#define  SWIG_DivisionByZero 	   -6
-#define  SWIG_OverflowError  	   -7
-#define  SWIG_SyntaxError    	   -8
-#define  SWIG_ValueError     	   -9
+#define  SWIG_UnknownError    	   -1 
+#define  SWIG_IOError        	   -2 
+#define  SWIG_RuntimeError   	   -3 
+#define  SWIG_IndexError     	   -4 
+#define  SWIG_TypeError      	   -5 
+#define  SWIG_DivisionByZero 	   -6 
+#define  SWIG_OverflowError  	   -7 
+#define  SWIG_SyntaxError    	   -8 
+#define  SWIG_ValueError     	   -9 
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12
+#define  SWIG_MemoryError    	   -12 
 #define  SWIG_NullReferenceError   -13
 
 
@@ -777,7 +774,7 @@
 #  ifdef LONGSIZE
 #    define IVSIZE LONGSIZE
 #  else
-#    define IVSIZE 4			/* A bold guess, but the best we can make. */
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
 #  endif
 #endif
 
@@ -804,7 +801,7 @@
 #  else
 #    define PTR2ul(p)     INT2PTR(unsigned long,p)
 #  endif
-#endif							/* !INT2PTR */
+#endif /* !INT2PTR */
 
 #ifndef SvPV_nolen
 # define SvPV_nolen(x) SvPV(x,PL_na)
@@ -820,56 +817,58 @@
 
 #ifndef pTHX_
 #define pTHX_
-#endif
+#endif   
 
 #include <string.h>
 #ifdef __cplusplus
 }
 #endif
+
 /* -----------------------------------------------------------------------------
  * error manipulation
- * ----------------------------------------------------------------------------- */ SWIGINTERN const char *
-SWIG_Perl_ErrorType(int code)
-{
-	const char *type = 0;
-	switch (code) {
-	case SWIG_MemoryError:
-		type = "MemoryError";
-		break;
-	case SWIG_IOError:
-		type = "IOError";
-		break;
-	case SWIG_RuntimeError:
-		type = "RuntimeError";
-		break;
-	case SWIG_IndexError:
-		type = "IndexError";
-		break;
-	case SWIG_TypeError:
-		type = "TypeError";
-		break;
-	case SWIG_DivisionByZero:
-		type = "ZeroDivisionError";
-		break;
-	case SWIG_OverflowError:
-		type = "OverflowError";
-		break;
-	case SWIG_SyntaxError:
-		type = "SyntaxError";
-		break;
-	case SWIG_ValueError:
-		type = "ValueError";
-		break;
-	case SWIG_SystemError:
-		type = "SystemError";
-		break;
-	case SWIG_AttributeError:
-		type = "AttributeError";
-		break;
-	default:
-		type = "RuntimeError";
-	}
-	return type;
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  const char* type = 0;
+  switch(code) {
+  case SWIG_MemoryError:
+    type = "MemoryError";
+    break;
+  case SWIG_IOError:
+    type = "IOError";
+    break;
+  case SWIG_RuntimeError:
+    type = "RuntimeError";
+    break;
+  case SWIG_IndexError:
+    type = "IndexError";
+    break;
+  case SWIG_TypeError:
+    type = "TypeError";
+    break;
+  case SWIG_DivisionByZero:
+    type = "ZeroDivisionError";
+    break;
+  case SWIG_OverflowError:
+    type = "OverflowError";
+    break;
+  case SWIG_SyntaxError:
+    type = "SyntaxError";
+    break;
+  case SWIG_ValueError:
+    type = "ValueError";
+    break;
+  case SWIG_SystemError:
+    type = "SystemError";
+    break;
+  case SWIG_AttributeError:
+    type = "AttributeError";
+    break;
+  default:
+    type = "RuntimeError";
+  }
+  return type;
 }
 
 
@@ -922,9 +921,9 @@
 
 /* Error manipulation */
 
-#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
 #define SWIG_Error(code, msg)            		sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
-#define SWIG_fail                        		goto fail
+#define SWIG_fail                        		goto fail						    
 
 /* Perl-specific SWIG API */
 
@@ -962,29 +961,31 @@
 #endif
 
 /* Macro to call an XS function */
-#ifdef PERL_OBJECT
-#  define SWIG_CALLXS(_name) _name(cv,pPerl)
-#else
-#  ifndef MULTIPLICITY
-#    define SWIG_CALLXS(_name) _name(cv)
-#  else
-#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
-#  endif
-#endif
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
 
 #ifdef PERL_OBJECT
 #define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
 
 #ifdef __cplusplus
-	extern "C" {
+extern "C" {
 #endif
-		typedef int (CPerlObj::*SwigMagicFunc) (SV *, MAGIC *);
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
 #ifdef __cplusplus
-	}
+}
 #endif
+
 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
 #define SWIGCLASS_STATIC
-#else							/* PERL_OBJECT */
+
+#else /* PERL_OBJECT */
 
 #define MAGIC_PPERL
 #define SWIGCLASS_STATIC static SWIGUNUSED
@@ -993,46 +994,50 @@
 #define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
 
 #ifdef __cplusplus
-	extern "C" {
+extern "C" {
 #endif
-		typedef int (*SwigMagicFunc) (SV *, MAGIC *);
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
 #ifdef __cplusplus
-	}
+}
 #endif
-#else							/* MULTIPLICITY */
+
+#else /* MULTIPLICITY */
 
 #define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
 
 #ifdef __cplusplus
-	extern "C" {
+extern "C" {
 #endif
-		typedef int (*SwigMagicFunc) (struct interpreter *, SV *, MAGIC *);
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
 #ifdef __cplusplus
-	}
+}
 #endif
-#endif							/* MULTIPLICITY */
-#endif							/* PERL_OBJECT */
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
 /* Workaround for bug in perl 5.6.x croak and earlier */
 #if (PERL_VERSION < 8)
 #  ifdef PERL_OBJECT
 #    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
-	static void SWIG_Perl_croak_null(CPerlObj * pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
 #  else
-	static void SWIG_croak_null()
+static void SWIG_croak_null()
 #  endif
-	{
-		SV *err = ERRSV;
+{
+  SV *err=ERRSV;
 #  if (PERL_VERSION < 6)
-		   croak("%_", err);
+  croak("%_", err);
 #  else
-		if (SvOK(err) && !SvROK(err))
-			   croak("%_", err);
-		   croak(Nullch);
+  if (SvOK(err) && !SvROK(err)) croak("%_", err);
+  croak(Nullch);
 #  endif
-	}
+}
 #else
 #  define SWIG_croak_null() croak(Nullch)
 #endif
+
+
 /* 
    Define how strict is the cast between strings and integers/doubles
    when overloading between these types occurs.
@@ -1055,201 +1060,206 @@
 #endif
 #ifdef SWIG_PERL_STRICT_STR2NUM
 /* string takes precedence */
-#define SWIG_Str2NumCast(x) SWIG_AddCast(x)
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
 #else
 /* number takes precedence */
 #define SWIG_Str2NumCast(x) x
 #endif
+
+
+
 #include <stdlib.h>
-	SWIGRUNTIME const char *SWIG_Perl_TypeProxyName(const swig_type_info * type) {
-		if (!type)
-			return NULL;
-		if (type->clientdata != NULL) {
-			return (const char *) type->clientdata;
-		} else {
-			return type->name;
-		}
-	}
 
-	SWIGRUNTIME swig_cast_info *SWIG_TypeProxyCheck(const char *c, swig_type_info * ty) {
-		SWIG_TypeCheck_Template(((!iter->type->clientdata && (strcmp(iter->type->name, c) == 0))
-								 || (iter->type->clientdata && (strcmp((char *) iter->type->clientdata, c) == 0))), ty);
-	}
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
+			    || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
+}
 
 
 /* Function for getting a pointer value */
 
-	SWIGRUNTIME int
-	    SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV * sv, void **ptr, swig_type_info * _t, int flags) {
-		swig_cast_info *tc;
-		void *voidptr = (void *) 0;
-		SV *tsv = 0;
-		/* If magical, apply more magic */
-		if (SvGMAGICAL(sv))
-			mg_get(sv);
-
-		/* Check to see if this is an object */
-		if (sv_isobject(sv)) {
-			IV tmp = 0;
-			tsv = (SV *) SvRV(sv);
-			if ((SvTYPE(tsv) == SVt_PVHV)) {
-				MAGIC *mg;
-				if (SvMAGICAL(tsv)) {
-					mg = mg_find(tsv, 'P');
-					if (mg) {
-						sv = mg->mg_obj;
-						if (sv_isobject(sv)) {
-							tsv = (SV *) SvRV(sv);
-							tmp = SvIV(tsv);
-						}
-					}
-				} else {
-					return SWIG_ERROR;
-				}
-			} else {
-				tmp = SvIV(tsv);
-			}
-			voidptr = INT2PTR(void *, tmp);
-		} else if (!SvOK(sv)) {	/* Check for undef */
-			*(ptr) = (void *) 0;
-			return SWIG_OK;
-		} else if (SvTYPE(sv) == SVt_RV) {	/* Check for NULL pointer */
-			if (!SvROK(sv)) {
-				*(ptr) = (void *) 0;
-				return SWIG_OK;
-			} else {
-				return SWIG_ERROR;
-			}
-		} else {				/* Don't know what it is */
-			return SWIG_ERROR;
-		}
-		if (_t) {
-			/* Now see if the types match */
-			char *_c = HvNAME(SvSTASH(SvRV(sv)));
-			tc = SWIG_TypeProxyCheck(_c, _t);
-			if (!tc) {
-				return SWIG_ERROR;
-			}
-			{
-				int newmemory = 0;
-				*ptr = SWIG_TypeCast(tc, voidptr, &newmemory);
-				assert(!newmemory);	/* newmemory handling not yet implemented */
-			}
-		} else {
-			*ptr = voidptr;
-		}
-
-		/* 
-		 *  DISOWN implementation: we need a perl guru to check this one.
-		 */
-		if (tsv && (flags & SWIG_POINTER_DISOWN)) {
-			/* 
-			 *  almost copy paste code from below SWIG_POINTER_OWN setting
-			 */
-			SV *obj = sv;
-			HV *stash = SvSTASH(SvRV(obj));
-			GV *gv = *(GV **) hv_fetch(stash, "OWNER", 5, TRUE);
-			if (isGV(gv)) {
-				HV *hv = GvHVn(gv);
-				/*
-				 * To set ownership (see below), a newSViv(1) entry is added. 
-				 * Hence, to remove ownership, we delete the entry.
-				 */
-				if (hv_exists_ent(hv, obj, 0)) {
-					hv_delete_ent(hv, obj, 0, 0);
-				}
-			}
-		}
-		return SWIG_OK;
-	}
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+	    tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      *(ptr) = (void *) 0;
+      return SWIG_OK;
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+	hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
 
-	SWIGRUNTIME void
-	     SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV * sv, void *ptr, swig_type_info * t, int flags) {
-		if (ptr && (flags & SWIG_SHADOW)) {
-			SV *self;
-			SV *obj = newSV(0);
-			HV *hash = newHV();
-			HV *stash;
-			sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
-			stash = SvSTASH(SvRV(obj));
-			if (flags & SWIG_POINTER_OWN) {
-				HV *hv;
-				GV *gv = *(GV **) hv_fetch(stash, "OWNER", 5, TRUE);
-				if (!isGV(gv))
-					gv_init(gv, stash, "OWNER", 5, FALSE);
-				hv = GvHVn(gv);
-				hv_store_ent(hv, obj, newSViv(1), 0);
-			}
-			sv_magic((SV *) hash, (SV *) obj, 'P', Nullch, 0);
-			SvREFCNT_dec(obj);
-			self = newRV_noinc((SV *) hash);
-			sv_setsv(sv, self);
-			SvREFCNT_dec((SV *) self);
-			sv_bless(sv, stash);
-		} else {
-			sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
-		}
-	}
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & SWIG_SHADOW)) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
 
-	SWIGRUNTIMEINLINE SV *SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info * t, int flags) {
-		SV *result = sv_newmortal();
-		SWIG_MakePtr(result, ptr, t, flags);
-		return result;
-	}
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
 
-	SWIGRUNTIME void
-	     SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV * sv, void *ptr, int sz, swig_type_info * type) {
-		char result[1024];
-		char *r = result;
-		if ((2 * sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000)
-			return;
-		*(r++) = '_';
-		r = SWIG_PackData(r, ptr, sz);
-		strcpy(r, SWIG_Perl_TypeProxyName(type));
-		sv_setpv(sv, result);
-	}
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
 
-	SWIGRUNTIME SV *SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info * type) {
-		SV *result = sv_newmortal();
-		SWIG_Perl_MakePackedObj(result, ptr, sz, type);
-		return result;
-	}
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
 
 /* Convert a packed value value */
-	SWIGRUNTIME int
-	    SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV * obj, void *ptr, int sz, swig_type_info * ty) {
-		swig_cast_info *tc;
-		const char *c = 0;
-
-		if ((!obj) || (!SvOK(obj)))
-			return SWIG_ERROR;
-		c = SvPV_nolen(obj);
-		/* Pointer values must start with leading underscore */
-		if (*c != '_')
-			return SWIG_ERROR;
-		c++;
-		c = SWIG_UnpackData(c, ptr, sz);
-		if (ty) {
-			tc = SWIG_TypeCheck(c, ty);
-			if (!tc)
-				return SWIG_ERROR;
-		}
-		return SWIG_OK;
-	}
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
 
 
 /* Macros for low-level exception handling */
 #define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
 
 
-	typedef XSPROTO(SwigPerlWrapper);
-	typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
 
 /* Structure for command table */
-	typedef struct {
-		const char *name;
-		SwigPerlWrapperPtr wrapper;
-	} swig_command_info;
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
 
 /* Information for constant table */
 
@@ -1260,74 +1270,73 @@
 #define SWIG_BINARY  5
 
 /* Constant information structure */
-	typedef struct swig_constant_info {
-		int type;
-		const char *name;
-		long lvalue;
-		double dvalue;
-		void *pvalue;
-		swig_type_info **ptype;
-	} swig_constant_info;
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
 
 
 /* Structure for variable table */
-	typedef struct {
-		const char *name;
-		SwigMagicFunc set;
-		SwigMagicFunc get;
-		swig_type_info **type;
-	} swig_variable_info;
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
 
 /* Magic variable code */
 #ifndef PERL_OBJECT
 #define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
-#ifndef MULTIPLICITY
-	SWIGRUNTIME void _swig_create_magic(SV * sv, char *name, int (*set) (SV *, MAGIC *), int (*get) (SV *, MAGIC *))
-#else
-	SWIGRUNTIME void _swig_create_magic(SV * sv, char *name, int (*set) (struct interpreter *, SV *, MAGIC *),
-										int (*get) (struct interpreter *, SV *, MAGIC *))
-#endif
+  #ifndef MULTIPLICITY
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+  #else
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+  #endif
 #else
 #  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
-	SWIGRUNTIME void _swig_create_magic(CPerlObj * pPerl, SV * sv, const char *name, int (CPerlObj::*set) (SV *, MAGIC *),
-										int (CPerlObj::*get) (SV *, MAGIC *))
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
 #endif
-	{
-		MAGIC *mg;
-		sv_magic(sv, sv, 'U', (char *) name, strlen(name));
-		mg = mg_find(sv, 'U');
-		mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
-		mg->mg_virtual->svt_get = (SwigMagicFunc) get;
-		mg->mg_virtual->svt_set = (SwigMagicFunc) set;
-		mg->mg_virtual->svt_len = 0;
-		mg->mg_virtual->svt_clear = 0;
-		mg->mg_virtual->svt_free = 0;
-	}
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',(char *) name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
 
 
-	SWIGRUNTIME swig_module_info *SWIG_Perl_GetModule(void) {
-		static void *type_pointer = (void *) 0;
-		SV *pointer;
-
-		/* first check if pointer already created */
-		if (!type_pointer) {
-			pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
-			if (pointer && SvOK(pointer)) {
-				type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
-			}
-		}
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
 
-		return (swig_module_info *) type_pointer;
-	}
+  return (swig_module_info *) type_pointer;
+}
 
-	SWIGRUNTIME void
-	     SWIG_Perl_SetModule(swig_module_info * module) {
-		SV *pointer;
-
-		/* create a new pointer */
-		pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
-		sv_setiv(pointer, PTR2IV(module));
-	}
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
 
 #ifdef __cplusplus
 }
@@ -1337,101 +1346,101 @@
  * functions like fopen will not solve the problem on all platforms as fopen
  * might be a macro on Windows but not necessarily on other operating systems. */
 #ifdef do_open
-#undef do_open
+  #undef do_open
 #endif
 #ifdef do_close
-#undef do_close
+  #undef do_close
 #endif
 #ifdef scalar
-#undef scalar
+  #undef scalar
 #endif
 #ifdef list
-#undef list
+  #undef list
 #endif
 #ifdef apply
-#undef apply
+  #undef apply
 #endif
 #ifdef convert
-#undef convert
+  #undef convert
 #endif
 #ifdef Error
-#undef Error
+  #undef Error
 #endif
 #ifdef form
-#undef form
+  #undef form
 #endif
 #ifdef vform
-#undef vform
+  #undef vform
 #endif
 #ifdef LABEL
-#undef LABEL
+  #undef LABEL
 #endif
 #ifdef METHOD
-#undef METHOD
+  #undef METHOD
 #endif
 #ifdef Move
-#undef Move
+  #undef Move
 #endif
 #ifdef yylex
-#undef yylex
+  #undef yylex
 #endif
 #ifdef yyparse
-#undef yyparse
+  #undef yyparse
 #endif
 #ifdef yyerror
-#undef yyerror
+  #undef yyerror
 #endif
 #ifdef invert
-#undef invert
+  #undef invert
 #endif
 #ifdef ref
-#undef ref
+  #undef ref
 #endif
 #ifdef read
-#undef read
+  #undef read
 #endif
 #ifdef write
-#undef write
+  #undef write
 #endif
 #ifdef eof
-#undef eof
+  #undef eof
 #endif
 #ifdef bool
-#undef bool
+  #undef bool
 #endif
 #ifdef close
-#undef close
+  #undef close
 #endif
 #ifdef rewind
-#undef rewind
+  #undef rewind
 #endif
 #ifdef free
-#undef free
+  #undef free
 #endif
 #ifdef malloc
-#undef malloc
+  #undef malloc
 #endif
 #ifdef calloc
-#undef calloc
+  #undef calloc
 #endif
 #ifdef Stat
-#undef Stat
+  #undef Stat
 #endif
 #ifdef check
-#undef check
+  #undef check
 #endif
 #ifdef seekdir
-#undef seekdir
+  #undef seekdir
 #endif
 #ifdef open
-#undef open
+  #undef open
 #endif
 
 
 
-#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
 
 
 
@@ -1439,27 +1448,32 @@
 
 #define SWIGTYPE_p_API swig_types[0]
 #define SWIGTYPE_p_CoreSession swig_types[1]
-#define SWIGTYPE_p_Event swig_types[2]
-#define SWIGTYPE_p_IVRMenu swig_types[3]
-#define SWIGTYPE_p_PERL__Session swig_types[4]
-#define SWIGTYPE_p_PerlInterpreter swig_types[5]
-#define SWIGTYPE_p_Stream swig_types[6]
-#define SWIGTYPE_p_char swig_types[7]
-#define SWIGTYPE_p_input_callback_state swig_types[8]
-#define SWIGTYPE_p_session_flag_t swig_types[9]
-#define SWIGTYPE_p_switch_channel_state_t swig_types[10]
-#define SWIGTYPE_p_switch_channel_t swig_types[11]
-#define SWIGTYPE_p_switch_core_session_t swig_types[12]
-#define SWIGTYPE_p_switch_event_t swig_types[13]
-#define SWIGTYPE_p_switch_input_args_t swig_types[14]
-#define SWIGTYPE_p_switch_input_type_t swig_types[15]
-#define SWIGTYPE_p_switch_priority_t swig_types[16]
-#define SWIGTYPE_p_switch_status_t swig_types[17]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[18]
-#define SWIGTYPE_p_void swig_types[19]
-static swig_type_info *swig_types[21];
-static swig_module_info swig_module = { swig_types, 20, 0, 0, 0, 0 };
-
+#define SWIGTYPE_p_DTMF swig_types[2]
+#define SWIGTYPE_p_Event swig_types[3]
+#define SWIGTYPE_p_EventConsumer swig_types[4]
+#define SWIGTYPE_p_IVRMenu swig_types[5]
+#define SWIGTYPE_p_PERL__Session swig_types[6]
+#define SWIGTYPE_p_PerlInterpreter swig_types[7]
+#define SWIGTYPE_p_Stream swig_types[8]
+#define SWIGTYPE_p_char swig_types[9]
+#define SWIGTYPE_p_input_callback_state swig_types[10]
+#define SWIGTYPE_p_session_flag_t swig_types[11]
+#define SWIGTYPE_p_switch_channel_state_t swig_types[12]
+#define SWIGTYPE_p_switch_channel_t swig_types[13]
+#define SWIGTYPE_p_switch_core_session_t swig_types[14]
+#define SWIGTYPE_p_switch_event_node_t swig_types[15]
+#define SWIGTYPE_p_switch_event_t swig_types[16]
+#define SWIGTYPE_p_switch_event_types_t swig_types[17]
+#define SWIGTYPE_p_switch_input_args_t swig_types[18]
+#define SWIGTYPE_p_switch_input_type_t swig_types[19]
+#define SWIGTYPE_p_switch_priority_t swig_types[20]
+#define SWIGTYPE_p_switch_queue_t swig_types[21]
+#define SWIGTYPE_p_switch_status_t swig_types[22]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[23]
+#define SWIGTYPE_p_uint32_t swig_types[24]
+#define SWIGTYPE_p_void swig_types[25]
+static swig_type_info *swig_types[27];
+static swig_module_info swig_module = {swig_types, 26, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -1470,12 +1484,12 @@
 #define SWIG_name   "freeswitchc::boot_freeswitch"
 #define SWIG_prefix "freeswitchc::"
 
-#define SWIGVERSION 0x010335
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
-#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
-#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
 
 
 #include <stdexcept>
@@ -1486,12 +1500,12 @@
 #endif
 #ifndef PERL_OBJECT
 #ifndef MULTIPLICITY
-       SWIGEXPORT void SWIG_init(CV * cv);
+SWIGEXPORT void SWIG_init (CV* cv);
 #else
-     SWIGEXPORT void SWIG_init(pTHXo_ CV * cv);
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
 #endif
 #else
-     SWIGEXPORT void SWIG_init(CV * cv, CPerlObj *);
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
 #endif
 
 
@@ -1499,53 +1513,51 @@
 #include "freeswitch_perl.h"
 
 
-SWIGINTERN swig_type_info *SWIG_pchar_descriptor(void)
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
 {
-	static int init = 0;
-	static swig_type_info *info = 0;
-	if (!init) {
-		info = SWIG_TypeQuery("_p_char");
-		init = 1;
-	}
-	return info;
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
 }
 
 
-SWIGINTERN int SWIG_AsCharPtrAndSize(SV * obj, char **cptr, size_t *psize, int *alloc)
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
 {
-	if (SvPOK(obj)) {
-		STRLEN len = 0;
-		char *cstr = SvPV(obj, len);
-		size_t size = len + 1;
-		if (cptr) {
-			if (alloc) {
-				if (*alloc == SWIG_NEWOBJ) {
-					*cptr = reinterpret_cast < char *>(memcpy((new char[size]), cstr, sizeof(char) * (size)));
-				} else {
-					*cptr = cstr;
-					*alloc = SWIG_OLDOBJ;
-				}
-			}
-		}
-		if (psize)
-			*psize = size;
-		return SWIG_OK;
+  if (SvPOK(obj)) {
+    STRLEN len = 0;
+    char *cstr = SvPV(obj, len); 
+    size_t size = len + 1;
+    if (cptr)  {
+      if (alloc) {
+	if (*alloc == SWIG_NEWOBJ) {
+	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
 	} else {
-		swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
-		if (pchar_descriptor) {
-			char *vptr = 0;
-			if (SWIG_ConvertPtr(obj, (void **) &vptr, pchar_descriptor, 0) == SWIG_OK) {
-				if (cptr)
-					*cptr = vptr;
-				if (psize)
-					*psize = vptr ? (strlen(vptr) + 1) : 0;
-				if (alloc)
-					*alloc = SWIG_OLDOBJ;
-				return SWIG_OK;
-			}
-		}
+	  *cptr = cstr;
+	  *alloc = SWIG_OLDOBJ;
 	}
-	return SWIG_TypeError;
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      char* vptr = 0; 
+      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
+	if (cptr) *cptr = vptr;
+	if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+	if (alloc) *alloc = SWIG_OLDOBJ;
+	return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
 }
 
 
@@ -1563,34 +1575,31 @@
 
 
 SWIGINTERN int
-SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV * obj, double *val)
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
 {
-	if (SvNIOK(obj)) {
-		if (val)
-			*val = SvNV(obj);
-		return SWIG_OK;
-	} else if (SvIOK(obj)) {
-		if (val)
-			*val = (double) SvIV(obj);
-		return SWIG_AddCast(SWIG_OK);
-	} else {
-		const char *nptr = SvPV_nolen(obj);
-		if (nptr) {
-			char *endptr;
-			double v = strtod(nptr, &endptr);
-			if (errno == ERANGE) {
-				errno = 0;
-				return SWIG_OverflowError;
-			} else {
-				if (*endptr == '\0') {
-					if (val)
-						*val = v;
-					return SWIG_Str2NumCast(SWIG_OK);
-				}
-			}
-		}
+  if (SvNIOK(obj)) {
+    if (val) *val = SvNV(obj);
+    return SWIG_OK;
+  } else if (SvIOK(obj)) {
+    if (val) *val = (double) SvIV(obj);
+    return SWIG_AddCast(SWIG_OK);
+  } else {
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      double v = strtod(nptr, &endptr);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
 	}
-	return SWIG_TypeError;
+      }
+    }
+  }
+  return SWIG_TypeError;
 }
 
 
@@ -1600,234 +1609,279 @@
 #include <math.h>
 
 
-SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max)
-{
-	double x = *d;
-	if ((min <= x && x <= max)) {
-		double fx = floor(x);
-		double cx = ceil(x);
-		double rd = ((x - fx) < 0.5) ? fx : cx;	/* simple rint */
-		if ((errno == EDOM) || (errno == ERANGE)) {
-			errno = 0;
-		} else {
-			double summ, reps, diff;
-			if (rd < x) {
-				diff = x - rd;
-			} else if (rd > x) {
-				diff = rd - x;
-			} else {
-				return 1;
-			}
-			summ = rd + x;
-			reps = diff / summ;
-			if (reps < 8 * DBL_EPSILON) {
-				*d = rd;
-				return 1;
-			}
-		}
-	}
-	return 0;
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
 }
 
 
 SWIGINTERN int
-SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV * obj, long *val)
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
 {
-	if (SvIOK(obj)) {
-		if (val)
-			*val = SvIV(obj);
-		return SWIG_OK;
-	} else {
-		int dispatch = 0;
-		const char *nptr = SvPV_nolen(obj);
-		if (nptr) {
-			char *endptr;
-			long v;
-			errno = 0;
-			v = strtol(nptr, &endptr, 0);
-			if (errno == ERANGE) {
-				errno = 0;
-				return SWIG_OverflowError;
-			} else {
-				if (*endptr == '\0') {
-					if (val)
-						*val = v;
-					return SWIG_Str2NumCast(SWIG_OK);
-				}
-			}
-		}
-		if (!dispatch) {
-			double d;
-			int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj, &d));
-			if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
-				if (val)
-					*val = (long) (d);
-				return res;
-			}
-		}
+  if (SvIOK(obj)) {
+    if (val) *val = SvIV(obj);
+    return SWIG_OK;
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      long v;
+      errno = 0;
+      v = strtol(nptr, &endptr,0);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
 	}
-	return SWIG_TypeError;
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+	if (val) *val = (long)(d);
+	return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
 }
 
 
 SWIGINTERN int
 SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
 {
-	long v;
-	int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
-	if (SWIG_IsOK(res)) {
-		if ((v < INT_MIN || v > INT_MAX)) {
-			return SWIG_OverflowError;
-		} else {
-			if (val)
-				*val = static_cast < int >(v);
-		}
-	}
-	return res;
+  long v;
+  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< int >(v);
+    }
+  }  
+  return res;
 }
 
 
-SWIGINTERNINLINE SV *SWIG_FromCharPtrAndSize(const char *carray, size_t size)
+SWIGINTERNINLINE SV *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
 {
-	SV *obj = sv_newmortal();
-	if (carray) {
-		sv_setpvn(obj, carray, size);
-	} else {
-		sv_setsv(obj, &PL_sv_undef);
-	}
-	return obj;
+  SV *obj = sv_newmortal();
+  if (carray) {
+    sv_setpvn(obj, carray, size);
+  } else {
+    sv_setsv(obj, &PL_sv_undef);
+  }
+  return obj;
 }
 
 
-SWIGINTERNINLINE SV *SWIG_FromCharPtr(const char *cptr)
-{
-	return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+SWIGINTERNINLINE SV * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
 }
 
 
-SWIGINTERNINLINE SV *SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value)
-{
-	SV *obj = sv_newmortal();
-	sv_setiv(obj, (IV) value);
-	return obj;
+SWIGINTERNINLINE SV *
+SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
+{    
+  SV *obj = sv_newmortal();
+  sv_setiv(obj, (IV) value);
+  return obj;
 }
 
 
-SWIGINTERNINLINE SV *SWIG_From_int SWIG_PERL_DECL_ARGS_1(int value)
-{
-	return SWIG_From_long SWIG_PERL_CALL_ARGS_1(value);
+SWIGINTERNINLINE SV *
+SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
+{    
+  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
 }
 
 
-SWIGINTERNINLINE SV *SWIG_From_bool SWIG_PERL_DECL_ARGS_1(bool value)
-{
-	SV *obj = sv_newmortal();
-	if (value) {
-		sv_setsv(obj, &PL_sv_yes);
-	} else {
-		sv_setsv(obj, &PL_sv_no);
-	}
-	return obj;
+SWIGINTERN int
+SWIG_AsCharArray(SV * obj, char *val, size_t size)
+{ 
+  char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ;
+  int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc);
+  if (SWIG_IsOK(res)) {
+    if ((csize == size + 1) && cptr && !(cptr[csize-1])) --csize;
+    if (csize <= size) {
+      if (val) {
+	if (csize) memcpy(val, cptr, csize*sizeof(char));
+	if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char));
+      }
+      if (alloc == SWIG_NEWOBJ) {
+	delete[] cptr;
+	res = SWIG_DelNewMask(res);
+      }      
+      return res;
+    }
+    if (alloc == SWIG_NEWOBJ) delete[] cptr;
+  }
+  return SWIG_TypeError;
 }
 
 
 SWIGINTERN int
-SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned long *val)
-{
-	if (SvUOK(obj)) {
-		if (val)
-			*val = SvUV(obj);
-		return SWIG_OK;
-	} else if (SvIOK(obj)) {
-		long v = SvIV(obj);
-		if (v >= 0) {
-			if (val)
-				*val = v;
-			return SWIG_OK;
-		} else {
-			return SWIG_OverflowError;
-		}
-	} else {
-		int dispatch = 0;
-		const char *nptr = SvPV_nolen(obj);
-		if (nptr) {
-			char *endptr;
-			unsigned long v;
-			errno = 0;
-			v = strtoul(nptr, &endptr, 0);
-			if (errno == ERANGE) {
-				errno = 0;
-				return SWIG_OverflowError;
-			} else {
-				if (*endptr == '\0') {
-					if (val)
-						*val = v;
-					return SWIG_Str2NumCast(SWIG_OK);
-				}
-			}
-		}
-		if (!dispatch) {
-			double d;
-			int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj, &d));
-			if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
-				if (val)
-					*val = (unsigned long) (d);
-				return res;
-			}
-		}
-	}
-	return SWIG_TypeError;
+SWIG_AsVal_char SWIG_PERL_DECL_ARGS_2(SV * obj, char *val)
+{    
+  int res = SWIG_AsCharArray(obj, val, 1);
+  if (!SWIG_IsOK(res)) {
+    long v;
+    res = SWIG_AddCast(SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v));
+    if (SWIG_IsOK(res)) {
+      if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) {
+	if (val) *val = static_cast< char >(v);
+      } else {
+	res = SWIG_OverflowError;
+      }
+    }
+  }
+  return res;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_char  SWIG_PERL_DECL_ARGS_1(char c) 
+{ 
+  return SWIG_FromCharPtrAndSize(&c,1);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_bool  SWIG_PERL_DECL_ARGS_1(bool value)
+{    
+  SV *obj = sv_newmortal();
+  if (value) {
+    sv_setsv(obj, &PL_sv_yes);
+  } else {
+    sv_setsv(obj, &PL_sv_no); 
+  }
+  return obj;
 }
 
 
 SWIGINTERN int
-SWIG_AsVal_unsigned_SS_int SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned int *val)
+SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val) 
 {
-	unsigned long v;
-	int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
-	if (SWIG_IsOK(res)) {
-		if ((v > UINT_MAX)) {
-			return SWIG_OverflowError;
-		} else {
-			if (val)
-				*val = static_cast < unsigned int >(v);
-		}
+  if (SvUOK(obj)) {
+    if (val) *val = SvUV(obj);
+    return SWIG_OK;
+  } else  if (SvIOK(obj)) {
+    long v = SvIV(obj);
+    if (v >= 0) {
+      if (val) *val = v;
+      return SWIG_OK;
+    } else {
+      return SWIG_OverflowError;
+    }
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      unsigned long v;
+      errno = 0;
+      v = strtoul(nptr, &endptr,0);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
 	}
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
+	if (val) *val = (unsigned long)(d);
 	return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
 }
 
 
-SWIGINTERNINLINE SV *SWIG_From_unsigned_SS_long SWIG_PERL_DECL_ARGS_1(unsigned long value)
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_int SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned int *val)
 {
-	SV *obj = sv_newmortal();
-	sv_setuv(obj, (UV) value);
-	return obj;
+  unsigned long v;
+  int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v > UINT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< unsigned int >(v);
+    }
+  }  
+  return res;
 }
 
 
-SWIGINTERNINLINE SV *SWIG_From_unsigned_SS_int SWIG_PERL_DECL_ARGS_1(unsigned int value)
-{
-	return SWIG_From_unsigned_SS_long SWIG_PERL_CALL_ARGS_1(value);
+SWIGINTERNINLINE SV *
+SWIG_From_unsigned_SS_long  SWIG_PERL_DECL_ARGS_1(unsigned long value)
+{    
+  SV *obj = sv_newmortal();
+  sv_setuv(obj, (UV) value);
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_unsigned_SS_int  SWIG_PERL_DECL_ARGS_1(unsigned int value)
+{    
+  return SWIG_From_unsigned_SS_long  SWIG_PERL_CALL_ARGS_1(value);
 }
 
 
 SWIGINTERN int
-SWIG_AsVal_bool SWIG_PERL_DECL_ARGS_2(SV * obj, bool * val)
+SWIG_AsVal_bool SWIG_PERL_DECL_ARGS_2(SV *obj, bool* val)
 {
-	if (obj == &PL_sv_yes) {
-		if (val)
-			*val = true;
-		return SWIG_OK;
-	} else if (obj == &PL_sv_no) {
-		if (val)
-			*val = false;
-		return SWIG_OK;
-	} else {
-		if (val)
-			*val = SvTRUE(obj) ? true : false;
-		return SWIG_AddCast(SWIG_OK);
-	}
-	return SWIG_TypeError;
+  if (obj == &PL_sv_yes) {
+    if (val) *val = true;
+    return SWIG_OK;
+  } else if (obj == &PL_sv_no) { 
+    if (val) *val = false;
+    return SWIG_OK;
+  } else {
+    if (val) *val = SvTRUE(obj) ? true: false;
+    return SWIG_AddCast(SWIG_OK);    
+  }
+  return SWIG_TypeError;
 }
 
 #ifdef __cplusplus
@@ -1836,15 +1890,18 @@
 
 #ifdef PERL_OBJECT
 #define MAGIC_CLASS _wrap_freeswitch_var::
-	class _wrap_freeswitch_var:public CPerlObj {
-	  public:
+class _wrap_freeswitch_var : public CPerlObj {
+public:
 #else
 #define MAGIC_CLASS
 #endif
-	SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV * SWIGUNUSEDPARM(sv), MAGIC * SWIGUNUSEDPARM(mg)) {
-		MAGIC_PPERL croak("Value is read-only.");
-		return 0;
-	}
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
 #ifdef PERL_OBJECT
 };
 #endif
@@ -1856,6984 +1913,8488 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-	XS(_wrap_consoleLog) {
-		{
-			char *arg1 = (char *) 0;
-			char *arg2 = (char *) 0;
-			int res1;
-			char *buf1 = 0;
-			int alloc1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			    dXSARGS;
-
-			if  ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: consoleLog(level_str,msg);");
-			}
-			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1" " of type '" "char *" "'");
-			}
-			arg1 = reinterpret_cast < char *>(buf1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			consoleLog(arg1, arg2);
-
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_consoleCleanLog) {
-		{
-			char *arg1 = (char *) 0;
-			int res1;
-			char *buf1 = 0;
-			int alloc1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: consoleCleanLog(msg);");
-			}
-			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1" " of type '" "char *" "'");
-			}
-			arg1 = reinterpret_cast < char *>(buf1);
-			consoleCleanLog(arg1);
-
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			XSRETURN(argvi);
-		  fail:
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_new_IVRMenu) {
-		{
-			IVRMenu *arg1 = (IVRMenu *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			char *arg4 = (char *) 0;
-			char *arg5 = (char *) 0;
-			char *arg6 = (char *) 0;
-			char *arg7 = (char *) 0;
-			char *arg8 = (char *) 0;
-			int arg9;
-			int arg10;
-			int arg11;
-			int arg12;
-			int arg13;
-			IVRMenu *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int res4;
-			char *buf4 = 0;
-			int alloc4 = 0;
-			int res5;
-			char *buf5 = 0;
-			int alloc5 = 0;
-			int res6;
-			char *buf6 = 0;
-			int alloc6 = 0;
-			int res7;
-			char *buf7 = 0;
-			int alloc7 = 0;
-			int res8;
-			char *buf8 = 0;
-			int alloc8 = 0;
-			int val9;
-			int ecode9 = 0;
-			int val10;
-			int ecode10 = 0;
-			int val11;
-			int ecode11 = 0;
-			int val12;
-			int ecode12 = 0;
-			int val13;
-			int ecode13 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 13) || (items > 13)) {
-				SWIG_croak
-					("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,confirm_attempts,inter_timeout,digit_len,timeout,max_failures);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
-			}
-			arg1 = reinterpret_cast < IVRMenu * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3" " of type '" "char const *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-			if (!SWIG_IsOK(res4)) {
-				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4" " of type '" "char const *" "'");
-			}
-			arg4 = reinterpret_cast < char *>(buf4);
-			res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
-			if (!SWIG_IsOK(res5)) {
-				SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5" " of type '" "char const *" "'");
-			}
-			arg5 = reinterpret_cast < char *>(buf5);
-			res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
-			if (!SWIG_IsOK(res6)) {
-				SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6" " of type '" "char const *" "'");
-			}
-			arg6 = reinterpret_cast < char *>(buf6);
-			res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
-			if (!SWIG_IsOK(res7)) {
-				SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7" " of type '" "char const *" "'");
-			}
-			arg7 = reinterpret_cast < char *>(buf7);
-			res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
-			if (!SWIG_IsOK(res8)) {
-				SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8" " of type '" "char const *" "'");
-			}
-			arg8 = reinterpret_cast < char *>(buf8);
-			ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
-			if (!SWIG_IsOK(ecode9)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9" " of type '" "int" "'");
-			}
-			arg9 = static_cast < int >(val9);
-			ecode10 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(9), &val10);
-			if (!SWIG_IsOK(ecode10)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10" " of type '" "int" "'");
-			}
-			arg10 = static_cast < int >(val10);
-			ecode11 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(10), &val11);
-			if (!SWIG_IsOK(ecode11)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11" " of type '" "int" "'");
-			}
-			arg11 = static_cast < int >(val11);
-			ecode12 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(11), &val12);
-			if (!SWIG_IsOK(ecode12)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12" " of type '" "int" "'");
-			}
-			arg12 = static_cast < int >(val12);
-			ecode13 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(12), &val13);
-			if (!SWIG_IsOK(ecode13)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13" " of type '" "int" "'");
-			}
-			arg13 = static_cast < int >(val13);
-			result =
-				(IVRMenu *) new IVRMenu(arg1, (char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5, (char const *) arg6,
-										(char const *) arg7, (char const *) arg8, arg9, arg10, arg11, arg12, arg13);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-			if (alloc5 == SWIG_NEWOBJ)
-				delete[]buf5;
-			if (alloc6 == SWIG_NEWOBJ)
-				delete[]buf6;
-			if (alloc7 == SWIG_NEWOBJ)
-				delete[]buf7;
-			if (alloc8 == SWIG_NEWOBJ)
-				delete[]buf8;
-
+XS(_wrap_consoleLog) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: consoleLog(level_str,msg);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    consoleLog(arg1,arg2);
+    
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_consoleCleanLog) {
+  {
+    char *arg1 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: consoleCleanLog(msg);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    consoleCleanLog(arg1);
+    
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-			if (alloc5 == SWIG_NEWOBJ)
-				delete[]buf5;
-			if (alloc6 == SWIG_NEWOBJ)
-				delete[]buf6;
-			if (alloc7 == SWIG_NEWOBJ)
-				delete[]buf7;
-			if (alloc8 == SWIG_NEWOBJ)
-				delete[]buf8;
+XS(_wrap_new_IVRMenu) {
+  {
+    IVRMenu *arg1 = (IVRMenu *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
+    char *arg5 = (char *) 0 ;
+    char *arg6 = (char *) 0 ;
+    char *arg7 = (char *) 0 ;
+    char *arg8 = (char *) 0 ;
+    int arg9 ;
+    int arg10 ;
+    int arg11 ;
+    int arg12 ;
+    int arg13 ;
+    IVRMenu *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int res5 ;
+    char *buf5 = 0 ;
+    int alloc5 = 0 ;
+    int res6 ;
+    char *buf6 = 0 ;
+    int alloc6 = 0 ;
+    int res7 ;
+    char *buf7 = 0 ;
+    int alloc7 = 0 ;
+    int res8 ;
+    char *buf8 = 0 ;
+    int alloc8 = 0 ;
+    int val9 ;
+    int ecode9 = 0 ;
+    int val10 ;
+    int ecode10 = 0 ;
+    int val11 ;
+    int ecode11 = 0 ;
+    int val12 ;
+    int ecode12 = 0 ;
+    int val13 ;
+    int ecode13 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 13) || (items > 13)) {
+      SWIG_croak("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,confirm_attempts,inter_timeout,digit_len,timeout,max_failures);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); 
+    }
+    arg1 = reinterpret_cast< IVRMenu * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
+    if (!SWIG_IsOK(res5)) {
+      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5"" of type '" "char const *""'");
+    }
+    arg5 = reinterpret_cast< char * >(buf5);
+    res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+    if (!SWIG_IsOK(res6)) {
+      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6"" of type '" "char const *""'");
+    }
+    arg6 = reinterpret_cast< char * >(buf6);
+    res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
+    if (!SWIG_IsOK(res7)) {
+      SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7"" of type '" "char const *""'");
+    }
+    arg7 = reinterpret_cast< char * >(buf7);
+    res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
+    if (!SWIG_IsOK(res8)) {
+      SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8"" of type '" "char const *""'");
+    }
+    arg8 = reinterpret_cast< char * >(buf8);
+    ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
+    if (!SWIG_IsOK(ecode9)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "int""'");
+    } 
+    arg9 = static_cast< int >(val9);
+    ecode10 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(9), &val10);
+    if (!SWIG_IsOK(ecode10)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "int""'");
+    } 
+    arg10 = static_cast< int >(val10);
+    ecode11 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(10), &val11);
+    if (!SWIG_IsOK(ecode11)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'");
+    } 
+    arg11 = static_cast< int >(val11);
+    ecode12 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(11), &val12);
+    if (!SWIG_IsOK(ecode12)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12"" of type '" "int""'");
+    } 
+    arg12 = static_cast< int >(val12);
+    ecode13 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(12), &val13);
+    if (!SWIG_IsOK(ecode13)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13"" of type '" "int""'");
+    } 
+    arg13 = static_cast< int >(val13);
+    result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+    if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+    if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_delete_IVRMenu) {
+  {
+    IVRMenu *arg1 = (IVRMenu *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_IVRMenu(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); 
+    }
+    arg1 = reinterpret_cast< IVRMenu * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_IVRMenu_bindAction) {
+  {
+    IVRMenu *arg1 = (IVRMenu *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: IVRMenu_bindAction(self,action,arg,bind);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1"" of type '" "IVRMenu *""'"); 
+    }
+    arg1 = reinterpret_cast< IVRMenu * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_delete_IVRMenu) {
-		{
-			IVRMenu *arg1 = (IVRMenu *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: delete_IVRMenu(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
-			}
-			arg1 = reinterpret_cast < IVRMenu * >(argp1);
-			delete arg1;
-
-
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_IVRMenu_bindAction) {
-		{
-			IVRMenu *arg1 = (IVRMenu *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			char *arg4 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int res4;
-			char *buf4 = 0;
-			int alloc4 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 4) || (items > 4)) {
-				SWIG_croak("Usage: IVRMenu_bindAction(self,action,arg,bind);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1" " of type '" "IVRMenu *" "'");
-			}
-			arg1 = reinterpret_cast < IVRMenu * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3" " of type '" "char const *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-			if (!SWIG_IsOK(res4)) {
-				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4" " of type '" "char const *" "'");
-			}
-			arg4 = reinterpret_cast < char *>(buf4);
-			(arg1)->bindAction(arg2, (char const *) arg3, (char const *) arg4);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_IVRMenu_execute) {
+  {
+    IVRMenu *arg1 = (IVRMenu *) 0 ;
+    CoreSession *arg2 = (CoreSession *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: IVRMenu_execute(self,session,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1"" of type '" "IVRMenu *""'"); 
+    }
+    arg1 = reinterpret_cast< IVRMenu * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2"" of type '" "CoreSession *""'"); 
+    }
+    arg2 = reinterpret_cast< CoreSession * >(argp2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    (arg1)->execute(arg2,(char const *)arg3);
+    
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_IVRMenu_execute) {
-		{
-			IVRMenu *arg1 = (IVRMenu *) 0;
-			CoreSession *arg2 = (CoreSession *) 0;
-			char *arg3 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2 = 0;
-			int res2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: IVRMenu_execute(self,session,name);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1" " of type '" "IVRMenu *" "'");
-			}
-			arg1 = reinterpret_cast < IVRMenu * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2" " of type '" "CoreSession *" "'");
-			}
-			arg2 = reinterpret_cast < CoreSession * >(argp2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3" " of type '" "char const *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			(arg1)->execute(arg2, (char const *) arg3);
 
+XS(_wrap_new_API) {
+  {
+    API *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: new_API();");
+    }
+    result = (API *)new API();
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
 
 
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_delete_API) {
+  {
+    API *arg1 = (API *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_API(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1"" of type '" "API *""'"); 
+    }
+    arg1 = reinterpret_cast< API * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_new_API) {
-		{
-			API *result = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 0) || (items > 0)) {
-				SWIG_croak("Usage: new_API();");
-			}
-			result = (API *) new API();
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
-			XSRETURN(argvi);
-		  fail:
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_API_execute) {
+  {
+    API *arg1 = (API *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: API_execute(self,command,data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1"" of type '" "API *""'"); 
+    }
+    arg1 = reinterpret_cast< API * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_delete_API) {
-		{
-			API *arg1 = (API *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: delete_API(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_API, SWIG_POINTER_DISOWN | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1" " of type '" "API *" "'");
-			}
-			arg1 = reinterpret_cast < API * >(argp1);
-			delete arg1;
+XS(_wrap_API_executeString) {
+  {
+    API *arg1 = (API *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: API_executeString(self,command);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1"" of type '" "API *""'"); 
+    }
+    arg1 = reinterpret_cast< API * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (char *)(arg1)->executeString((char const *)arg2);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_input_callback_state_t_function_set) {
+  {
+    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+    void *arg2 = (void *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: input_callback_state_t_function_set(self,function);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+    }
+    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2"" of type '" "void *""'"); 
+    }
+    if (arg1) (arg1)->function = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_input_callback_state_t_function_get) {
+  {
+    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+    void *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: input_callback_state_t_function_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+    }
+    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+    result = (void *) ((arg1)->function);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_API_execute) {
-		{
-			API *arg1 = (API *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: API_execute(self,command,data);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_API, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1" " of type '" "API *" "'");
-			}
-			arg1 = reinterpret_cast < API * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3" " of type '" "char const *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			result = (char *) (arg1)->execute((char const *) arg2, (char const *) arg3);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_input_callback_state_t_threadState_set) {
+  {
+    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+    void *arg2 = (void *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: input_callback_state_t_threadState_set(self,threadState);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+    }
+    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_threadState_set" "', argument " "2"" of type '" "void *""'"); 
+    }
+    if (arg1) (arg1)->threadState = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_API_executeString) {
-		{
-			API *arg1 = (API *) 0;
-			char *arg2 = (char *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: API_executeString(self,command);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_API, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1" " of type '" "API *" "'");
-			}
-			arg1 = reinterpret_cast < API * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (char *) (arg1)->executeString((char const *) arg2);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_input_callback_state_t_threadState_get) {
+  {
+    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+    void *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: input_callback_state_t_threadState_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+    }
+    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+    result = (void *) ((arg1)->threadState);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_input_callback_state_t_function_set) {
-		{
-			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-			void *arg2 = (void *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: input_callback_state_t_function_set(self,function);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "input_callback_state_t_function_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-			}
-			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2" " of type '" "void *" "'");
-			}
-			if (arg1)
-				(arg1)->function = arg2;
+XS(_wrap_input_callback_state_t_extra_set) {
+  {
+    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+    void *arg2 = (void *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: input_callback_state_t_extra_set(self,extra);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+    }
+    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2"" of type '" "void *""'"); 
+    }
+    if (arg1) (arg1)->extra = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_input_callback_state_t_extra_get) {
+  {
+    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+    void *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: input_callback_state_t_extra_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+    }
+    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+    result = (void *) ((arg1)->extra);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_input_callback_state_t_funcargs_set) {
+  {
+    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: input_callback_state_t_funcargs_set(self,funcargs);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+    }
+    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->funcargs) delete[] arg1->funcargs;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->funcargs = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->funcargs = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_input_callback_state_t_funcargs_get) {
+  {
+    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: input_callback_state_t_funcargs_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+    }
+    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+    result = (char *) ((arg1)->funcargs);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_input_callback_state_t_function_get) {
-		{
-			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-			void *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: input_callback_state_t_function_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "input_callback_state_t_function_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-			}
-			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-			result = (void *) ((arg1)->function);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
-			argvi++;
+XS(_wrap_new_input_callback_state_t) {
+  {
+    input_callback_state_t *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: new_input_callback_state_t();");
+    }
+    result = (input_callback_state_t *)new input_callback_state_t();
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_delete_input_callback_state_t) {
+  {
+    input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_input_callback_state_t(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_input_callback_state_t" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+    }
+    arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_input_callback_state_t_threadState_set) {
-		{
-			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-			void *arg2 = (void *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: input_callback_state_t_threadState_set(self,threadState);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "input_callback_state_t_threadState_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-			}
-			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2),
-									"in method '" "input_callback_state_t_threadState_set" "', argument " "2" " of type '" "void *" "'");
-			}
-			if (arg1)
-				(arg1)->threadState = arg2;
+XS(_wrap_DTMF_digit_set) {
+  {
+    DTMF *arg1 = (DTMF *) 0 ;
+    char arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    char val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: DTMF_digit_set(self,digit);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_digit_set" "', argument " "1"" of type '" "DTMF *""'"); 
+    }
+    arg1 = reinterpret_cast< DTMF * >(argp1);
+    ecode2 = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DTMF_digit_set" "', argument " "2"" of type '" "char""'");
+    } 
+    arg2 = static_cast< char >(val2);
+    if (arg1) (arg1)->digit = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_DTMF_digit_get) {
+  {
+    DTMF *arg1 = (DTMF *) 0 ;
+    char result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: DTMF_digit_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_digit_get" "', argument " "1"" of type '" "DTMF *""'"); 
+    }
+    arg1 = reinterpret_cast< DTMF * >(argp1);
+    result = (char) ((arg1)->digit);
+    ST(argvi) = SWIG_From_char  SWIG_PERL_CALL_ARGS_1(static_cast< char >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_DTMF_duration_set) {
+  {
+    DTMF *arg1 = (DTMF *) 0 ;
+    uint32_t arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: DTMF_duration_set(self,duration);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_duration_set" "', argument " "1"" of type '" "DTMF *""'"); 
+    }
+    arg1 = reinterpret_cast< DTMF * >(argp1);
+    {
+      res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_uint32_t,  0 );
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DTMF_duration_set" "', argument " "2"" of type '" "uint32_t""'"); 
+      }  
+      if (!argp2) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DTMF_duration_set" "', argument " "2"" of type '" "uint32_t""'");
+      } else {
+        arg2 = *(reinterpret_cast< uint32_t * >(argp2));
+      }
+    }
+    if (arg1) (arg1)->duration = arg2;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_DTMF_duration_get) {
+  {
+    DTMF *arg1 = (DTMF *) 0 ;
+    uint32_t result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: DTMF_duration_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_duration_get" "', argument " "1"" of type '" "DTMF *""'"); 
+    }
+    arg1 = reinterpret_cast< DTMF * >(argp1);
+    result =  ((arg1)->duration);
+    ST(argvi) = SWIG_NewPointerObj((new uint32_t(static_cast< const uint32_t& >(result))), SWIGTYPE_p_uint32_t, SWIG_POINTER_OWN | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_input_callback_state_t_threadState_get) {
-		{
-			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-			void *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: input_callback_state_t_threadState_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "input_callback_state_t_threadState_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-			}
-			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-			result = (void *) ((arg1)->threadState);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
-			argvi++;
+XS(_wrap_new_DTMF__SWIG_0) {
+  {
+    char arg1 ;
+    uint32_t arg2 ;
+    DTMF *result = 0 ;
+    char val1 ;
+    int ecode1 = 0 ;
+    void *argp2 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: new_DTMF(idigit,iduration);");
+    }
+    ecode1 = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DTMF" "', argument " "1"" of type '" "char""'");
+    } 
+    arg1 = static_cast< char >(val1);
+    {
+      res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_uint32_t,  0 );
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_DTMF" "', argument " "2"" of type '" "uint32_t""'"); 
+      }  
+      if (!argp2) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DTMF" "', argument " "2"" of type '" "uint32_t""'");
+      } else {
+        arg2 = *(reinterpret_cast< uint32_t * >(argp2));
+      }
+    }
+    result = (DTMF *)new DTMF(arg1,arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_new_DTMF__SWIG_1) {
+  {
+    char arg1 ;
+    DTMF *result = 0 ;
+    char val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_DTMF(idigit);");
+    }
+    ecode1 = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DTMF" "', argument " "1"" of type '" "char""'");
+    } 
+    arg1 = static_cast< char >(val1);
+    result = (DTMF *)new DTMF(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_input_callback_state_t_extra_set) {
-		{
-			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-			void *arg2 = (void *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: input_callback_state_t_extra_set(self,extra);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "input_callback_state_t_extra_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-			}
-			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2" " of type '" "void *" "'");
-			}
-			if (arg1)
-				(arg1)->extra = arg2;
+XS(_wrap_new_DTMF) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        {
+          int res = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(0), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        {
+          int res = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(0), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_uint32_t, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_DTMF__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_DTMF__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'new_DTMF'");
+  XSRETURN(0);
+}
 
 
+XS(_wrap_delete_DTMF) {
+  {
+    DTMF *arg1 = (DTMF *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_DTMF(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DTMF, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DTMF" "', argument " "1"" of type '" "DTMF *""'"); 
+    }
+    arg1 = reinterpret_cast< DTMF * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_new_Stream__SWIG_0) {
+  {
+    Stream *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: new_Stream();");
+    }
+    result = (Stream *)new Stream();
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_new_Stream__SWIG_1) {
+  {
+    switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
+    Stream *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_Stream(switch_stream_handle_t *);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_stream_handle_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1"" of type '" "switch_stream_handle_t *""'"); 
+    }
+    arg1 = reinterpret_cast< switch_stream_handle_t * >(argp1);
+    result = (Stream *)new Stream(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_input_callback_state_t_extra_get) {
-		{
-			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-			void *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: input_callback_state_t_extra_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "input_callback_state_t_extra_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-			}
-			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-			result = (void *) ((arg1)->extra);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
-			argvi++;
+XS(_wrap_new_Stream) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 0) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Stream__SWIG_0); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Stream__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'new_Stream'");
+  XSRETURN(0);
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_delete_Stream) {
+  {
+    Stream *arg1 = (Stream *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_Stream(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1"" of type '" "Stream *""'"); 
+    }
+    arg1 = reinterpret_cast< Stream * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_input_callback_state_t_funcargs_set) {
-		{
-			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-			char *arg2 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: input_callback_state_t_funcargs_set(self,funcargs);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "input_callback_state_t_funcargs_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-			}
-			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			if (arg1->funcargs)
-				delete[]arg1->funcargs;
-			if (arg2) {
-				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
-				arg1->funcargs =
-					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
-			} else {
-				arg1->funcargs = 0;
-			}
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_Stream_write) {
+  {
+    Stream *arg1 = (Stream *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Stream_write(self,data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Stream, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1"" of type '" "Stream *""'"); 
+    }
+    arg1 = reinterpret_cast< Stream * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    (arg1)->write((char const *)arg2);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_input_callback_state_t_funcargs_get) {
-		{
-			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: input_callback_state_t_funcargs_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "input_callback_state_t_funcargs_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-			}
-			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-			result = (char *) ((arg1)->funcargs);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
+XS(_wrap_Stream_get_data) {
+  {
+    Stream *arg1 = (Stream *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Stream_get_data(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Stream, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1"" of type '" "Stream *""'"); 
+    }
+    arg1 = reinterpret_cast< Stream * >(argp1);
+    result = (char *)(arg1)->get_data();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_new_input_callback_state_t) {
-		{
-			input_callback_state_t *result = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 0) || (items > 0)) {
-				SWIG_croak("Usage: new_input_callback_state_t();");
-			}
-			result = (input_callback_state_t *) new input_callback_state_t();
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
-			XSRETURN(argvi);
-		  fail:
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_delete_input_callback_state_t) {
-		{
-			input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: delete_input_callback_state_t(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "delete_input_callback_state_t" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-			}
-			arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-			delete arg1;
+XS(_wrap_Event_event_set) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    switch_event_t *arg2 = (switch_event_t *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Event_event_set(self,event);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2"" of type '" "switch_event_t *""'"); 
+    }
+    arg2 = reinterpret_cast< switch_event_t * >(argp2);
+    if (arg1) (arg1)->event = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_Event_event_get) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    switch_event_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Event_event_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    result = (switch_event_t *) ((arg1)->event);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_Event_serialized_string_set) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Event_serialized_string_set(self,serialized_string);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->serialized_string) delete[] arg1->serialized_string;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->serialized_string = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_new_Stream__SWIG_0) {
-		{
-			Stream *result = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 0) || (items > 0)) {
-				SWIG_croak("Usage: new_Stream();");
-			}
-			result = (Stream *) new Stream();
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
-			XSRETURN(argvi);
-		  fail:
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_Event_serialized_string_get) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Event_serialized_string_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    result = (char *) ((arg1)->serialized_string);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_new_Stream__SWIG_1) {
-		{
-			switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0;
-			Stream *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: new_Stream(switch_stream_handle_t *);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_stream_handle_t, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1" " of type '" "switch_stream_handle_t *" "'");
-			}
-			arg1 = reinterpret_cast < switch_stream_handle_t *>(argp1);
-			result = (Stream *) new Stream(arg1);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
+XS(_wrap_Event_mine_set) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Event_mine_set(self,mine);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    if (arg1) (arg1)->mine = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_Event_mine_get) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Event_mine_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    result = (int) ((arg1)->mine);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_new_Stream) {
-		dXSARGS;
+XS(_wrap_new_Event__SWIG_0) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    Event *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: new_Event(type,subclass_name);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (Event *)new Event((char const *)arg1,(char const *)arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 0) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-			if (items == 1) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_new_Stream__SWIG_0);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_new_Stream__SWIG_1);
-				return;
-			}
-		}
 
-		croak("No matching function for overloaded 'new_Stream'");
-		XSRETURN(0);
-	}
+XS(_wrap_new_Event__SWIG_1) {
+  {
+    char *arg1 = (char *) 0 ;
+    Event *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_Event(type);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    result = (Event *)new Event((char const *)arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_delete_Stream) {
-		{
-			Stream *arg1 = (Stream *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: delete_Stream(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1" " of type '" "Stream *" "'");
-			}
-			arg1 = reinterpret_cast < Stream * >(argp1);
-			delete arg1;
+XS(_wrap_new_Event__SWIG_2) {
+  {
+    switch_event_t *arg1 = (switch_event_t *) 0 ;
+    int arg2 ;
+    Event *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: new_Event(wrap_me,free_me);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_event_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'"); 
+    }
+    arg1 = reinterpret_cast< switch_event_t * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    result = (Event *)new Event(arg1,arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_new_Event__SWIG_3) {
+  {
+    switch_event_t *arg1 = (switch_event_t *) 0 ;
+    Event *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_Event(wrap_me);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_event_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'"); 
+    }
+    arg1 = reinterpret_cast< switch_event_t * >(argp1);
+    result = (Event *)new Event(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_new_Event) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 3;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_3:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 4;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_4:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_3); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_1); return;
+    case 3:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_2); return;
+    case 4:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'new_Event'");
+  XSRETURN(0);
+}
 
 
-	XS(_wrap_Stream_write) {
-		{
-			Stream *arg1 = (Stream *) 0;
-			char *arg2 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Stream_write(self,data);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Stream, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1" " of type '" "Stream *" "'");
-			}
-			arg1 = reinterpret_cast < Stream * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			(arg1)->write((char const *) arg2);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_delete_Event) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_Event(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Stream_get_data) {
-		{
-			Stream *arg1 = (Stream *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Stream_get_data(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Stream, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1" " of type '" "Stream *" "'");
-			}
-			arg1 = reinterpret_cast < Stream * >(argp1);
-			result = (char *) (arg1)->get_data();
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
+XS(_wrap_Event_serialize__SWIG_0) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Event_serialize(self,format);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (char *)(arg1)->serialize((char const *)arg2);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_Event_serialize__SWIG_1) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Event_serialize(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    result = (char *)(arg1)->serialize();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_event_set) {
-		{
-			Event *arg1 = (Event *) 0;
-			switch_event_t *arg2 = (switch_event_t *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2 = 0;
-			int res2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Event_event_set(self,event);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2" " of type '" "switch_event_t *" "'");
-			}
-			arg2 = reinterpret_cast < switch_event_t *>(argp2);
-			if (arg1)
-				(arg1)->event = arg2;
+XS(_wrap_Event_serialize) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_serialize__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_serialize__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Event_serialize'");
+  XSRETURN(0);
+}
 
 
+XS(_wrap_Event_setPriority__SWIG_0) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    switch_priority_t arg2 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Event_setPriority(self,priority);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    {
+      res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_priority_t,  0 );
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'"); 
+      }  
+      if (!argp2) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'");
+      } else {
+        arg2 = *(reinterpret_cast< switch_priority_t * >(argp2));
+      }
+    }
+    result = (bool)(arg1)->setPriority(arg2);
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_Event_setPriority__SWIG_1) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Event_setPriority(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    result = (bool)(arg1)->setPriority();
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_Event_setPriority) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_switch_priority_t, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_setPriority__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_setPriority__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Event_setPriority'");
+  XSRETURN(0);
+}
 
 
-	XS(_wrap_Event_event_get) {
-		{
-			Event *arg1 = (Event *) 0;
-			switch_event_t *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Event_event_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			result = (switch_event_t *) ((arg1)->event);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 | 0);
-			argvi++;
+XS(_wrap_Event_getHeader) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Event_getHeader(self,header_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (char *)(arg1)->getHeader(arg2);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_Event_getBody) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Event_getBody(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    result = (char *)(arg1)->getBody();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_serialized_string_set) {
-		{
-			Event *arg1 = (Event *) 0;
-			char *arg2 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Event_serialized_string_set(self,serialized_string);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			if (arg1->serialized_string)
-				delete[]arg1->serialized_string;
-			if (arg2) {
-				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
-				arg1->serialized_string =
-					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
-			} else {
-				arg1->serialized_string = 0;
-			}
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_Event_getType) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Event_getType(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    result = (char *)(arg1)->getType();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_serialized_string_get) {
-		{
-			Event *arg1 = (Event *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Event_serialized_string_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			result = (char *) ((arg1)->serialized_string);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
+XS(_wrap_Event_addBody) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    char *arg2 = (char *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Event_addBody(self,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (bool)(arg1)->addBody((char const *)arg2);
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_Event_addHeader) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Event_addHeader(self,header_name,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_mine_set) {
-		{
-			Event *arg1 = (Event *) 0;
-			int arg2;
-			void *argp1 = 0;
-			int res1 = 0;
-			int val2;
-			int ecode2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Event_mine_set(self,mine);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-			if (!SWIG_IsOK(ecode2)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2" " of type '" "int" "'");
-			}
-			arg2 = static_cast < int >(val2);
-			if (arg1)
-				(arg1)->mine = arg2;
+XS(_wrap_Event_delHeader) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    char *arg2 = (char *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Event_delHeader(self,header_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (bool)(arg1)->delHeader((char const *)arg2);
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_Event_fire) {
+  {
+    Event *arg1 = (Event *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Event_fire(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1"" of type '" "Event *""'"); 
+    }
+    arg1 = reinterpret_cast< Event * >(argp1);
+    result = (bool)(arg1)->fire();
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_EventConsumer_events_set) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    switch_queue_t *arg2 = (switch_queue_t *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: EventConsumer_events_set(self,events);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_events_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_queue_t, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_events_set" "', argument " "2"" of type '" "switch_queue_t *""'"); 
+    }
+    arg2 = reinterpret_cast< switch_queue_t * >(argp2);
+    if (arg1) (arg1)->events = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_EventConsumer_events_get) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    switch_queue_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: EventConsumer_events_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_events_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    result = (switch_queue_t *) ((arg1)->events);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_queue_t, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_mine_get) {
-		{
-			Event *arg1 = (Event *) 0;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Event_mine_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			result = (int) ((arg1)->mine);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
+XS(_wrap_EventConsumer_e_event_id_set) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    switch_event_types_t arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: EventConsumer_e_event_id_set(self,e_event_id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_event_id_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    {
+      res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_event_types_t,  0 );
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_event_id_set" "', argument " "2"" of type '" "switch_event_types_t""'"); 
+      }  
+      if (!argp2) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EventConsumer_e_event_id_set" "', argument " "2"" of type '" "switch_event_types_t""'");
+      } else {
+        arg2 = *(reinterpret_cast< switch_event_types_t * >(argp2));
+      }
+    }
+    if (arg1) (arg1)->e_event_id = arg2;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_EventConsumer_e_event_id_get) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    switch_event_types_t result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: EventConsumer_e_event_id_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_event_id_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    result =  ((arg1)->e_event_id);
+    ST(argvi) = SWIG_NewPointerObj((new switch_event_types_t(static_cast< const switch_event_types_t& >(result))), SWIGTYPE_p_switch_event_types_t, SWIG_POINTER_OWN | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_new_Event__SWIG_0) {
-		{
-			char *arg1 = (char *) 0;
-			char *arg2 = (char *) 0;
-			Event *result = 0;
-			int res1;
-			char *buf1 = 0;
-			int alloc1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: new_Event(type,subclass_name);");
-			}
-			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
-			}
-			arg1 = reinterpret_cast < char *>(buf1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (Event *) new Event((char const *) arg1, (char const *) arg2);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_EventConsumer_node_set) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    switch_event_node_t *arg2 = (switch_event_node_t *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: EventConsumer_node_set(self,node);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_node_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_event_node_t, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_node_set" "', argument " "2"" of type '" "switch_event_node_t *""'"); 
+    }
+    arg2 = reinterpret_cast< switch_event_node_t * >(argp2);
+    if (arg1) (arg1)->node = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_new_Event__SWIG_1) {
-		{
-			char *arg1 = (char *) 0;
-			Event *result = 0;
-			int res1;
-			char *buf1 = 0;
-			int alloc1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: new_Event(type);");
-			}
-			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
-			}
-			arg1 = reinterpret_cast < char *>(buf1);
-			result = (Event *) new Event((char const *) arg1);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			XSRETURN(argvi);
-		  fail:
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_EventConsumer_node_get) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    switch_event_node_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: EventConsumer_node_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_node_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    result = (switch_event_node_t *) ((arg1)->node);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_node_t, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_new_Event__SWIG_2) {
-		{
-			switch_event_t *arg1 = (switch_event_t *) 0;
-			int arg2;
-			Event *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int val2;
-			int ecode2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: new_Event(wrap_me,free_me);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
-			}
-			arg1 = reinterpret_cast < switch_event_t *>(argp1);
-			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-			if (!SWIG_IsOK(ecode2)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2" " of type '" "int" "'");
-			}
-			arg2 = static_cast < int >(val2);
-			result = (Event *) new Event(arg1, arg2);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
+XS(_wrap_EventConsumer_e_callback_set) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: EventConsumer_e_callback_set(self,e_callback);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_callback_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_callback_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->e_callback) delete[] arg1->e_callback;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->e_callback = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->e_callback = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_EventConsumer_e_callback_get) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: EventConsumer_e_callback_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_callback_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    result = (char *) ((arg1)->e_callback);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_EventConsumer_e_subclass_name_set) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: EventConsumer_e_subclass_name_set(self,e_subclass_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_subclass_name_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_subclass_name_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->e_subclass_name) delete[] arg1->e_subclass_name;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->e_subclass_name = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->e_subclass_name = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_new_Event__SWIG_3) {
-		{
-			switch_event_t *arg1 = (switch_event_t *) 0;
-			Event *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: new_Event(wrap_me);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
-			}
-			arg1 = reinterpret_cast < switch_event_t *>(argp1);
-			result = (Event *) new Event(arg1);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
+XS(_wrap_EventConsumer_e_subclass_name_get) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: EventConsumer_e_subclass_name_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_subclass_name_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    result = (char *) ((arg1)->e_subclass_name);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_EventConsumer_e_cb_arg_set) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: EventConsumer_e_cb_arg_set(self,e_cb_arg);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_cb_arg_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_cb_arg_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->e_cb_arg) delete[] arg1->e_cb_arg;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->e_cb_arg = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->e_cb_arg = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_new_Event) {
-		dXSARGS;
+XS(_wrap_EventConsumer_e_cb_arg_get) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: EventConsumer_e_cb_arg_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_cb_arg_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    result = (char *) ((arg1)->e_cb_arg);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 1) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_1:
-
-			if (items == 1) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-			if (items == 2) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_3;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					{
-						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
-						_v = SWIG_CheckState(res);
-					}
-				}
-				if (!_v)
-					goto check_3;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 3;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_3:
-
-			if (items == 2) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_4;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_4;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 4;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_4:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_new_Event__SWIG_3);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_new_Event__SWIG_1);
-				return;
-			case 3:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_new_Event__SWIG_2);
-				return;
-			case 4:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_new_Event__SWIG_0);
-				return;
-			}
-		}
 
-		croak("No matching function for overloaded 'new_Event'");
-		XSRETURN(0);
-	}
+XS(_wrap_new_EventConsumer__SWIG_0) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    EventConsumer *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: new_EventConsumer(event_name,subclass_name);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EventConsumer" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_EventConsumer" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EventConsumer, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_delete_Event) {
-		{
-			Event *arg1 = (Event *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: delete_Event(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, SWIG_POINTER_DISOWN | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			delete arg1;
+XS(_wrap_new_EventConsumer__SWIG_1) {
+  {
+    char *arg1 = (char *) 0 ;
+    EventConsumer *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_EventConsumer(event_name);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EventConsumer" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    result = (EventConsumer *)new EventConsumer((char const *)arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EventConsumer, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_new_EventConsumer) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_EventConsumer__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_EventConsumer__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'new_EventConsumer'");
+  XSRETURN(0);
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_delete_EventConsumer) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_EventConsumer(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EventConsumer" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_serialize__SWIG_0) {
-		{
-			Event *arg1 = (Event *) 0;
-			char *arg2 = (char *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Event_serialize(self,format);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (char *) (arg1)->serialize((char const *) arg2);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_EventConsumer_pop__SWIG_0) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    int arg2 ;
+    Event *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: EventConsumer_pop(self,block);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EventConsumer_pop" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    result = (Event *)(arg1)->pop(arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_serialize__SWIG_1) {
-		{
-			Event *arg1 = (Event *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Event_serialize(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			result = (char *) (arg1)->serialize();
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
+XS(_wrap_EventConsumer_pop__SWIG_1) {
+  {
+    EventConsumer *arg1 = (EventConsumer *) 0 ;
+    Event *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: EventConsumer_pop(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); 
+    }
+    arg1 = reinterpret_cast< EventConsumer * >(argp1);
+    result = (Event *)(arg1)->pop();
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_EventConsumer_pop) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_EventConsumer, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_EventConsumer, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_EventConsumer_pop__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_EventConsumer_pop__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'EventConsumer_pop'");
+  XSRETURN(0);
+}
 
 
-	XS(_wrap_Event_serialize) {
-		dXSARGS;
+XS(_wrap_delete_CoreSession) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_CoreSession(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 1) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_1:
-
-			if (items == 2) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_Event_serialize__SWIG_1);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_Event_serialize__SWIG_0);
-				return;
-			}
-		}
 
-		croak("No matching function for overloaded 'Event_serialize'");
-		XSRETURN(0);
-	}
+XS(_wrap_CoreSession_session_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_session_set(self,session);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_session_set" "', argument " "2"" of type '" "switch_core_session_t *""'"); 
+    }
+    arg2 = reinterpret_cast< switch_core_session_t * >(argp2);
+    if (arg1) (arg1)->session = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_setPriority__SWIG_0) {
-		{
-			Event *arg1 = (Event *) 0;
-			switch_priority_t arg2;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2;
-			int res2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Event_setPriority(self,priority);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			{
-				res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_priority_t, 0);
-				if (!SWIG_IsOK(res2)) {
-					SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t" "'");
-				}
-				if (!argp2) {
-					SWIG_exception_fail(SWIG_ValueError,
-										"invalid null reference " "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t"
-										"'");
-				} else {
-					arg2 = *(reinterpret_cast < switch_priority_t *>(argp2));
-				}
-			}
-			result = (bool) (arg1)->setPriority(arg2);
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
+XS(_wrap_CoreSession_session_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    switch_core_session_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_session_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (switch_core_session_t *) ((arg1)->session);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_channel_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_channel_set(self,channel);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2"" of type '" "switch_channel_t *""'"); 
+    }
+    arg2 = reinterpret_cast< switch_channel_t * >(argp2);
+    if (arg1) (arg1)->channel = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_setPriority__SWIG_1) {
-		{
-			Event *arg1 = (Event *) 0;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Event_setPriority(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			result = (bool) (arg1)->setPriority();
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
+XS(_wrap_CoreSession_channel_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    switch_channel_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_channel_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (switch_channel_t *) ((arg1)->channel);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_flags_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    unsigned int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    unsigned int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_flags_set(self,flags);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2"" of type '" "unsigned int""'");
+    } 
+    arg2 = static_cast< unsigned int >(val2);
+    if (arg1) (arg1)->flags = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_setPriority) {
-		dXSARGS;
+XS(_wrap_CoreSession_flags_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    unsigned int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_flags_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (unsigned int) ((arg1)->flags);
+    ST(argvi) = SWIG_From_unsigned_SS_int  SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 1) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_1:
-
-			if (items == 2) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_switch_priority_t, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_Event_setPriority__SWIG_1);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_Event_setPriority__SWIG_0);
-				return;
-			}
-		}
 
-		croak("No matching function for overloaded 'Event_setPriority'");
-		XSRETURN(0);
-	}
+XS(_wrap_CoreSession_allocated_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_allocated_set(self,allocated);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    if (arg1) (arg1)->allocated = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_getHeader) {
-		{
-			Event *arg1 = (Event *) 0;
-			char *arg2 = (char *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Event_getHeader(self,header_name);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (char *) (arg1)->getHeader(arg2);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_allocated_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_allocated_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (int) ((arg1)->allocated);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_getBody) {
-		{
-			Event *arg1 = (Event *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Event_getBody(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			result = (char *) (arg1)->getBody();
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
+XS(_wrap_CoreSession_cb_state_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    input_callback_state *arg2 = (input_callback_state *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_cb_state_set(self,cb_state);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_input_callback_state, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_cb_state_set" "', argument " "2"" of type '" "input_callback_state *""'"); 
+    }
+    arg2 = reinterpret_cast< input_callback_state * >(argp2);
+    if (arg1) (arg1)->cb_state = *arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_cb_state_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    input_callback_state *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_cb_state_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (input_callback_state *)& ((arg1)->cb_state);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_getType) {
-		{
-			Event *arg1 = (Event *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Event_getType(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			result = (char *) (arg1)->getType();
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
+XS(_wrap_CoreSession_hook_state_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    switch_channel_state_t arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_hook_state_set(self,hook_state);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    {
+      res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_channel_state_t,  0 );
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'"); 
+      }  
+      if (!argp2) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'");
+      } else {
+        arg2 = *(reinterpret_cast< switch_channel_state_t * >(argp2));
+      }
+    }
+    if (arg1) (arg1)->hook_state = arg2;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_hook_state_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    switch_channel_state_t result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_hook_state_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result =  ((arg1)->hook_state);
+    ST(argvi) = SWIG_NewPointerObj((new switch_channel_state_t(static_cast< const switch_channel_state_t& >(result))), SWIGTYPE_p_switch_channel_state_t, SWIG_POINTER_OWN | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_addBody) {
-		{
-			Event *arg1 = (Event *) 0;
-			char *arg2 = (char *) 0;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Event_addBody(self,value);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (bool) (arg1)->addBody((char const *) arg2);
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_uuid_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_uuid_set(self,uuid);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_uuid_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_uuid_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->uuid) delete[] arg1->uuid;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->uuid = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->uuid = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Event_addHeader) {
-		{
-			Event *arg1 = (Event *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: Event_addHeader(self,header_name,value);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3" " of type '" "char const *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			result = (bool) (arg1)->addHeader((char const *) arg2, (char const *) arg3);
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_Event_delHeader) {
-		{
-			Event *arg1 = (Event *) 0;
-			char *arg2 = (char *) 0;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Event_delHeader(self,header_name);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (bool) (arg1)->delHeader((char const *) arg2);
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_Event_fire) {
-		{
-			Event *arg1 = (Event *) 0;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Event_fire(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1" " of type '" "Event *" "'");
-			}
-			arg1 = reinterpret_cast < Event * >(argp1);
-			result = (bool) (arg1)->fire();
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_delete_CoreSession) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: delete_CoreSession(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			delete arg1;
-
-
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_session_set) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			switch_core_session_t *arg2 = (switch_core_session_t *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2 = 0;
-			int res2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_session_set(self,session);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2),
-									"in method '" "CoreSession_session_set" "', argument " "2" " of type '" "switch_core_session_t *" "'");
-			}
-			arg2 = reinterpret_cast < switch_core_session_t *>(argp2);
-			if (arg1)
-				(arg1)->session = arg2;
-
-
-
-
-			XSRETURN(argvi);
-		  fail:
-
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_session_get) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			switch_core_session_t *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_session_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (switch_core_session_t *) ((arg1)->session);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0);
-			argvi++;
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_uuid_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_uuid_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_uuid_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (char *) ((arg1)->uuid);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_CoreSession_channel_set) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			switch_channel_t *arg2 = (switch_channel_t *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2 = 0;
-			int res2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_channel_set(self,channel);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2" " of type '" "switch_channel_t *" "'");
-			}
-			arg2 = reinterpret_cast < switch_channel_t *>(argp2);
-			if (arg1)
-				(arg1)->channel = arg2;
+XS(_wrap_CoreSession_tts_name_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_tts_name_set(self,tts_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_tts_name_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_tts_name_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->tts_name) delete[] arg1->tts_name;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->tts_name = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->tts_name = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_CoreSession_tts_name_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_tts_name_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_tts_name_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (char *) ((arg1)->tts_name);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_voice_name_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_voice_name_set(self,voice_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_voice_name_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_voice_name_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->voice_name) delete[] arg1->voice_name;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->voice_name = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->voice_name = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_voice_name_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_voice_name_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_voice_name_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (char *) ((arg1)->voice_name);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_CoreSession_channel_get) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			switch_channel_t *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_channel_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (switch_channel_t *) ((arg1)->channel);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0);
-			argvi++;
+XS(_wrap_CoreSession_answer) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_answer(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (int)(arg1)->answer();
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_preAnswer) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_preAnswer(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (int)(arg1)->preAnswer();
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_CoreSession_flags_set) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			unsigned int arg2;
-			void *argp1 = 0;
-			int res1 = 0;
-			unsigned int val2;
-			int ecode2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_flags_set(self,flags);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-			if (!SWIG_IsOK(ecode2)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2" " of type '" "unsigned int" "'");
-			}
-			arg2 = static_cast < unsigned int >(val2);
-			if (arg1)
-				(arg1)->flags = arg2;
+XS(_wrap_CoreSession_hangup__SWIG_0) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_hangup(self,cause);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    (arg1)->hangup(arg2);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_CoreSession_hangup__SWIG_1) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_hangup(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    (arg1)->hangup();
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_hangup) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'CoreSession_hangup'");
+  XSRETURN(0);
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_setVariable) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_setVariable(self,var,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    (arg1)->setVariable(arg2,arg3);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_CoreSession_flags_get) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			unsigned int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_flags_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (unsigned int) ((arg1)->flags);
-			ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast < unsigned int >(result));
-			argvi++;
+XS(_wrap_CoreSession_setPrivate) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *arg3 = (void *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_setPrivate(self,var,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_ConvertPtr(ST(2),SWIG_as_voidptrptr(&arg3), 0, 0);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3"" of type '" "void *""'"); 
+    }
+    (arg1)->setPrivate(arg2,arg3);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_getPrivate) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_getPrivate(self,var);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (void *)(arg1)->getPrivate(arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_CoreSession_allocated_set) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			int arg2;
-			void *argp1 = 0;
-			int res1 = 0;
-			int val2;
-			int ecode2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_allocated_set(self,allocated);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-			if (!SWIG_IsOK(ecode2)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2" " of type '" "int" "'");
-			}
-			arg2 = static_cast < int >(val2);
-			if (arg1)
-				(arg1)->allocated = arg2;
+XS(_wrap_CoreSession_getVariable) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_getVariable(self,var);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (char *)(arg1)->getVariable(arg2);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_CoreSession_process_callback_result) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    switch_status_t result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_process_callback_result(self,result);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_process_callback_result" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (arg1)->process_callback_result(arg2);
+    ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_say) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
+    char *arg5 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int res5 ;
+    char *buf5 = 0 ;
+    int alloc5 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: CoreSession_say(self,tosay,module_name,say_type,say_method);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
+    if (!SWIG_IsOK(res5)) {
+      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5"" of type '" "char const *""'");
+    }
+    arg5 = reinterpret_cast< char * >(buf5);
+    (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_sayPhrase__SWIG_0) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data,phrase_lang);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_CoreSession_allocated_get) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_allocated_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (int) ((arg1)->allocated);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
+XS(_wrap_CoreSession_sayPhrase__SWIG_1) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_sayPhrase__SWIG_2) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    (arg1)->sayPhrase((char const *)arg2);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_CoreSession_cb_state_set) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			input_callback_state *arg2 = (input_callback_state *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2 = 0;
-			int res2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_cb_state_set(self,cb_state);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_input_callback_state, 0 | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2),
-									"in method '" "CoreSession_cb_state_set" "', argument " "2" " of type '" "input_callback_state *" "'");
-			}
-			arg2 = reinterpret_cast < input_callback_state * >(argp2);
-			if (arg1)
-				(arg1)->cb_state = *arg2;
+XS(_wrap_CoreSession_sayPhrase) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+    if (items == 4) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 3;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_3:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_2); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_1); return;
+    case 3:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'CoreSession_sayPhrase'");
+  XSRETURN(0);
+}
 
 
+XS(_wrap_CoreSession_recordFile__SWIG_0) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    int arg4 ;
+    int arg5 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold,silence_secs);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5"" of type '" "int""'");
+    } 
+    arg5 = static_cast< int >(val5);
+    result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_recordFile__SWIG_1) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    int arg4 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    result = (int)(arg1)->recordFile(arg2,arg3,arg4);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_recordFile__SWIG_2) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    result = (int)(arg1)->recordFile(arg2,arg3);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_CoreSession_cb_state_get) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			input_callback_state *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_cb_state_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (input_callback_state *) & ((arg1)->cb_state);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | SWIG_SHADOW);
-			argvi++;
+XS(_wrap_CoreSession_recordFile__SWIG_3) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_recordFile(self,file_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (int)(arg1)->recordFile(arg2);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_hook_state_set) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			switch_channel_state_t arg2;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2;
-			int res2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_hook_state_set(self,hook_state);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			{
-				res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_channel_state_t, 0);
-				if (!SWIG_IsOK(res2)) {
-					SWIG_exception_fail(SWIG_ArgError(res2),
-										"in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '" "switch_channel_state_t" "'");
-				}
-				if (!argp2) {
-					SWIG_exception_fail(SWIG_ValueError,
-										"invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '"
-										"switch_channel_state_t" "'");
-				} else {
-					arg2 = *(reinterpret_cast < switch_channel_state_t *>(argp2));
-				}
-			}
-			if (arg1)
-				(arg1)->hook_state = arg2;
-
-
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_hook_state_get) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			switch_channel_state_t result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_hook_state_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = ((arg1)->hook_state);
-			ST(argvi) =
-				SWIG_NewPointerObj((new switch_channel_state_t (static_cast < const switch_channel_state_t &>(result))), SWIGTYPE_p_switch_channel_state_t,
-								   SWIG_POINTER_OWN | 0);
-			argvi++;
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_answer) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_answer(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (int) (arg1)->answer();
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_preAnswer) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_preAnswer(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (int) (arg1)->preAnswer();
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_hangup__SWIG_0) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_hangup(self,cause);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			(arg1)->hangup(arg2);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_hangup__SWIG_1) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_hangup(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			(arg1)->hangup();
-
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_hangup) {
-		dXSARGS;
-
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 1) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_1:
-
-			if (items == 2) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_1);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_0);
-				return;
-			}
-		}
-
-		croak("No matching function for overloaded 'CoreSession_hangup'");
-		XSRETURN(0);
-	}
-
-
-	XS(_wrap_CoreSession_setVariable) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: CoreSession_setVariable(self,var,val);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3" " of type '" "char *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			(arg1)->setVariable(arg2, arg3);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_setPrivate) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			void *arg3 = (void *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: CoreSession_setPrivate(self,var,val);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_ConvertPtr(ST(2), SWIG_as_voidptrptr(&arg3), 0, 0);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3" " of type '" "void *" "'");
-			}
-			(arg1)->setPrivate(arg2, arg3);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_getPrivate) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			void *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_getPrivate(self,var);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (void *) (arg1)->getPrivate(arg2);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_getVariable) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_getVariable(self,var);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (char *) (arg1)->getVariable(arg2);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_process_callback_result) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			switch_status_t result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_process_callback_result(self,result);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "CoreSession_process_callback_result" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (arg1)->process_callback_result(arg2);
-			ST(argvi) =
-				SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
-								   SWIG_POINTER_OWN | 0);
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_say) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			char *arg4 = (char *) 0;
-			char *arg5 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int res4;
-			char *buf4 = 0;
-			int alloc4 = 0;
-			int res5;
-			char *buf5 = 0;
-			int alloc5 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 5) || (items > 5)) {
-				SWIG_croak("Usage: CoreSession_say(self,tosay,module_name,say_type,say_method);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3" " of type '" "char const *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-			if (!SWIG_IsOK(res4)) {
-				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4" " of type '" "char const *" "'");
-			}
-			arg4 = reinterpret_cast < char *>(buf4);
-			res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
-			if (!SWIG_IsOK(res5)) {
-				SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5" " of type '" "char const *" "'");
-			}
-			arg5 = reinterpret_cast < char *>(buf5);
-			(arg1)->say((char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-			if (alloc5 == SWIG_NEWOBJ)
-				delete[]buf5;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-			if (alloc5 == SWIG_NEWOBJ)
-				delete[]buf5;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_sayPhrase__SWIG_0) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			char *arg4 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int res4;
-			char *buf4 = 0;
-			int alloc4 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 4) || (items > 4)) {
-				SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data,phrase_lang);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-			if (!SWIG_IsOK(res4)) {
-				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4" " of type '" "char const *" "'");
-			}
-			arg4 = reinterpret_cast < char *>(buf4);
-			(arg1)->sayPhrase((char const *) arg2, (char const *) arg3, (char const *) arg4);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_sayPhrase__SWIG_1) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			(arg1)->sayPhrase((char const *) arg2, (char const *) arg3);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_sayPhrase__SWIG_2) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			(arg1)->sayPhrase((char const *) arg2);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_sayPhrase) {
-		dXSARGS;
-
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 2) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_1:
-
-			if (items == 3) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-			if (items == 4) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_3;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_3;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_3;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_3;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 3;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_3:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_2);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_1);
-				return;
-			case 3:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_0);
-				return;
-			}
-		}
-
-		croak("No matching function for overloaded 'CoreSession_sayPhrase'");
-		XSRETURN(0);
-	}
-
-
-	XS(_wrap_CoreSession_recordFile__SWIG_0) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			int arg3;
-			int arg4;
-			int arg5;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int val3;
-			int ecode3 = 0;
-			int val4;
-			int ecode4 = 0;
-			int val5;
-			int ecode5 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 5) || (items > 5)) {
-				SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold,silence_secs);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-			if (!SWIG_IsOK(ecode3)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
-			}
-			arg3 = static_cast < int >(val3);
-			ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
-			if (!SWIG_IsOK(ecode4)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
-			}
-			arg4 = static_cast < int >(val4);
-			ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
-			if (!SWIG_IsOK(ecode5)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5" " of type '" "int" "'");
-			}
-			arg5 = static_cast < int >(val5);
-			result = (int) (arg1)->recordFile(arg2, arg3, arg4, arg5);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-
-
-
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-
-
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_recordFile__SWIG_1) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			int arg3;
-			int arg4;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int val3;
-			int ecode3 = 0;
-			int val4;
-			int ecode4 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 4) || (items > 4)) {
-				SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-			if (!SWIG_IsOK(ecode3)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
-			}
-			arg3 = static_cast < int >(val3);
-			ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
-			if (!SWIG_IsOK(ecode4)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
-			}
-			arg4 = static_cast < int >(val4);
-			result = (int) (arg1)->recordFile(arg2, arg3, arg4);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-
-
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_recordFile__SWIG_2) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			int arg3;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int val3;
-			int ecode3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-			if (!SWIG_IsOK(ecode3)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
-			}
-			arg3 = static_cast < int >(val3);
-			result = (int) (arg1)->recordFile(arg2, arg3);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_recordFile__SWIG_3) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_recordFile(self,file_name);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (int) (arg1)->recordFile(arg2);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_recordFile) {
-		dXSARGS;
-
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 2) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_1:
-
-			if (items == 3) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					{
-						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
-						_v = SWIG_CheckState(res);
-					}
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-			if (items == 4) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_3;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_3;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					{
-						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
-						_v = SWIG_CheckState(res);
-					}
-				}
-				if (!_v)
-					goto check_3;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					{
-						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
-						_v = SWIG_CheckState(res);
-					}
-				}
-				if (!_v)
-					goto check_3;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 3;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_3:
-
-			if (items == 5) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_4;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_4;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					{
-						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
-						_v = SWIG_CheckState(res);
-					}
-				}
-				if (!_v)
-					goto check_4;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					{
-						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
-						_v = SWIG_CheckState(res);
-					}
-				}
-				if (!_v)
-					goto check_4;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					{
-						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
-						_v = SWIG_CheckState(res);
-					}
-				}
-				if (!_v)
-					goto check_4;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 4;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_4:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_3);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_2);
-				return;
-			case 3:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_1);
-				return;
-			case 4:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_0);
-				return;
-			}
-		}
-
-		croak("No matching function for overloaded 'CoreSession_recordFile'");
-		XSRETURN(0);
-	}
-
-
-	XS(_wrap_CoreSession_setCallerData) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: CoreSession_setCallerData(self,var,val);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3" " of type '" "char *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			(arg1)->setCallerData(arg2, arg3);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_originate__SWIG_0) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			CoreSession *arg2 = (CoreSession *) 0;
-			char *arg3 = (char *) 0;
-			int arg4;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2 = 0;
-			int res2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int val4;
-			int ecode4 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 4) || (items > 4)) {
-				SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest,timeout);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
-			}
-			arg2 = reinterpret_cast < CoreSession * >(argp2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
-			if (!SWIG_IsOK(ecode4)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4" " of type '" "int" "'");
-			}
-			arg4 = static_cast < int >(val4);
-			result = (int) (arg1)->originate(arg2, arg3, arg4);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-
-			XSRETURN(argvi);
-		  fail:
-
-
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_originate__SWIG_1) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			CoreSession *arg2 = (CoreSession *) 0;
-			char *arg3 = (char *) 0;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2 = 0;
-			int res2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
-			}
-			arg2 = reinterpret_cast < CoreSession * >(argp2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			result = (int) (arg1)->originate(arg2, arg3);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_originate) {
-		dXSARGS;
-
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 3) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_1:
-
-			if (items == 4) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					{
-						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
-						_v = SWIG_CheckState(res);
-					}
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_1);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_0);
-				return;
-			}
-		}
-
-		croak("No matching function for overloaded 'CoreSession_originate'");
-		XSRETURN(0);
-	}
-
-
-	XS(_wrap_CoreSession_setDTMFCallback) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			void *arg2 = (void *) 0;
-			char *arg3 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: CoreSession_setDTMFCallback(self,cbfunc,funcargs);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2" " of type '" "void *" "'");
-			}
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3" " of type '" "char *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			(arg1)->setDTMFCallback(arg2, arg3);
-
-
-
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_speak) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_speak(self,text);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (int) (arg1)->speak(arg2);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_set_tts_parms) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: CoreSession_set_tts_parms(self,tts_name,voice_name);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3" " of type '" "char *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			(arg1)->set_tts_parms(arg2, arg3);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_collectDigits) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			int arg2;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int val2;
-			int ecode2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_collectDigits(self,timeout);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-			if (!SWIG_IsOK(ecode2)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2" " of type '" "int" "'");
-			}
-			arg2 = static_cast < int >(val2);
-			result = (int) (arg1)->collectDigits(arg2);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-
-			XSRETURN(argvi);
-		  fail:
-
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_getDigits) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			int arg2;
-			char *arg3 = (char *) 0;
-			int arg4;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int val2;
-			int ecode2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int val4;
-			int ecode4 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 4) || (items > 4)) {
-				SWIG_croak("Usage: CoreSession_getDigits(self,maxdigits,terminators,timeout);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-			if (!SWIG_IsOK(ecode2)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2" " of type '" "int" "'");
-			}
-			arg2 = static_cast < int >(val2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3" " of type '" "char *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
-			if (!SWIG_IsOK(ecode4)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4" " of type '" "int" "'");
-			}
-			arg4 = static_cast < int >(val4);
-			result = (char *) (arg1)->getDigits(arg2, arg3, arg4);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
-
-
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-
-			XSRETURN(argvi);
-		  fail:
-
-
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_transfer) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			char *arg4 = (char *) 0;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int res4;
-			char *buf4 = 0;
-			int alloc4 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 4) || (items > 4)) {
-				SWIG_croak("Usage: CoreSession_transfer(self,extensions,dialplan,context);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3" " of type '" "char *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-			if (!SWIG_IsOK(res4)) {
-				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4" " of type '" "char *" "'");
-			}
-			arg4 = reinterpret_cast < char *>(buf4);
-			result = (int) (arg1)->transfer(arg2, arg3, arg4);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_read) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			int arg2;
-			int arg3;
-			char *arg4 = (char *) 0;
-			int arg5;
-			char *arg6 = (char *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int val2;
-			int ecode2 = 0;
-			int val3;
-			int ecode3 = 0;
-			int res4;
-			char *buf4 = 0;
-			int alloc4 = 0;
-			int val5;
-			int ecode5 = 0;
-			int res6;
-			char *buf6 = 0;
-			int alloc6 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 6) || (items > 6)) {
-				SWIG_croak("Usage: CoreSession_read(self,min_digits,max_digits,prompt_audio_file,timeout,valid_terminators);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-			if (!SWIG_IsOK(ecode2)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2" " of type '" "int" "'");
-			}
-			arg2 = static_cast < int >(val2);
-			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-			if (!SWIG_IsOK(ecode3)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3" " of type '" "int" "'");
-			}
-			arg3 = static_cast < int >(val3);
-			res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
-			if (!SWIG_IsOK(res4)) {
-				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4" " of type '" "char const *" "'");
-			}
-			arg4 = reinterpret_cast < char *>(buf4);
-			ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
-			if (!SWIG_IsOK(ecode5)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5" " of type '" "int" "'");
-			}
-			arg5 = static_cast < int >(val5);
-			res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
-			if (!SWIG_IsOK(res6)) {
-				SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6" " of type '" "char const *" "'");
-			}
-			arg6 = reinterpret_cast < char *>(buf6);
-			result = (char *) (arg1)->read(arg2, arg3, (char const *) arg4, arg5, (char const *) arg6);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
-
-
-
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-
-			if (alloc6 == SWIG_NEWOBJ)
-				delete[]buf6;
-			XSRETURN(argvi);
-		  fail:
-
-
-
-			if (alloc4 == SWIG_NEWOBJ)
-				delete[]buf4;
-
-			if (alloc6 == SWIG_NEWOBJ)
-				delete[]buf6;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_playAndGetDigits) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			int arg2;
-			int arg3;
-			int arg4;
-			int arg5;
-			char *arg6 = (char *) 0;
-			char *arg7 = (char *) 0;
-			char *arg8 = (char *) 0;
-			char *arg9 = (char *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int val2;
-			int ecode2 = 0;
-			int val3;
-			int ecode3 = 0;
-			int val4;
-			int ecode4 = 0;
-			int val5;
-			int ecode5 = 0;
-			int res6;
-			char *buf6 = 0;
-			int alloc6 = 0;
-			int res7;
-			char *buf7 = 0;
-			int alloc7 = 0;
-			int res8;
-			char *buf8 = 0;
-			int alloc8 = 0;
-			int res9;
-			char *buf9 = 0;
-			int alloc9 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 9) || (items > 9)) {
-				SWIG_croak
-					("Usage: CoreSession_playAndGetDigits(self,min_digits,max_digits,max_tries,timeout,terminators,audio_files,bad_input_audio_files,digits_regex);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-			if (!SWIG_IsOK(ecode2)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2" " of type '" "int" "'");
-			}
-			arg2 = static_cast < int >(val2);
-			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-			if (!SWIG_IsOK(ecode3)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3" " of type '" "int" "'");
-			}
-			arg3 = static_cast < int >(val3);
-			ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
-			if (!SWIG_IsOK(ecode4)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4" " of type '" "int" "'");
-			}
-			arg4 = static_cast < int >(val4);
-			ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
-			if (!SWIG_IsOK(ecode5)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5" " of type '" "int" "'");
-			}
-			arg5 = static_cast < int >(val5);
-			res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
-			if (!SWIG_IsOK(res6)) {
-				SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6" " of type '" "char *" "'");
-			}
-			arg6 = reinterpret_cast < char *>(buf6);
-			res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
-			if (!SWIG_IsOK(res7)) {
-				SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7" " of type '" "char *" "'");
-			}
-			arg7 = reinterpret_cast < char *>(buf7);
-			res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
-			if (!SWIG_IsOK(res8)) {
-				SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8" " of type '" "char *" "'");
-			}
-			arg8 = reinterpret_cast < char *>(buf8);
-			res9 = SWIG_AsCharPtrAndSize(ST(8), &buf9, NULL, &alloc9);
-			if (!SWIG_IsOK(res9)) {
-				SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9" " of type '" "char *" "'");
-			}
-			arg9 = reinterpret_cast < char *>(buf9);
-			result = (char *) (arg1)->playAndGetDigits(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
-
-
-
-
-
-			if (alloc6 == SWIG_NEWOBJ)
-				delete[]buf6;
-			if (alloc7 == SWIG_NEWOBJ)
-				delete[]buf7;
-			if (alloc8 == SWIG_NEWOBJ)
-				delete[]buf8;
-			if (alloc9 == SWIG_NEWOBJ)
-				delete[]buf9;
-			XSRETURN(argvi);
-		  fail:
-
-
-
-
-
-			if (alloc6 == SWIG_NEWOBJ)
-				delete[]buf6;
-			if (alloc7 == SWIG_NEWOBJ)
-				delete[]buf7;
-			if (alloc8 == SWIG_NEWOBJ)
-				delete[]buf8;
-			if (alloc9 == SWIG_NEWOBJ)
-				delete[]buf9;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_streamFile__SWIG_0) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			int arg3;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int val3;
-			int ecode3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: CoreSession_streamFile(self,file,starting_sample_count);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
-			if (!SWIG_IsOK(ecode3)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3" " of type '" "int" "'");
-			}
-			arg3 = static_cast < int >(val3);
-			result = (int) (arg1)->streamFile(arg2, arg3);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_streamFile__SWIG_1) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_streamFile(self,file);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			result = (int) (arg1)->streamFile(arg2);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_streamFile) {
-		dXSARGS;
-
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 2) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_1:
-
-			if (items == 3) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					{
-						int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
-						_v = SWIG_CheckState(res);
-					}
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_1);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_0);
-				return;
-			}
-		}
-
-		croak("No matching function for overloaded 'CoreSession_streamFile'");
-		XSRETURN(0);
-	}
-
-
-	XS(_wrap_CoreSession_flushEvents) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_flushEvents(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (int) (arg1)->flushEvents();
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_flushDigits) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_flushDigits(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (int) (arg1)->flushDigits();
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_setAutoHangup) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			bool arg2;
-			int result;
-			void *argp1 = 0;
-			int res1 = 0;
-			bool val2;
-			int ecode2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_setAutoHangup(self,val);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			ecode2 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
-			if (!SWIG_IsOK(ecode2)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2" " of type '" "bool" "'");
-			}
-			arg2 = static_cast < bool > (val2);
-			result = (int) (arg1)->setAutoHangup(arg2);
-			ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
-			argvi++;
-
-
-			XSRETURN(argvi);
-		  fail:
-
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_setHangupHook) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			void *arg2 = (void *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_setHangupHook(self,hangup_func);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2" " of type '" "void *" "'");
-			}
-			(arg1)->setHangupHook(arg2);
-
-
-
-			XSRETURN(argvi);
-		  fail:
-
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_ready) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_ready(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (bool) (arg1)->ready();
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_execute__SWIG_0) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: CoreSession_execute(self,app,data);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3" " of type '" "char *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			(arg1)->execute(arg2, arg3);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_execute__SWIG_1) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *arg2 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_execute(self,app);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			(arg1)->execute(arg2);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
-
-
-	XS(_wrap_CoreSession_execute) {
-		dXSARGS;
-
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 2) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_1:
-
-			if (items == 3) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_1);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_0);
-				return;
-			}
-		}
-
-		croak("No matching function for overloaded 'CoreSession_execute'");
-		XSRETURN(0);
-	}
 
+XS(_wrap_CoreSession_recordFile) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+    if (items == 4) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 3;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_3:
+    
+    if (items == 5) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 4;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_4:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_3); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_2); return;
+    case 3:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_1); return;
+    case 4:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'CoreSession_recordFile'");
+  XSRETURN(0);
+}
 
-	XS(_wrap_CoreSession_sendEvent) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			Event *arg2 = (Event *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2 = 0;
-			int res2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_sendEvent(self,sendME);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2" " of type '" "Event *" "'");
-			}
-			arg2 = reinterpret_cast < Event * >(argp2);
-			(arg1)->sendEvent(arg2);
 
+XS(_wrap_CoreSession_setCallerData) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_setCallerData(self,var,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    (arg1)->setCallerData(arg2,arg3);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_originate__SWIG_0) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    CoreSession *arg2 = (CoreSession *) 0 ;
+    char *arg3 = (char *) 0 ;
+    int arg4 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest,timeout);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'"); 
+    }
+    arg2 = reinterpret_cast< CoreSession * >(argp2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    result = (int)(arg1)->originate(arg2,arg3,arg4);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_originate__SWIG_1) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    CoreSession *arg2 = (CoreSession *) 0 ;
+    char *arg3 = (char *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'"); 
+    }
+    arg2 = reinterpret_cast< CoreSession * >(argp2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    result = (int)(arg1)->originate(arg2,arg3);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_CoreSession_setEventData) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			Event *arg2 = (Event *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2 = 0;
-			int res2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: CoreSession_setEventData(self,e);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_Event, 0 | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2" " of type '" "Event *" "'");
-			}
-			arg2 = reinterpret_cast < Event * >(argp2);
-			(arg1)->setEventData(arg2);
+XS(_wrap_CoreSession_originate) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 4) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'CoreSession_originate'");
+  XSRETURN(0);
+}
 
 
+XS(_wrap_CoreSession_setDTMFCallback) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    void *arg2 = (void *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_setDTMFCallback(self,cbfunc,funcargs);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2"" of type '" "void *""'"); 
+    }
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    (arg1)->setDTMFCallback(arg2,arg3);
+    
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
+XS(_wrap_CoreSession_speak) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_speak(self,text);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (int)(arg1)->speak(arg2);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_CoreSession_set_tts_parms) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_set_tts_parms(self,tts_name,voice_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    (arg1)->set_tts_parms(arg2,arg3);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_CoreSession_getXMLCDR) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_getXMLCDR(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (char *) (arg1)->getXMLCDR();
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_collectDigits) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int arg2 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_collectDigits(self,timeout);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    result = (int)(arg1)->collectDigits(arg2);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_CoreSession_getDigits__SWIG_0) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int arg2 ;
+    char *arg3 = (char *) 0 ;
+    int arg4 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: CoreSession_getDigits(self,maxdigits,terminators,timeout);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    result = (char *)(arg1)->getDigits(arg2,arg3,arg4);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_CoreSession_begin_allow_threads) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_begin_allow_threads(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "CoreSession_begin_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (bool) (arg1)->begin_allow_threads();
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_getDigits__SWIG_1) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int arg2 ;
+    char *arg3 = (char *) 0 ;
+    int arg4 ;
+    int arg5 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: CoreSession_getDigits(self,maxdigits,terminators,timeout,interdigit);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_getDigits" "', argument " "5"" of type '" "int""'");
+    } 
+    arg5 = static_cast< int >(val5);
+    result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_CoreSession_getDigits) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 4) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 5) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_getDigits__SWIG_0); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_getDigits__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'CoreSession_getDigits'");
+  XSRETURN(0);
+}
 
-	XS(_wrap_CoreSession_end_allow_threads) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_end_allow_threads(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "CoreSession_end_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (bool) (arg1)->end_allow_threads();
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_transfer) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: CoreSession_transfer(self,extensions,dialplan,context);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4"" of type '" "char *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    result = (int)(arg1)->transfer(arg2,arg3,arg4);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_CoreSession_read) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    char *arg4 = (char *) 0 ;
+    int arg5 ;
+    char *arg6 = (char *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    int res6 ;
+    char *buf6 = 0 ;
+    int alloc6 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: CoreSession_read(self,min_digits,max_digits,prompt_audio_file,timeout,valid_terminators);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5"" of type '" "int""'");
+    } 
+    arg5 = static_cast< int >(val5);
+    res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+    if (!SWIG_IsOK(res6)) {
+      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6"" of type '" "char const *""'");
+    }
+    arg6 = reinterpret_cast< char * >(buf6);
+    result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    
+    
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_CoreSession_get_uuid) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_get_uuid(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1" " of type '" "CoreSession const *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			result = (char *) ((CoreSession const *) arg1)->get_uuid();
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_playAndGetDigits) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    int arg4 ;
+    int arg5 ;
+    char *arg6 = (char *) 0 ;
+    char *arg7 = (char *) 0 ;
+    char *arg8 = (char *) 0 ;
+    char *arg9 = (char *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    int res6 ;
+    char *buf6 = 0 ;
+    int alloc6 = 0 ;
+    int res7 ;
+    char *buf7 = 0 ;
+    int alloc7 = 0 ;
+    int res8 ;
+    char *buf8 = 0 ;
+    int alloc8 = 0 ;
+    int res9 ;
+    char *buf9 = 0 ;
+    int alloc9 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 9) || (items > 9)) {
+      SWIG_croak("Usage: CoreSession_playAndGetDigits(self,min_digits,max_digits,max_tries,timeout,terminators,audio_files,bad_input_audio_files,digits_regex);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5"" of type '" "int""'");
+    } 
+    arg5 = static_cast< int >(val5);
+    res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+    if (!SWIG_IsOK(res6)) {
+      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6"" of type '" "char *""'");
+    }
+    arg6 = reinterpret_cast< char * >(buf6);
+    res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
+    if (!SWIG_IsOK(res7)) {
+      SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7"" of type '" "char *""'");
+    }
+    arg7 = reinterpret_cast< char * >(buf7);
+    res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
+    if (!SWIG_IsOK(res8)) {
+      SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8"" of type '" "char *""'");
+    }
+    arg8 = reinterpret_cast< char * >(buf8);
+    res9 = SWIG_AsCharPtrAndSize(ST(8), &buf9, NULL, &alloc9);
+    if (!SWIG_IsOK(res9)) {
+      SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *""'");
+    }
+    arg9 = reinterpret_cast< char * >(buf9);
+    result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    
+    
+    
+    
+    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+    if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+    if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+    if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+    if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_CoreSession_streamFile__SWIG_0) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_streamFile(self,file,starting_sample_count);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    result = (int)(arg1)->streamFile(arg2,arg3);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_CoreSession_get_cb_args) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			switch_input_args_t *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_get_cb_args(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "CoreSession_get_cb_args" "', argument " "1" " of type '" "CoreSession const *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			{
-				switch_input_args_t const &_result_ref = ((CoreSession const *) arg1)->get_cb_args();
-				result = (switch_input_args_t *) &_result_ref;
-			}
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0);
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_streamFile__SWIG_1) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_streamFile(self,file);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    result = (int)(arg1)->streamFile(arg2);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_CoreSession_streamFile) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'CoreSession_streamFile'");
+  XSRETURN(0);
+}
 
-	XS(_wrap_CoreSession_check_hangup_hook) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: CoreSession_check_hangup_hook(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "CoreSession_check_hangup_hook" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			(arg1)->check_hangup_hook();
 
+XS(_wrap_CoreSession_sleep) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int arg2 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_sleep(self,ms);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sleep" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_sleep" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    result = (int)(arg1)->sleep(arg2);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_flushEvents) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_flushEvents(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (int)(arg1)->flushEvents();
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_CoreSession_run_dtmf_callback) {
-		{
-			CoreSession *arg1 = (CoreSession *) 0;
-			void *arg2 = (void *) 0;
-			switch_input_type_t arg3;
-			switch_status_t result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			void *argp3;
-			int res3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: CoreSession_run_dtmf_callback(self,input,itype);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "CoreSession_run_dtmf_callback" "', argument " "1" " of type '" "CoreSession *" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
-			}
-			{
-				res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0);
-				if (!SWIG_IsOK(res3)) {
-					SWIG_exception_fail(SWIG_ArgError(res3),
-										"in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
-				}
-				if (!argp3) {
-					SWIG_exception_fail(SWIG_ValueError,
-										"invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '"
-										"switch_input_type_t" "'");
-				} else {
-					arg3 = *(reinterpret_cast < switch_input_type_t *>(argp3));
-				}
-			}
-			result = (arg1)->run_dtmf_callback(arg2, arg3);
-			ST(argvi) =
-				SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
-								   SWIG_POINTER_OWN | 0);
-			argvi++;
+XS(_wrap_CoreSession_flushDigits) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_flushDigits(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (int)(arg1)->flushDigits();
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_setAutoHangup) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    bool arg2 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    bool val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_setAutoHangup(self,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    ecode2 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2"" of type '" "bool""'");
+    } 
+    arg2 = static_cast< bool >(val2);
+    result = (int)(arg1)->setAutoHangup(arg2);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_setHangupHook) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    void *arg2 = (void *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_setHangupHook(self,hangup_func);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2"" of type '" "void *""'"); 
+    }
+    (arg1)->setHangupHook(arg2);
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_console_log) {
-		{
-			char *arg1 = (char *) 0;
-			char *arg2 = (char *) 0;
-			int res1;
-			char *buf1 = 0;
-			int alloc1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: console_log(level_str,msg);");
-			}
-			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1" " of type '" "char *" "'");
-			}
-			arg1 = reinterpret_cast < char *>(buf1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			console_log(arg1, arg2);
-
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_ready) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_ready(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (bool)(arg1)->ready();
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_console_clean_log) {
-		{
-			char *arg1 = (char *) 0;
-			int res1;
-			char *buf1 = 0;
-			int alloc1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: console_clean_log(msg);");
-			}
-			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1" " of type '" "char *" "'");
-			}
-			arg1 = reinterpret_cast < char *>(buf1);
-			console_clean_log(arg1);
-
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			XSRETURN(argvi);
-		  fail:
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_CoreSession_answered) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_answered(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answered" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (bool)(arg1)->answered();
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_bridge) {
-		{
-			CoreSession *arg1 = 0;
-			CoreSession *arg2 = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2 = 0;
-			int res2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: bridge(session_a,session_b);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
-			}
-			if (!argp1) {
-				SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
-			}
-			arg1 = reinterpret_cast < CoreSession * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
-			}
-			if (!argp2) {
-				SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
-			}
-			arg2 = reinterpret_cast < CoreSession * >(argp2);
-			bridge(*arg1, *arg2);
+XS(_wrap_CoreSession_mediaReady) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_mediaReady(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_mediaReady" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (bool)(arg1)->mediaReady();
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_CoreSession_waitForAnswer) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    CoreSession *arg2 = (CoreSession *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_waitForAnswer(self,calling_session);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_waitForAnswer" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_waitForAnswer" "', argument " "2"" of type '" "CoreSession *""'"); 
+    }
+    arg2 = reinterpret_cast< CoreSession * >(argp2);
+    (arg1)->waitForAnswer(arg2);
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
+XS(_wrap_CoreSession_execute__SWIG_0) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_execute(self,app,data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    (arg1)->execute(arg2,arg3);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_CoreSession_execute__SWIG_1) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_execute(self,app);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    (arg1)->execute(arg2);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_hanguphook) {
-		{
-			switch_core_session_t *arg1 = (switch_core_session_t *) 0;
-			switch_status_t result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: hanguphook(session);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1" " of type '" "switch_core_session_t *" "'");
-			}
-			arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
-			result = hanguphook(arg1);
-			ST(argvi) =
-				SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
-								   SWIG_POINTER_OWN | 0);
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_execute) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'CoreSession_execute'");
+  XSRETURN(0);
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_CoreSession_sendEvent) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    Event *arg2 = (Event *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_sendEvent(self,sendME);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2"" of type '" "Event *""'"); 
+    }
+    arg2 = reinterpret_cast< Event * >(argp2);
+    (arg1)->sendEvent(arg2);
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_dtmf_callback) {
-		{
-			switch_core_session_t *arg1 = (switch_core_session_t *) 0;
-			void *arg2 = (void *) 0;
-			switch_input_type_t arg3;
-			void *arg4 = (void *) 0;
-			unsigned int arg5;
-			switch_status_t result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			void *argp3;
-			int res3 = 0;
-			int res4;
-			unsigned int val5;
-			int ecode5 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 5) || (items > 5)) {
-				SWIG_croak("Usage: dtmf_callback(session,input,itype,buf,buflen);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1" " of type '" "switch_core_session_t *" "'");
-			}
-			arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2" " of type '" "void *" "'");
-			}
-			{
-				res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0);
-				if (!SWIG_IsOK(res3)) {
-					SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
-				}
-				if (!argp3) {
-					SWIG_exception_fail(SWIG_ValueError,
-										"invalid null reference " "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
-				} else {
-					arg3 = *(reinterpret_cast < switch_input_type_t *>(argp3));
-				}
-			}
-			res4 = SWIG_ConvertPtr(ST(3), SWIG_as_voidptrptr(&arg4), 0, 0);
-			if (!SWIG_IsOK(res4)) {
-				SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4" " of type '" "void *" "'");
-			}
-			ecode5 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
-			if (!SWIG_IsOK(ecode5)) {
-				SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5" " of type '" "unsigned int" "'");
-			}
-			arg5 = static_cast < unsigned int >(val5);
-			result = dtmf_callback(arg1, arg2, arg3, arg4, arg5);
-			ST(argvi) =
-				SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
-								   SWIG_POINTER_OWN | 0);
-			argvi++;
 
+XS(_wrap_CoreSession_setEventData) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    Event *arg2 = (Event *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_setEventData(self,e);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_Event, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2"" of type '" "Event *""'"); 
+    }
+    arg2 = reinterpret_cast< Event * >(argp2);
+    (arg1)->setEventData(arg2);
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_CoreSession_getXMLCDR) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_getXMLCDR(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (char *)(arg1)->getXMLCDR();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
+XS(_wrap_CoreSession_begin_allow_threads) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_begin_allow_threads(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (bool)(arg1)->begin_allow_threads();
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
+XS(_wrap_CoreSession_end_allow_threads) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_end_allow_threads(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (bool)(arg1)->end_allow_threads();
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_CoreSession_get_uuid) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_get_uuid(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1"" of type '" "CoreSession const *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (char *)((CoreSession const *)arg1)->get_uuid();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_new_Session__SWIG_0) {
-		{
-			PERL::Session * result = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 0) || (items > 0)) {
-				SWIG_croak("Usage: new_Session();");
-			}
-			result = (PERL::Session *) new PERL::Session();
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
-			XSRETURN(argvi);
-		  fail:
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_CoreSession_get_cb_args) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    switch_input_args_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_get_cb_args(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_cb_args" "', argument " "1"" of type '" "CoreSession const *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    {
+      switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
+      result = (switch_input_args_t *) &_result_ref;
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_new_Session__SWIG_1) {
-		{
-			char *arg1 = (char *) 0;
-			PERL::Session * result = 0;
-			int res1;
-			char *buf1 = 0;
-			int alloc1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: new_Session(uuid);");
-			}
-			res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1" " of type '" "char *" "'");
-			}
-			arg1 = reinterpret_cast < char *>(buf1);
-			result = (PERL::Session *) new PERL::Session(arg1);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			XSRETURN(argvi);
-		  fail:
-			if (alloc1 == SWIG_NEWOBJ)
-				delete[]buf1;
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_CoreSession_check_hangup_hook) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_check_hangup_hook(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_check_hangup_hook" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    (arg1)->check_hangup_hook();
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_new_Session__SWIG_2) {
-		{
-			switch_core_session_t *arg1 = (switch_core_session_t *) 0;
-			PERL::Session * result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: new_Session(session);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1" " of type '" "switch_core_session_t *" "'");
-			}
-			arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
-			result = (PERL::Session *) new PERL::Session(arg1);
-			ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_CoreSession_run_dtmf_callback) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    void *arg2 = (void *) 0 ;
+    switch_input_type_t arg3 ;
+    switch_status_t result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    void *argp3 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_run_dtmf_callback(self,input,itype);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_run_dtmf_callback" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
+    }
+    {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t,  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
+      }  
+      if (!argp3) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
+      } else {
+        arg3 = *(reinterpret_cast< switch_input_type_t * >(argp3));
+      }
+    }
+    result = (arg1)->run_dtmf_callback(arg2,arg3);
+    ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_console_log) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: console_log(level_str,msg);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    console_log(arg1,arg2);
+    
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_new_Session) {
-		dXSARGS;
 
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 0) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-			if (items == 1) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_core_session_t, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-			if (items == 1) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_3;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 3;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_3:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_new_Session__SWIG_0);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_new_Session__SWIG_2);
-				return;
-			case 3:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_new_Session__SWIG_1);
-				return;
-			}
-		}
+XS(_wrap_console_clean_log) {
+  {
+    char *arg1 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: console_clean_log(msg);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    console_clean_log(arg1);
+    
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
 
-		croak("No matching function for overloaded 'new_Session'");
-		XSRETURN(0);
-	}
 
+XS(_wrap_bridge) {
+  {
+    CoreSession *arg1 = 0 ;
+    CoreSession *arg2 = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: bridge(session_a,session_b);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession,  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'"); 
+    }
+    if (!argp1) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession,  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'"); 
+    }
+    if (!argp2) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'"); 
+    }
+    arg2 = reinterpret_cast< CoreSession * >(argp2);
+    bridge(*arg1,*arg2);
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_delete_Session) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: delete_Session(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, SWIG_POINTER_DISOWN | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Session" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			delete arg1;
 
+XS(_wrap_hanguphook) {
+  {
+    switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+    switch_status_t result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: hanguphook(session);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
+    }
+    arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
+    result = hanguphook(arg1);
+    ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_dtmf_callback) {
+  {
+    switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+    void *arg2 = (void *) 0 ;
+    switch_input_type_t arg3 ;
+    void *arg4 = (void *) 0 ;
+    unsigned int arg5 ;
+    switch_status_t result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    void *argp3 ;
+    int res3 = 0 ;
+    int res4 ;
+    unsigned int val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: dtmf_callback(session,input,itype,buf,buflen);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
+    }
+    arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
+    }
+    {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t,  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
+      }  
+      if (!argp3) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
+      } else {
+        arg3 = *(reinterpret_cast< switch_input_type_t * >(argp3));
+      }
+    }
+    res4 = SWIG_ConvertPtr(ST(3),SWIG_as_voidptrptr(&arg4), 0, 0);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4"" of type '" "void *""'"); 
+    }
+    ecode5 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5"" of type '" "unsigned int""'");
+    } 
+    arg5 = static_cast< unsigned int >(val5);
+    result = dtmf_callback(arg1,arg2,arg3,arg4,arg5);
+    ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_new_Session__SWIG_0) {
+  {
+    PERL::Session *result = 0 ;
+    int argvi = 0;
+    SV *foo;
+    dXSARGS;
 
-	XS(_wrap_Session_begin_allow_threads) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Session_begin_allow_threads(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "Session_begin_allow_threads" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			result = (bool) (arg1)->begin_allow_threads();
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: new_Session();");
+    }
+    result = (PERL::Session *)new PERL::Session(); 
+	result->setPERL(my_perl);
+	foo = sv_newmortal();
+	SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+	result->setME(foo);	
+	ST(argvi) = foo; argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
-			SWIG_croak_null();
-		}
+XS(_wrap_new_Session__SWIG_1) {
+  {
+    char *arg1 = (char *) 0 ;
+    CoreSession *arg2 = (CoreSession *) 0 ;
+    PERL::Session *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+	SV *foo;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: new_Session(uuid,a_leg);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Session" "', argument " "2"" of type '" "CoreSession *""'"); 
+    }
+    arg2 = reinterpret_cast< CoreSession * >(argp2);
+    result = (PERL::Session *)new PERL::Session(arg1,arg2);
+	if (result->allocated) {
+		result->setPERL(my_perl);
+		foo = get_sv(result->suuid, TRUE);
+		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+		result->setME(foo);	
+	} else {
+		foo = sv_newmortal();
+		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
 	}
+	ST(argvi) = foo; argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    SWIG_croak_null();
+  }
+}
 
 
-	XS(_wrap_Session_end_allow_threads) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Session_end_allow_threads(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_end_allow_threads" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			result = (bool) (arg1)->end_allow_threads();
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
-
-			XSRETURN(argvi);
-		  fail:
-
-			SWIG_croak_null();
-		}
+XS(_wrap_new_Session__SWIG_2) {
+  {
+    char *arg1 = (char *) 0 ;
+    PERL::Session *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+	SV *foo;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_Session(uuid);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    result = (PERL::Session *)new PERL::Session(arg1); 
+	if (result->allocated) {
+		result->setPERL(my_perl);
+		foo = get_sv(result->suuid, TRUE);
+		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+		result->setME(foo);	
+	} else {
+		foo = sv_newmortal();
+		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
 	}
+	ST(argvi) = foo; argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
 
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_check_hangup_hook) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Session_check_hangup_hook(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_check_hangup_hook" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			(arg1)->check_hangup_hook();
 
+XS(_wrap_new_Session__SWIG_3) {
+  {
+    switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+    PERL::Session *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    SV *foo;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_Session(session);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
+    }
+    arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
+    result = (PERL::Session *)new PERL::Session(arg1);
+	if (result->allocated) {
+		result->setPERL(my_perl);
+		foo = get_sv(result->suuid, TRUE);
+		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+		result->setME(foo);	
+	} else {
+		foo = sv_newmortal();
+		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+	}
 
-			XSRETURN(argvi);
-		  fail:
+	ST(argvi) = foo; argvi++ ;
+	
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_new_Session) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 0) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_core_session_t, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 3;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_3:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 4;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_4:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_0); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_3); return;
+    case 3:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_2); return;
+    case 4:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'new_Session'");
+  XSRETURN(0);
+}
 
-	XS(_wrap_Session_run_dtmf_callback) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			void *arg2 = (void *) 0;
-			switch_input_type_t arg3;
-			switch_status_t result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			void *argp3;
-			int res3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: Session_run_dtmf_callback(self,input,itype);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_run_dtmf_callback" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
-			}
-			{
-				res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0);
-				if (!SWIG_IsOK(res3)) {
-					SWIG_exception_fail(SWIG_ArgError(res3),
-										"in method '" "Session_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
-				}
-				if (!argp3) {
-					SWIG_exception_fail(SWIG_ValueError,
-										"invalid null reference " "in method '" "Session_run_dtmf_callback" "', argument " "3" " of type '"
-										"switch_input_type_t" "'");
-				} else {
-					arg3 = *(reinterpret_cast < switch_input_type_t *>(argp3));
-				}
-			}
-			result = (arg1)->run_dtmf_callback(arg2, arg3);
-			ST(argvi) =
-				SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
-								   SWIG_POINTER_OWN | 0);
-			argvi++;
 
+XS(_wrap_delete_Session) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_Session(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Session" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			XSRETURN(argvi);
-		  fail:
 
+XS(_wrap_Session_begin_allow_threads) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_begin_allow_threads(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_begin_allow_threads" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    result = (bool)(arg1)->begin_allow_threads();
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_end_allow_threads) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_end_allow_threads(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_end_allow_threads" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    result = (bool)(arg1)->end_allow_threads();
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_setInputCallback) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: Session_setInputCallback(self,cbfunc,funcargs);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setInputCallback" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setInputCallback" "', argument " "3" " of type '" "char *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			(arg1)->setInputCallback(arg2, arg3);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_check_hangup_hook) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_check_hangup_hook(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_check_hangup_hook" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    (arg1)->check_hangup_hook();
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_setHangupHook__SWIG_0) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			char *arg2 = (char *) 0;
-			char *arg3 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int res3;
-			char *buf3 = 0;
-			int alloc3 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 3) || (items > 3)) {
-				SWIG_croak("Usage: Session_setHangupHook(self,func,arg);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setHangupHook" "', argument " "3" " of type '" "char *" "'");
-			}
-			arg3 = reinterpret_cast < char *>(buf3);
-			(arg1)->setHangupHook(arg2, arg3);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			if (alloc3 == SWIG_NEWOBJ)
-				delete[]buf3;
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_run_dtmf_callback) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    void *arg2 = (void *) 0 ;
+    switch_input_type_t arg3 ;
+    switch_status_t result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    void *argp3 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Session_run_dtmf_callback(self,input,itype);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_run_dtmf_callback" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
+    }
+    {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t,  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
+      }  
+      if (!argp3) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
+      } else {
+        arg3 = *(reinterpret_cast< switch_input_type_t * >(argp3));
+      }
+    }
+    result = (arg1)->run_dtmf_callback(arg2,arg3);
+    ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_setHangupHook__SWIG_1) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			char *arg2 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Session_setHangupHook(self,func);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			(arg1)->setHangupHook(arg2);
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_setME) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    SV *arg2 = (SV *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_setME(self,p);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setME" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    arg2 = ST(1);
+    (arg1)->setME(arg2);
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_setHangupHook) {
-		dXSARGS;
 
-		{
-			unsigned long _index = 0;
-			SWIG_TypeRank _rank = 0;
-			if (items == 2) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_1;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 1;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_1:
-
-			if (items == 3) {
-				SWIG_TypeRank _ranki = 0;
-				SWIG_TypeRank _rankm = 0;
-				SWIG_TypeRank _pi = 1;
-				int _v = 0;
-				{
-					void *vptr = 0;
-					int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				{
-					int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-				}
-				if (!_v)
-					goto check_2;
-				_ranki += _v * _pi;
-				_rankm += _pi;
-				_pi *= SWIG_MAXCASTRANK;
-				if (!_index || (_ranki < _rank)) {
-					_rank = _ranki;
-					_index = 2;
-					if (_rank == _rankm)
-						goto dispatch;
-				}
-			}
-		  check_2:
-
-		  dispatch:
-			switch (_index) {
-			case 1:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_1);
-				return;
-			case 2:
-				++PL_markstack_ptr;
-				SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_0);
-				return;
-			}
-		}
+XS(_wrap_Session_setInputCallback__SWIG_0) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Session_setInputCallback(self,cbfunc,funcargs);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setInputCallback" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setInputCallback" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    (arg1)->setInputCallback(arg2,arg3);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
-		croak("No matching function for overloaded 'Session_setHangupHook'");
-		XSRETURN(0);
-	}
 
+XS(_wrap_Session_setInputCallback__SWIG_1) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_setInputCallback(self,cbfunc);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setInputCallback" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    (arg1)->setInputCallback(arg2);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_ready) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			bool result;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Session_ready(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_ready" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			result = (bool) (arg1)->ready();
-			ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_Session_setInputCallback__SWIG_2) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_setInputCallback(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    (arg1)->setInputCallback();
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_setInputCallback) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 3;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_3:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setInputCallback__SWIG_2); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setInputCallback__SWIG_1); return;
+    case 3:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setInputCallback__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Session_setInputCallback'");
+  XSRETURN(0);
+}
 
-	XS(_wrap_Session_cb_function_set) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			char *arg2 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Session_cb_function_set(self,cb_function);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_set" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_function_set" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			if (arg1->cb_function)
-				delete[]arg1->cb_function;
-			if (arg2) {
-				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
-				arg1->cb_function =
-					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
-			} else {
-				arg1->cb_function = 0;
-			}
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_setHangupHook__SWIG_0) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Session_setHangupHook(self,func,arg);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setHangupHook" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    (arg1)->setHangupHook(arg2,arg3);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_cb_function_get) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Session_cb_function_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_get" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			result = (char *) ((arg1)->cb_function);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_Session_setHangupHook__SWIG_1) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_setHangupHook(self,func);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    (arg1)->setHangupHook(arg2);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_setHangupHook) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Session_setHangupHook'");
+  XSRETURN(0);
+}
 
-	XS(_wrap_Session_cb_arg_set) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			char *arg2 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Session_cb_arg_set(self,cb_arg);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_set" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_arg_set" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			if (arg1->cb_arg)
-				delete[]arg1->cb_arg;
-			if (arg2) {
-				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
-				arg1->cb_arg =
-					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
-			} else {
-				arg1->cb_arg = 0;
-			}
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_ready) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    bool result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_ready(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_ready" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    result = (bool)(arg1)->ready();
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_cb_arg_get) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Session_cb_arg_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_get" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			result = (char *) ((arg1)->cb_arg);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_Session_suuid_set) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_suuid_set(self,suuid);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_suuid_set" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_suuid_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->suuid) delete[] arg1->suuid;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->suuid = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->suuid = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_suuid_get) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_suuid_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_suuid_get" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    result = (char *) ((arg1)->suuid);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_hangup_func_str_set) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			char *arg2 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Session_hangup_func_str_set(self,hangup_func_str);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "Session_hangup_func_str_set" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_str_set" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			if (arg1->hangup_func_str)
-				delete[]arg1->hangup_func_str;
-			if (arg2) {
-				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
-				arg1->hangup_func_str =
-					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
-			} else {
-				arg1->hangup_func_str = 0;
-			}
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_cb_function_set) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_cb_function_set(self,cb_function);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_set" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_function_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->cb_function) delete[] arg1->cb_function;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->cb_function = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->cb_function = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_hangup_func_str_get) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Session_hangup_func_str_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "Session_hangup_func_str_get" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			result = (char *) ((arg1)->hangup_func_str);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_Session_cb_function_get) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_cb_function_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_get" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    result = (char *) ((arg1)->cb_function);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_cb_arg_set) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_cb_arg_set(self,cb_arg);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_set" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_arg_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->cb_arg) delete[] arg1->cb_arg;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->cb_arg = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->cb_arg = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_hangup_func_arg_set) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			char *arg2 = (char *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int res2;
-			char *buf2 = 0;
-			int alloc2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Session_hangup_func_arg_set(self,hangup_func_arg);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "Session_hangup_func_arg_set" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_arg_set" "', argument " "2" " of type '" "char *" "'");
-			}
-			arg2 = reinterpret_cast < char *>(buf2);
-			if (arg1->hangup_func_arg)
-				delete[]arg1->hangup_func_arg;
-			if (arg2) {
-				size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
-				arg1->hangup_func_arg =
-					(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
-			} else {
-				arg1->hangup_func_arg = 0;
-			}
-
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			XSRETURN(argvi);
-		  fail:
-
-			if (alloc2 == SWIG_NEWOBJ)
-				delete[]buf2;
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_cb_arg_get) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_cb_arg_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_get" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    result = (char *) ((arg1)->cb_arg);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_hangup_func_arg_get) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			char *result = 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 1) || (items > 1)) {
-				SWIG_croak("Usage: Session_hangup_func_arg_get(self);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1),
-									"in method '" "Session_hangup_func_arg_get" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			result = (char *) ((arg1)->hangup_func_arg);
-			ST(argvi) = SWIG_FromCharPtr((const char *) result);
-			argvi++;
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_Session_hangup_func_str_set) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_hangup_func_str_set(self,hangup_func_str);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_str_set" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_str_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->hangup_func_str) delete[] arg1->hangup_func_str;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->hangup_func_str = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->hangup_func_str = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
-			SWIG_croak_null();
-		}
-	}
 
+XS(_wrap_Session_hangup_func_str_get) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_hangup_func_str_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_str_get" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    result = (char *) ((arg1)->hangup_func_str);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
-	XS(_wrap_Session_setPERL) {
-		{
-			PERL::Session * arg1 = (PERL::Session *) 0;
-			PerlInterpreter *arg2 = (PerlInterpreter *) 0;
-			void *argp1 = 0;
-			int res1 = 0;
-			void *argp2 = 0;
-			int res2 = 0;
-			int argvi = 0;
-			dXSARGS;
-
-			if ((items < 2) || (items > 2)) {
-				SWIG_croak("Usage: Session_setPERL(self,pi);");
-			}
-			res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
-			if (!SWIG_IsOK(res1)) {
-				SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setPERL" "', argument " "1" " of type '" "PERL::Session *" "'");
-			}
-			arg1 = reinterpret_cast < PERL::Session * >(argp1);
-			res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_PerlInterpreter, 0 | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setPERL" "', argument " "2" " of type '" "PerlInterpreter *" "'");
-			}
-			arg2 = reinterpret_cast < PerlInterpreter * >(argp2);
-			(arg1)->setPERL(arg2);
 
+XS(_wrap_Session_hangup_func_arg_set) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_hangup_func_arg_set(self,hangup_func_arg);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_arg_set" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_arg_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->hangup_func_arg) delete[] arg1->hangup_func_arg;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->hangup_func_arg = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->hangup_func_arg = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
 
 
-			XSRETURN(argvi);
-		  fail:
+XS(_wrap_Session_hangup_func_arg_get) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_hangup_func_arg_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_arg_get" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    result = (char *) ((arg1)->hangup_func_arg);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
 
 
-			SWIG_croak_null();
-		}
-	}
+XS(_wrap_Session_setPERL) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    PerlInterpreter *arg2 = (PerlInterpreter *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_setPERL(self,pi);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setPERL" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_PerlInterpreter, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setPERL" "', argument " "2"" of type '" "PerlInterpreter *""'"); 
+    }
+    arg2 = reinterpret_cast< PerlInterpreter * >(argp2);
+    (arg1)->setPERL(arg2);
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
 
 
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
-	static void *_p_PERL__SessionTo_p_CoreSession(void *x, int *newmemory) {
-		return (void *) ((CoreSession *) ((PERL::Session *) x));
-	}
-	static swig_type_info _swigt__p_API = { "_p_API", "API *", 0, 0, (void *) "freeswitch::API", 0 };
-	static swig_type_info _swigt__p_CoreSession = { "_p_CoreSession", "CoreSession *", 0, 0, (void *) "freeswitch::CoreSession", 0 };
-	static swig_type_info _swigt__p_Event = { "_p_Event", "Event *", 0, 0, (void *) "freeswitch::Event", 0 };
-	static swig_type_info _swigt__p_IVRMenu = { "_p_IVRMenu", "IVRMenu *", 0, 0, (void *) "freeswitch::IVRMenu", 0 };
-	static swig_type_info _swigt__p_PERL__Session = { "_p_PERL__Session", "PERL::Session *", 0, 0, (void *) "freeswitch::Session", 0 };
-	static swig_type_info _swigt__p_PerlInterpreter = { "_p_PerlInterpreter", "PerlInterpreter *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_Stream = { "_p_Stream", "Stream *", 0, 0, (void *) "freeswitch::Stream", 0 };
-	static swig_type_info _swigt__p_char = { "_p_char", "char *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_input_callback_state =
-		{ "_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void *) "freeswitch::input_callback_state_t", 0 };
-	static swig_type_info _swigt__p_session_flag_t = { "_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_channel_state_t = { "_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_channel_t = { "_p_switch_channel_t", "switch_channel_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_core_session_t = { "_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_event_t = { "_p_switch_event_t", "switch_event_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_input_args_t = { "_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_input_type_t = { "_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_priority_t = { "_p_switch_priority_t", "switch_priority_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_status_t = { "_p_switch_status_t", "switch_status_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_stream_handle_t = { "_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_void = { "_p_void", "void *", 0, 0, (void *) 0, 0 };
-
-	static swig_type_info *swig_type_initial[] = {
-		&_swigt__p_API,
-		&_swigt__p_CoreSession,
-		&_swigt__p_Event,
-		&_swigt__p_IVRMenu,
-		&_swigt__p_PERL__Session,
-		&_swigt__p_PerlInterpreter,
-		&_swigt__p_Stream,
-		&_swigt__p_char,
-		&_swigt__p_input_callback_state,
-		&_swigt__p_session_flag_t,
-		&_swigt__p_switch_channel_state_t,
-		&_swigt__p_switch_channel_t,
-		&_swigt__p_switch_core_session_t,
-		&_swigt__p_switch_event_t,
-		&_swigt__p_switch_input_args_t,
-		&_swigt__p_switch_input_type_t,
-		&_swigt__p_switch_priority_t,
-		&_swigt__p_switch_status_t,
-		&_swigt__p_switch_stream_handle_t,
-		&_swigt__p_void,
-	};
-
-	static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_CoreSession[] =
-		{ {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_PERL__Session, _p_PERL__SessionTo_p_CoreSession, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_PERL__Session[] = { {&_swigt__p_PERL__Session, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_PerlInterpreter[] = { {&_swigt__p_PerlInterpreter, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0}, {0, 0, 0, 0} };
-
-	static swig_cast_info *swig_cast_initial[] = {
-		_swigc__p_API,
-		_swigc__p_CoreSession,
-		_swigc__p_Event,
-		_swigc__p_IVRMenu,
-		_swigc__p_PERL__Session,
-		_swigc__p_PerlInterpreter,
-		_swigc__p_Stream,
-		_swigc__p_char,
-		_swigc__p_input_callback_state,
-		_swigc__p_session_flag_t,
-		_swigc__p_switch_channel_state_t,
-		_swigc__p_switch_channel_t,
-		_swigc__p_switch_core_session_t,
-		_swigc__p_switch_event_t,
-		_swigc__p_switch_input_args_t,
-		_swigc__p_switch_input_type_t,
-		_swigc__p_switch_priority_t,
-		_swigc__p_switch_status_t,
-		_swigc__p_switch_stream_handle_t,
-		_swigc__p_void,
-	};
+static void *_p_PERL__SessionTo_p_CoreSession(void *x, int *newmemory) {
+    return (void *)((CoreSession *)  ((PERL::Session *) x));
+}
+static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)"freeswitch::API", 0};
+static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)"freeswitch::CoreSession", 0};
+static swig_type_info _swigt__p_DTMF = {"_p_DTMF", "DTMF *", 0, 0, (void*)"freeswitch::DTMF", 0};
+static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)"freeswitch::Event", 0};
+static swig_type_info _swigt__p_EventConsumer = {"_p_EventConsumer", "EventConsumer *", 0, 0, (void*)"freeswitch::EventConsumer", 0};
+static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)"freeswitch::IVRMenu", 0};
+static swig_type_info _swigt__p_PERL__Session = {"_p_PERL__Session", "PERL::Session *", 0, 0, (void*)"freeswitch::Session", 0};
+static swig_type_info _swigt__p_PerlInterpreter = {"_p_PerlInterpreter", "PerlInterpreter *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)"freeswitch::Stream", 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)"freeswitch::input_callback_state_t", 0};
+static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_event_node_t = {"_p_switch_event_node_t", "switch_event_node_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_event_types_t = {"_p_switch_event_types_t", "switch_event_types_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_queue_t = {"_p_switch_queue_t", "switch_queue_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_API,
+  &_swigt__p_CoreSession,
+  &_swigt__p_DTMF,
+  &_swigt__p_Event,
+  &_swigt__p_EventConsumer,
+  &_swigt__p_IVRMenu,
+  &_swigt__p_PERL__Session,
+  &_swigt__p_PerlInterpreter,
+  &_swigt__p_Stream,
+  &_swigt__p_char,
+  &_swigt__p_input_callback_state,
+  &_swigt__p_session_flag_t,
+  &_swigt__p_switch_channel_state_t,
+  &_swigt__p_switch_channel_t,
+  &_swigt__p_switch_core_session_t,
+  &_swigt__p_switch_event_node_t,
+  &_swigt__p_switch_event_t,
+  &_swigt__p_switch_event_types_t,
+  &_swigt__p_switch_input_args_t,
+  &_swigt__p_switch_input_type_t,
+  &_swigt__p_switch_priority_t,
+  &_swigt__p_switch_queue_t,
+  &_swigt__p_switch_status_t,
+  &_swigt__p_switch_stream_handle_t,
+  &_swigt__p_uint32_t,
+  &_swigt__p_void,
+};
+
+static swig_cast_info _swigc__p_API[] = {  {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_CoreSession[] = {  {&_swigt__p_CoreSession, 0, 0, 0},  {&_swigt__p_PERL__Session, _p_PERL__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_DTMF[] = {  {&_swigt__p_DTMF, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_Event[] = {  {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_EventConsumer[] = {  {&_swigt__p_EventConsumer, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_IVRMenu[] = {  {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_PERL__Session[] = {  {&_swigt__p_PERL__Session, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_PerlInterpreter[] = {  {&_swigt__p_PerlInterpreter, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_Stream[] = {  {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_input_callback_state[] = {  {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_session_flag_t[] = {  {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_channel_state_t[] = {  {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_channel_t[] = {  {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_core_session_t[] = {  {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_event_node_t[] = {  {&_swigt__p_switch_event_node_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_event_t[] = {  {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_event_types_t[] = {  {&_swigt__p_switch_event_types_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_input_args_t[] = {  {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_input_type_t[] = {  {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_priority_t[] = {  {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_queue_t[] = {  {&_swigt__p_switch_queue_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_status_t[] = {  {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_stream_handle_t[] = {  {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint32_t[] = {  {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_API,
+  _swigc__p_CoreSession,
+  _swigc__p_DTMF,
+  _swigc__p_Event,
+  _swigc__p_EventConsumer,
+  _swigc__p_IVRMenu,
+  _swigc__p_PERL__Session,
+  _swigc__p_PerlInterpreter,
+  _swigc__p_Stream,
+  _swigc__p_char,
+  _swigc__p_input_callback_state,
+  _swigc__p_session_flag_t,
+  _swigc__p_switch_channel_state_t,
+  _swigc__p_switch_channel_t,
+  _swigc__p_switch_core_session_t,
+  _swigc__p_switch_event_node_t,
+  _swigc__p_switch_event_t,
+  _swigc__p_switch_event_types_t,
+  _swigc__p_switch_input_args_t,
+  _swigc__p_switch_input_type_t,
+  _swigc__p_switch_priority_t,
+  _swigc__p_switch_queue_t,
+  _swigc__p_switch_status_t,
+  _swigc__p_switch_stream_handle_t,
+  _swigc__p_uint32_t,
+  _swigc__p_void,
+};
 
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
 
-	static swig_constant_info swig_constants[] = {
-		{0, 0, 0, 0, 0, 0}
-	};
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
 #ifdef __cplusplus
 }
 #endif
 static swig_variable_info swig_variables[] = {
-	{0, 0, 0, 0}
+{0,0,0,0}
 };
 static swig_command_info swig_commands[] = {
-	{"freeswitchc::consoleLog", _wrap_consoleLog},
-	{"freeswitchc::consoleCleanLog", _wrap_consoleCleanLog},
-	{"freeswitchc::new_IVRMenu", _wrap_new_IVRMenu},
-	{"freeswitchc::delete_IVRMenu", _wrap_delete_IVRMenu},
-	{"freeswitchc::IVRMenu_bindAction", _wrap_IVRMenu_bindAction},
-	{"freeswitchc::IVRMenu_execute", _wrap_IVRMenu_execute},
-	{"freeswitchc::new_API", _wrap_new_API},
-	{"freeswitchc::delete_API", _wrap_delete_API},
-	{"freeswitchc::API_execute", _wrap_API_execute},
-	{"freeswitchc::API_executeString", _wrap_API_executeString},
-	{"freeswitchc::input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set},
-	{"freeswitchc::input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get},
-	{"freeswitchc::input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set},
-	{"freeswitchc::input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get},
-	{"freeswitchc::input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set},
-	{"freeswitchc::input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get},
-	{"freeswitchc::input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set},
-	{"freeswitchc::input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get},
-	{"freeswitchc::new_input_callback_state_t", _wrap_new_input_callback_state_t},
-	{"freeswitchc::delete_input_callback_state_t", _wrap_delete_input_callback_state_t},
-	{"freeswitchc::new_Stream", _wrap_new_Stream},
-	{"freeswitchc::delete_Stream", _wrap_delete_Stream},
-	{"freeswitchc::Stream_write", _wrap_Stream_write},
-	{"freeswitchc::Stream_get_data", _wrap_Stream_get_data},
-	{"freeswitchc::Event_event_set", _wrap_Event_event_set},
-	{"freeswitchc::Event_event_get", _wrap_Event_event_get},
-	{"freeswitchc::Event_serialized_string_set", _wrap_Event_serialized_string_set},
-	{"freeswitchc::Event_serialized_string_get", _wrap_Event_serialized_string_get},
-	{"freeswitchc::Event_mine_set", _wrap_Event_mine_set},
-	{"freeswitchc::Event_mine_get", _wrap_Event_mine_get},
-	{"freeswitchc::new_Event", _wrap_new_Event},
-	{"freeswitchc::delete_Event", _wrap_delete_Event},
-	{"freeswitchc::Event_serialize", _wrap_Event_serialize},
-	{"freeswitchc::Event_setPriority", _wrap_Event_setPriority},
-	{"freeswitchc::Event_getHeader", _wrap_Event_getHeader},
-	{"freeswitchc::Event_getBody", _wrap_Event_getBody},
-	{"freeswitchc::Event_getType", _wrap_Event_getType},
-	{"freeswitchc::Event_addBody", _wrap_Event_addBody},
-	{"freeswitchc::Event_addHeader", _wrap_Event_addHeader},
-	{"freeswitchc::Event_delHeader", _wrap_Event_delHeader},
-	{"freeswitchc::Event_fire", _wrap_Event_fire},
-	{"freeswitchc::delete_CoreSession", _wrap_delete_CoreSession},
-	{"freeswitchc::CoreSession_session_set", _wrap_CoreSession_session_set},
-	{"freeswitchc::CoreSession_session_get", _wrap_CoreSession_session_get},
-	{"freeswitchc::CoreSession_channel_set", _wrap_CoreSession_channel_set},
-	{"freeswitchc::CoreSession_channel_get", _wrap_CoreSession_channel_get},
-	{"freeswitchc::CoreSession_flags_set", _wrap_CoreSession_flags_set},
-	{"freeswitchc::CoreSession_flags_get", _wrap_CoreSession_flags_get},
-	{"freeswitchc::CoreSession_allocated_set", _wrap_CoreSession_allocated_set},
-	{"freeswitchc::CoreSession_allocated_get", _wrap_CoreSession_allocated_get},
-	{"freeswitchc::CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set},
-	{"freeswitchc::CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get},
-	{"freeswitchc::CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set},
-	{"freeswitchc::CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get},
-	{"freeswitchc::CoreSession_answer", _wrap_CoreSession_answer},
-	{"freeswitchc::CoreSession_preAnswer", _wrap_CoreSession_preAnswer},
-	{"freeswitchc::CoreSession_hangup", _wrap_CoreSession_hangup},
-	{"freeswitchc::CoreSession_setVariable", _wrap_CoreSession_setVariable},
-	{"freeswitchc::CoreSession_setPrivate", _wrap_CoreSession_setPrivate},
-	{"freeswitchc::CoreSession_getPrivate", _wrap_CoreSession_getPrivate},
-	{"freeswitchc::CoreSession_getVariable", _wrap_CoreSession_getVariable},
-	{"freeswitchc::CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result},
-	{"freeswitchc::CoreSession_say", _wrap_CoreSession_say},
-	{"freeswitchc::CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase},
-	{"freeswitchc::CoreSession_recordFile", _wrap_CoreSession_recordFile},
-	{"freeswitchc::CoreSession_setCallerData", _wrap_CoreSession_setCallerData},
-	{"freeswitchc::CoreSession_originate", _wrap_CoreSession_originate},
-	{"freeswitchc::CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
-	{"freeswitchc::CoreSession_speak", _wrap_CoreSession_speak},
-	{"freeswitchc::CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms},
-	{"freeswitchc::CoreSession_collectDigits", _wrap_CoreSession_collectDigits},
-	{"freeswitchc::CoreSession_getDigits", _wrap_CoreSession_getDigits},
-	{"freeswitchc::CoreSession_transfer", _wrap_CoreSession_transfer},
-	{"freeswitchc::CoreSession_read", _wrap_CoreSession_read},
-	{"freeswitchc::CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits},
-	{"freeswitchc::CoreSession_streamFile", _wrap_CoreSession_streamFile},
-	{"freeswitchc::CoreSession_flushEvents", _wrap_CoreSession_flushEvents},
-	{"freeswitchc::CoreSession_flushDigits", _wrap_CoreSession_flushDigits},
-	{"freeswitchc::CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup},
-	{"freeswitchc::CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook},
-	{"freeswitchc::CoreSession_ready", _wrap_CoreSession_ready},
-	{"freeswitchc::CoreSession_execute", _wrap_CoreSession_execute},
-	{"freeswitchc::CoreSession_sendEvent", _wrap_CoreSession_sendEvent},
-	{"freeswitchc::CoreSession_setEventData", _wrap_CoreSession_setEventData},
-	{"freeswitchc::CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR},
-	{"freeswitchc::CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
-	{"freeswitchc::CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads},
-	{"freeswitchc::CoreSession_get_uuid", _wrap_CoreSession_get_uuid},
-	{"freeswitchc::CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args},
-	{"freeswitchc::CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook},
-	{"freeswitchc::CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback},
-	{"freeswitchc::console_log", _wrap_console_log},
-	{"freeswitchc::console_clean_log", _wrap_console_clean_log},
-	{"freeswitchc::bridge", _wrap_bridge},
-	{"freeswitchc::hanguphook", _wrap_hanguphook},
-	{"freeswitchc::dtmf_callback", _wrap_dtmf_callback},
-	{"freeswitchc::new_Session", _wrap_new_Session},
-	{"freeswitchc::delete_Session", _wrap_delete_Session},
-	{"freeswitchc::Session_begin_allow_threads", _wrap_Session_begin_allow_threads},
-	{"freeswitchc::Session_end_allow_threads", _wrap_Session_end_allow_threads},
-	{"freeswitchc::Session_check_hangup_hook", _wrap_Session_check_hangup_hook},
-	{"freeswitchc::Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback},
-	{"freeswitchc::Session_setInputCallback", _wrap_Session_setInputCallback},
-	{"freeswitchc::Session_setHangupHook", _wrap_Session_setHangupHook},
-	{"freeswitchc::Session_ready", _wrap_Session_ready},
-	{"freeswitchc::Session_cb_function_set", _wrap_Session_cb_function_set},
-	{"freeswitchc::Session_cb_function_get", _wrap_Session_cb_function_get},
-	{"freeswitchc::Session_cb_arg_set", _wrap_Session_cb_arg_set},
-	{"freeswitchc::Session_cb_arg_get", _wrap_Session_cb_arg_get},
-	{"freeswitchc::Session_hangup_func_str_set", _wrap_Session_hangup_func_str_set},
-	{"freeswitchc::Session_hangup_func_str_get", _wrap_Session_hangup_func_str_get},
-	{"freeswitchc::Session_hangup_func_arg_set", _wrap_Session_hangup_func_arg_set},
-	{"freeswitchc::Session_hangup_func_arg_get", _wrap_Session_hangup_func_arg_get},
-	{"freeswitchc::Session_setPERL", _wrap_Session_setPERL},
-	{0, 0}
+{"freeswitchc::consoleLog", _wrap_consoleLog},
+{"freeswitchc::consoleCleanLog", _wrap_consoleCleanLog},
+{"freeswitchc::new_IVRMenu", _wrap_new_IVRMenu},
+{"freeswitchc::delete_IVRMenu", _wrap_delete_IVRMenu},
+{"freeswitchc::IVRMenu_bindAction", _wrap_IVRMenu_bindAction},
+{"freeswitchc::IVRMenu_execute", _wrap_IVRMenu_execute},
+{"freeswitchc::new_API", _wrap_new_API},
+{"freeswitchc::delete_API", _wrap_delete_API},
+{"freeswitchc::API_execute", _wrap_API_execute},
+{"freeswitchc::API_executeString", _wrap_API_executeString},
+{"freeswitchc::input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set},
+{"freeswitchc::input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get},
+{"freeswitchc::input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set},
+{"freeswitchc::input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get},
+{"freeswitchc::input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set},
+{"freeswitchc::input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get},
+{"freeswitchc::input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set},
+{"freeswitchc::input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get},
+{"freeswitchc::new_input_callback_state_t", _wrap_new_input_callback_state_t},
+{"freeswitchc::delete_input_callback_state_t", _wrap_delete_input_callback_state_t},
+{"freeswitchc::DTMF_digit_set", _wrap_DTMF_digit_set},
+{"freeswitchc::DTMF_digit_get", _wrap_DTMF_digit_get},
+{"freeswitchc::DTMF_duration_set", _wrap_DTMF_duration_set},
+{"freeswitchc::DTMF_duration_get", _wrap_DTMF_duration_get},
+{"freeswitchc::new_DTMF", _wrap_new_DTMF},
+{"freeswitchc::delete_DTMF", _wrap_delete_DTMF},
+{"freeswitchc::new_Stream", _wrap_new_Stream},
+{"freeswitchc::delete_Stream", _wrap_delete_Stream},
+{"freeswitchc::Stream_write", _wrap_Stream_write},
+{"freeswitchc::Stream_get_data", _wrap_Stream_get_data},
+{"freeswitchc::Event_event_set", _wrap_Event_event_set},
+{"freeswitchc::Event_event_get", _wrap_Event_event_get},
+{"freeswitchc::Event_serialized_string_set", _wrap_Event_serialized_string_set},
+{"freeswitchc::Event_serialized_string_get", _wrap_Event_serialized_string_get},
+{"freeswitchc::Event_mine_set", _wrap_Event_mine_set},
+{"freeswitchc::Event_mine_get", _wrap_Event_mine_get},
+{"freeswitchc::new_Event", _wrap_new_Event},
+{"freeswitchc::delete_Event", _wrap_delete_Event},
+{"freeswitchc::Event_serialize", _wrap_Event_serialize},
+{"freeswitchc::Event_setPriority", _wrap_Event_setPriority},
+{"freeswitchc::Event_getHeader", _wrap_Event_getHeader},
+{"freeswitchc::Event_getBody", _wrap_Event_getBody},
+{"freeswitchc::Event_getType", _wrap_Event_getType},
+{"freeswitchc::Event_addBody", _wrap_Event_addBody},
+{"freeswitchc::Event_addHeader", _wrap_Event_addHeader},
+{"freeswitchc::Event_delHeader", _wrap_Event_delHeader},
+{"freeswitchc::Event_fire", _wrap_Event_fire},
+{"freeswitchc::EventConsumer_events_set", _wrap_EventConsumer_events_set},
+{"freeswitchc::EventConsumer_events_get", _wrap_EventConsumer_events_get},
+{"freeswitchc::EventConsumer_e_event_id_set", _wrap_EventConsumer_e_event_id_set},
+{"freeswitchc::EventConsumer_e_event_id_get", _wrap_EventConsumer_e_event_id_get},
+{"freeswitchc::EventConsumer_node_set", _wrap_EventConsumer_node_set},
+{"freeswitchc::EventConsumer_node_get", _wrap_EventConsumer_node_get},
+{"freeswitchc::EventConsumer_e_callback_set", _wrap_EventConsumer_e_callback_set},
+{"freeswitchc::EventConsumer_e_callback_get", _wrap_EventConsumer_e_callback_get},
+{"freeswitchc::EventConsumer_e_subclass_name_set", _wrap_EventConsumer_e_subclass_name_set},
+{"freeswitchc::EventConsumer_e_subclass_name_get", _wrap_EventConsumer_e_subclass_name_get},
+{"freeswitchc::EventConsumer_e_cb_arg_set", _wrap_EventConsumer_e_cb_arg_set},
+{"freeswitchc::EventConsumer_e_cb_arg_get", _wrap_EventConsumer_e_cb_arg_get},
+{"freeswitchc::new_EventConsumer", _wrap_new_EventConsumer},
+{"freeswitchc::delete_EventConsumer", _wrap_delete_EventConsumer},
+{"freeswitchc::EventConsumer_pop", _wrap_EventConsumer_pop},
+{"freeswitchc::delete_CoreSession", _wrap_delete_CoreSession},
+{"freeswitchc::CoreSession_session_set", _wrap_CoreSession_session_set},
+{"freeswitchc::CoreSession_session_get", _wrap_CoreSession_session_get},
+{"freeswitchc::CoreSession_channel_set", _wrap_CoreSession_channel_set},
+{"freeswitchc::CoreSession_channel_get", _wrap_CoreSession_channel_get},
+{"freeswitchc::CoreSession_flags_set", _wrap_CoreSession_flags_set},
+{"freeswitchc::CoreSession_flags_get", _wrap_CoreSession_flags_get},
+{"freeswitchc::CoreSession_allocated_set", _wrap_CoreSession_allocated_set},
+{"freeswitchc::CoreSession_allocated_get", _wrap_CoreSession_allocated_get},
+{"freeswitchc::CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set},
+{"freeswitchc::CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get},
+{"freeswitchc::CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set},
+{"freeswitchc::CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get},
+{"freeswitchc::CoreSession_uuid_set", _wrap_CoreSession_uuid_set},
+{"freeswitchc::CoreSession_uuid_get", _wrap_CoreSession_uuid_get},
+{"freeswitchc::CoreSession_tts_name_set", _wrap_CoreSession_tts_name_set},
+{"freeswitchc::CoreSession_tts_name_get", _wrap_CoreSession_tts_name_get},
+{"freeswitchc::CoreSession_voice_name_set", _wrap_CoreSession_voice_name_set},
+{"freeswitchc::CoreSession_voice_name_get", _wrap_CoreSession_voice_name_get},
+{"freeswitchc::CoreSession_answer", _wrap_CoreSession_answer},
+{"freeswitchc::CoreSession_preAnswer", _wrap_CoreSession_preAnswer},
+{"freeswitchc::CoreSession_hangup", _wrap_CoreSession_hangup},
+{"freeswitchc::CoreSession_setVariable", _wrap_CoreSession_setVariable},
+{"freeswitchc::CoreSession_setPrivate", _wrap_CoreSession_setPrivate},
+{"freeswitchc::CoreSession_getPrivate", _wrap_CoreSession_getPrivate},
+{"freeswitchc::CoreSession_getVariable", _wrap_CoreSession_getVariable},
+{"freeswitchc::CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result},
+{"freeswitchc::CoreSession_say", _wrap_CoreSession_say},
+{"freeswitchc::CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase},
+{"freeswitchc::CoreSession_recordFile", _wrap_CoreSession_recordFile},
+{"freeswitchc::CoreSession_setCallerData", _wrap_CoreSession_setCallerData},
+{"freeswitchc::CoreSession_originate", _wrap_CoreSession_originate},
+{"freeswitchc::CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
+{"freeswitchc::CoreSession_speak", _wrap_CoreSession_speak},
+{"freeswitchc::CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms},
+{"freeswitchc::CoreSession_collectDigits", _wrap_CoreSession_collectDigits},
+{"freeswitchc::CoreSession_getDigits", _wrap_CoreSession_getDigits},
+{"freeswitchc::CoreSession_transfer", _wrap_CoreSession_transfer},
+{"freeswitchc::CoreSession_read", _wrap_CoreSession_read},
+{"freeswitchc::CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits},
+{"freeswitchc::CoreSession_streamFile", _wrap_CoreSession_streamFile},
+{"freeswitchc::CoreSession_sleep", _wrap_CoreSession_sleep},
+{"freeswitchc::CoreSession_flushEvents", _wrap_CoreSession_flushEvents},
+{"freeswitchc::CoreSession_flushDigits", _wrap_CoreSession_flushDigits},
+{"freeswitchc::CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup},
+{"freeswitchc::CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook},
+{"freeswitchc::CoreSession_ready", _wrap_CoreSession_ready},
+{"freeswitchc::CoreSession_answered", _wrap_CoreSession_answered},
+{"freeswitchc::CoreSession_mediaReady", _wrap_CoreSession_mediaReady},
+{"freeswitchc::CoreSession_waitForAnswer", _wrap_CoreSession_waitForAnswer},
+{"freeswitchc::CoreSession_execute", _wrap_CoreSession_execute},
+{"freeswitchc::CoreSession_sendEvent", _wrap_CoreSession_sendEvent},
+{"freeswitchc::CoreSession_setEventData", _wrap_CoreSession_setEventData},
+{"freeswitchc::CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR},
+{"freeswitchc::CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
+{"freeswitchc::CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads},
+{"freeswitchc::CoreSession_get_uuid", _wrap_CoreSession_get_uuid},
+{"freeswitchc::CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args},
+{"freeswitchc::CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook},
+{"freeswitchc::CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback},
+{"freeswitchc::console_log", _wrap_console_log},
+{"freeswitchc::console_clean_log", _wrap_console_clean_log},
+{"freeswitchc::bridge", _wrap_bridge},
+{"freeswitchc::hanguphook", _wrap_hanguphook},
+{"freeswitchc::dtmf_callback", _wrap_dtmf_callback},
+{"freeswitchc::new_Session", _wrap_new_Session},
+{"freeswitchc::delete_Session", _wrap_delete_Session},
+{"freeswitchc::Session_begin_allow_threads", _wrap_Session_begin_allow_threads},
+{"freeswitchc::Session_end_allow_threads", _wrap_Session_end_allow_threads},
+{"freeswitchc::Session_check_hangup_hook", _wrap_Session_check_hangup_hook},
+{"freeswitchc::Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback},
+{"freeswitchc::Session_setME", _wrap_Session_setME},
+{"freeswitchc::Session_setInputCallback", _wrap_Session_setInputCallback},
+{"freeswitchc::Session_setHangupHook", _wrap_Session_setHangupHook},
+{"freeswitchc::Session_ready", _wrap_Session_ready},
+{"freeswitchc::Session_suuid_set", _wrap_Session_suuid_set},
+{"freeswitchc::Session_suuid_get", _wrap_Session_suuid_get},
+{"freeswitchc::Session_cb_function_set", _wrap_Session_cb_function_set},
+{"freeswitchc::Session_cb_function_get", _wrap_Session_cb_function_get},
+{"freeswitchc::Session_cb_arg_set", _wrap_Session_cb_arg_set},
+{"freeswitchc::Session_cb_arg_get", _wrap_Session_cb_arg_get},
+{"freeswitchc::Session_hangup_func_str_set", _wrap_Session_hangup_func_str_set},
+{"freeswitchc::Session_hangup_func_str_get", _wrap_Session_hangup_func_str_get},
+{"freeswitchc::Session_hangup_func_arg_set", _wrap_Session_hangup_func_arg_set},
+{"freeswitchc::Session_hangup_func_arg_get", _wrap_Session_hangup_func_arg_get},
+{"freeswitchc::Session_setPERL", _wrap_Session_setPERL},
+{0,0}
 };
-
 /* -----------------------------------------------------------------------------
  * Type initialization:
  * This problem is tough by the requirement that no dynamic 
@@ -8878,162 +10439,160 @@
 #ifdef __cplusplus
 extern "C" {
 #if 0
-}								/* c-mode */
+} /* c-mode */
 #endif
 #endif
+
 #if 0
 #define SWIGRUNTIME_DEBUG
 #endif
-SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
-{
-	size_t i;
-	swig_module_info *module_head, *iter;
-	int found, init;
-
-	clientdata = clientdata;
-
-	/* check to see if the circular list has been setup, if not, set it up */
-	if (swig_module.next == 0) {
-		/* Initialize the swig_module */
-		swig_module.type_initial = swig_type_initial;
-		swig_module.cast_initial = swig_cast_initial;
-		swig_module.next = &swig_module;
-		init = 1;
-	} else {
-		init = 0;
-	}
-
-	/* Try and load any already created modules */
-	module_head = SWIG_GetModule(clientdata);
-	if (!module_head) {
-		/* This is the first module loaded for this interpreter */
-		/* so set the swig module into the interpreter */
-		SWIG_SetModule(clientdata, &swig_module);
-		module_head = &swig_module;
-	} else {
-		/* the interpreter has loaded a SWIG module, but has it loaded this one? */
-		found = 0;
-		iter = module_head;
-		do {
-			if (iter == &swig_module) {
-				found = 1;
-				break;
-			}
-			iter = iter->next;
-		} while (iter != module_head);
-
-		/* if the is found in the list, then all is done and we may leave */
-		if (found)
-			return;
-		/* otherwise we must add out module into the list */
-		swig_module.next = module_head->next;
-		module_head->next = &swig_module;
-	}
 
-	/* When multiple interpeters are used, a module could have already been initialized in
-	   a different interpreter, but not yet have a pointer in this interpreter.
-	   In this case, we do not want to continue adding types... everything should be
-	   set up already */
-	if (init == 0)
-		return;
 
-	/* Now work on filling in swig_module.types */
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  clientdata = clientdata;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
-	printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
 #endif
-	for (i = 0; i < swig_module.size; ++i) {
-		swig_type_info *type = 0;
-		swig_type_info *ret;
-		swig_cast_info *cast;
-
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
 #ifdef SWIGRUNTIME_DEBUG
-		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
 #endif
-
-		/* if there is another module already loaded */
-		if (swig_module.next != &swig_module) {
-			type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
-		}
-		if (type) {
-			/* Overwrite clientdata field */
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
 #ifdef SWIGRUNTIME_DEBUG
-			printf("SWIG_InitializeModule: found type %s\n", type->name);
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
 #endif
-			if (swig_module.type_initial[i]->clientdata) {
-				type->clientdata = swig_module.type_initial[i]->clientdata;
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
 #ifdef SWIGRUNTIME_DEBUG
-				printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
 #endif
-			}
-		} else {
-			type = swig_module.type_initial[i];
-		}
-
-		/* Insert casting types */
-		cast = swig_module.cast_initial[i];
-		while (cast->type) {
-			/* Don't need to add information already in the list */
-			ret = 0;
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
 #ifdef SWIGRUNTIME_DEBUG
-			printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
 #endif
-			if (swig_module.next != &swig_module) {
-				ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
 #ifdef SWIGRUNTIME_DEBUG
-				if (ret)
-					printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
 #endif
-			}
-			if (ret) {
-				if (type == swig_module.type_initial[i]) {
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
 #ifdef SWIGRUNTIME_DEBUG
-					printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
 #endif
-					cast->type = ret;
-					ret = 0;
-				} else {
-					/* Check for casting already in the list */
-					swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
 #ifdef SWIGRUNTIME_DEBUG
-					if (ocast)
-						printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
 #endif
-					if (!ocast)
-						ret = 0;
-				}
-			}
-
-			if (!ret) {
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
 #ifdef SWIGRUNTIME_DEBUG
-				printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
 #endif
-				if (type->cast) {
-					type->cast->prev = cast;
-					cast->next = type->cast;
-				}
-				type->cast = cast;
-			}
-			cast++;
-		}
-		/* Set entry in modules->types array equal to the type */
-		swig_module.types[i] = type;
-	}
-	swig_module.types[i] = 0;
-
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
 #ifdef SWIGRUNTIME_DEBUG
-	printf("**** SWIG_InitializeModule: Cast List ******\n");
-	for (i = 0; i < swig_module.size; ++i) {
-		int j = 0;
-		swig_cast_info *cast = swig_module.cast_initial[i];
-		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-		while (cast->type) {
-			printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
-			cast++;
-			++j;
-		}
-		printf("---- Total casts: %d\n", j);
-	}
-	printf("**** SWIG_InitializeModule: Cast List ******\n");
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
 #endif
 }
 
@@ -9042,34 +10601,33 @@
 * of equivalent types.  It is like calling
 * SWIG_TypeClientData(type, clientdata) a second time.
 */
-SWIGRUNTIME void SWIG_PropagateClientData(void)
-{
-	size_t i;
-	swig_cast_info *equiv;
-	static int init_run = 0;
-
-	if (init_run)
-		return;
-	init_run = 1;
-
-	for (i = 0; i < swig_module.size; i++) {
-		if (swig_module.types[i]->clientdata) {
-			equiv = swig_module.types[i]->cast;
-			while (equiv) {
-				if (!equiv->converter) {
-					if (equiv->type && !equiv->type->clientdata)
-						SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
-				}
-				equiv = equiv->next;
-			}
-		}
-	}
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
 }
 
 #ifdef __cplusplus
 #if 0
 {
-	/* c-mode */
+  /* c-mode */
 #endif
 }
 #endif
@@ -9079,86 +10637,82 @@
 #ifdef __cplusplus
 extern "C"
 #endif
- XS(SWIG_init)
-{
-	dXSARGS;
-	int i;
-
-	SWIG_InitializeModule(0);
-
-	/* Install commands */
-	for (i = 0; swig_commands[i].name; i++) {
-		newXS((char *) swig_commands[i].name, swig_commands[i].wrapper, (char *) __FILE__);
-	}
-
-	/* Install variables */
-	for (i = 0; swig_variables[i].name; i++) {
-		SV *sv;
-		sv = get_sv((char *) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
-		if (swig_variables[i].type) {
-			SWIG_MakePtr(sv, (void *) 1, *swig_variables[i].type, 0);
-		} else {
-			sv_setiv(sv, (IV) 0);
-		}
-		swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get);
-	}
-
-	/* Install constant */
-	for (i = 0; swig_constants[i].type; i++) {
-		SV *sv;
-		sv = get_sv((char *) swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
-		switch (swig_constants[i].type) {
-		case SWIG_INT:
-			sv_setiv(sv, (IV) swig_constants[i].lvalue);
-			break;
-		case SWIG_FLOAT:
-			sv_setnv(sv, (double) swig_constants[i].dvalue);
-			break;
-		case SWIG_STRING:
-			sv_setpv(sv, (char *) swig_constants[i].pvalue);
-			break;
-		case SWIG_POINTER:
-			SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype), 0);
-			break;
-		case SWIG_BINARY:
-			SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
-			break;
-		default:
-			break;
-		}
-		SvREADONLY_on(sv);
-	}
 
-	SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void *) "freeswitch::IVRMenu");
-	SWIG_TypeClientData(SWIGTYPE_p_API, (void *) "freeswitch::API");
-	SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void *) "freeswitch::input_callback_state_t");
-	/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@ */
-	do {
-		SV *sv = get_sv((char *) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
-		sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(S_HUP)));
-		SvREADONLY_on(sv);
-	} while (0)					/*@SWIG@ */
-	;
-	/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@ */
-	do {
-		SV *sv = get_sv((char *) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
-		sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(S_FREE)));
-		SvREADONLY_on(sv);
-	} while (0)					/*@SWIG@ */
-	;
-	/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@ */
-	do {
-		SV *sv = get_sv((char *) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
-		sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(S_RDLOCK)));
-		SvREADONLY_on(sv);
-	} while (0)					/*@SWIG@ */
-	;
-	SWIG_TypeClientData(SWIGTYPE_p_Stream, (void *) "freeswitch::Stream");
-	SWIG_TypeClientData(SWIGTYPE_p_Event, (void *) "freeswitch::Event");
-	SWIG_TypeClientData(SWIGTYPE_p_CoreSession, (void *) "freeswitch::CoreSession");
-	SWIG_TypeClientData(SWIGTYPE_p_PERL__Session, (void *) "freeswitch::Session");
-	ST(0) = &PL_sv_yes;
-	XSRETURN(1);
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
+  SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
+  SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
+  /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  SWIG_TypeClientData(SWIGTYPE_p_DTMF, (void*) "freeswitch::DTMF");
+  SWIG_TypeClientData(SWIGTYPE_p_Stream, (void*) "freeswitch::Stream");
+  SWIG_TypeClientData(SWIGTYPE_p_Event, (void*) "freeswitch::Event");
+  SWIG_TypeClientData(SWIGTYPE_p_EventConsumer, (void*) "freeswitch::EventConsumer");
+  SWIG_TypeClientData(SWIGTYPE_p_CoreSession, (void*) "freeswitch::CoreSession");
+  SWIG_TypeClientData(SWIGTYPE_p_PERL__Session, (void*) "freeswitch::Session");
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
 }
 
 #include "mod_perl_extra.c"

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/Makefile.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/Makefile.in	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/Makefile.in	Mon Aug  4 21:29:58 2008
@@ -11,19 +11,20 @@
 LINK=$(CXXLINK)
 
 PYMOD=freeswitch
-PYTHON_SITE_DIR=@PYTHON_SITE_DIR@
+PYTHON_SITE_DIR=/usr/lib/python2.4/site-packages
 
 SWIGCFILE=../../../switch_swig.c
 SWIGIFILE=../../../switch_swig.i
 
-reswig: 
-	swig -python -shadow -c++ -I../../../../src/include -o mod_python_wrap.cpp mod_python.i
+reswig: swigclean mod_python_wrap.cpp
 
-switch_swig_wrap.o: switch_swig_wrap.c Makefile
-	$(CC)  -w $(CFLAGS) -c $< -o $@
+swigclean: clean
+	rm -f mod_python_wrap.* freeswitch.py
 
-switch_swig.o: $(SWIGCFILE) Makefile
-	$(CC)  -w $(CFLAGS) -c $< -o $@
+mod_python_wrap.cpp: mod_python_extra.c
+	swig -python -c++ -I../../../../src/include -oh mod_python_wrap.h -o mod_python_wrap.cpp mod_python.i
+	echo "#include \"mod_python_extra.c\"" >> mod_python_wrap.cpp
+	patch -s -p0 -i hack.diff
 
 local_install:
 	mkdir -m755 -p $(DESTDIR)$(PYTHON_SITE_DIR)

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch.py	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch.py	Mon Aug  4 21:29:58 2008
@@ -114,6 +114,27 @@
 S_HUP = _freeswitch.S_HUP
 S_FREE = _freeswitch.S_FREE
 S_RDLOCK = _freeswitch.S_RDLOCK
+class DTMF(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, DTMF, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, DTMF, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["digit"] = _freeswitch.DTMF_digit_set
+    __swig_getmethods__["digit"] = _freeswitch.DTMF_digit_get
+    if _newclass:digit = _swig_property(_freeswitch.DTMF_digit_get, _freeswitch.DTMF_digit_set)
+    __swig_setmethods__["duration"] = _freeswitch.DTMF_duration_set
+    __swig_getmethods__["duration"] = _freeswitch.DTMF_duration_get
+    if _newclass:duration = _swig_property(_freeswitch.DTMF_duration_get, _freeswitch.DTMF_duration_set)
+    def __init__(self, *args): 
+        this = _freeswitch.new_DTMF(*args)
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _freeswitch.delete_DTMF
+    __del__ = lambda self : None;
+DTMF_swigregister = _freeswitch.DTMF_swigregister
+DTMF_swigregister(DTMF)
+
 class Stream(_object):
     __swig_setmethods__ = {}
     __setattr__ = lambda self, name, value: _swig_setattr(self, Stream, name, value)
@@ -164,6 +185,40 @@
 Event_swigregister = _freeswitch.Event_swigregister
 Event_swigregister(Event)
 
+class EventConsumer(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, EventConsumer, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, EventConsumer, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["events"] = _freeswitch.EventConsumer_events_set
+    __swig_getmethods__["events"] = _freeswitch.EventConsumer_events_get
+    if _newclass:events = _swig_property(_freeswitch.EventConsumer_events_get, _freeswitch.EventConsumer_events_set)
+    __swig_setmethods__["e_event_id"] = _freeswitch.EventConsumer_e_event_id_set
+    __swig_getmethods__["e_event_id"] = _freeswitch.EventConsumer_e_event_id_get
+    if _newclass:e_event_id = _swig_property(_freeswitch.EventConsumer_e_event_id_get, _freeswitch.EventConsumer_e_event_id_set)
+    __swig_setmethods__["node"] = _freeswitch.EventConsumer_node_set
+    __swig_getmethods__["node"] = _freeswitch.EventConsumer_node_get
+    if _newclass:node = _swig_property(_freeswitch.EventConsumer_node_get, _freeswitch.EventConsumer_node_set)
+    __swig_setmethods__["e_callback"] = _freeswitch.EventConsumer_e_callback_set
+    __swig_getmethods__["e_callback"] = _freeswitch.EventConsumer_e_callback_get
+    if _newclass:e_callback = _swig_property(_freeswitch.EventConsumer_e_callback_get, _freeswitch.EventConsumer_e_callback_set)
+    __swig_setmethods__["e_subclass_name"] = _freeswitch.EventConsumer_e_subclass_name_set
+    __swig_getmethods__["e_subclass_name"] = _freeswitch.EventConsumer_e_subclass_name_get
+    if _newclass:e_subclass_name = _swig_property(_freeswitch.EventConsumer_e_subclass_name_get, _freeswitch.EventConsumer_e_subclass_name_set)
+    __swig_setmethods__["e_cb_arg"] = _freeswitch.EventConsumer_e_cb_arg_set
+    __swig_getmethods__["e_cb_arg"] = _freeswitch.EventConsumer_e_cb_arg_get
+    if _newclass:e_cb_arg = _swig_property(_freeswitch.EventConsumer_e_cb_arg_get, _freeswitch.EventConsumer_e_cb_arg_set)
+    def __init__(self, *args): 
+        this = _freeswitch.new_EventConsumer(*args)
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _freeswitch.delete_EventConsumer
+    __del__ = lambda self : None;
+    def pop(*args): return _freeswitch.EventConsumer_pop(*args)
+EventConsumer_swigregister = _freeswitch.EventConsumer_swigregister
+EventConsumer_swigregister(EventConsumer)
+
 class CoreSession(_object):
     __swig_setmethods__ = {}
     __setattr__ = lambda self, name, value: _swig_setattr(self, CoreSession, name, value)
@@ -191,6 +246,15 @@
     __swig_setmethods__["hook_state"] = _freeswitch.CoreSession_hook_state_set
     __swig_getmethods__["hook_state"] = _freeswitch.CoreSession_hook_state_get
     if _newclass:hook_state = _swig_property(_freeswitch.CoreSession_hook_state_get, _freeswitch.CoreSession_hook_state_set)
+    __swig_setmethods__["uuid"] = _freeswitch.CoreSession_uuid_set
+    __swig_getmethods__["uuid"] = _freeswitch.CoreSession_uuid_get
+    if _newclass:uuid = _swig_property(_freeswitch.CoreSession_uuid_get, _freeswitch.CoreSession_uuid_set)
+    __swig_setmethods__["tts_name"] = _freeswitch.CoreSession_tts_name_set
+    __swig_getmethods__["tts_name"] = _freeswitch.CoreSession_tts_name_get
+    if _newclass:tts_name = _swig_property(_freeswitch.CoreSession_tts_name_get, _freeswitch.CoreSession_tts_name_set)
+    __swig_setmethods__["voice_name"] = _freeswitch.CoreSession_voice_name_set
+    __swig_getmethods__["voice_name"] = _freeswitch.CoreSession_voice_name_get
+    if _newclass:voice_name = _swig_property(_freeswitch.CoreSession_voice_name_get, _freeswitch.CoreSession_voice_name_set)
     def answer(*args): return _freeswitch.CoreSession_answer(*args)
     def preAnswer(*args): return _freeswitch.CoreSession_preAnswer(*args)
     def hangup(*args): return _freeswitch.CoreSession_hangup(*args)
@@ -213,11 +277,15 @@
     def read(*args): return _freeswitch.CoreSession_read(*args)
     def playAndGetDigits(*args): return _freeswitch.CoreSession_playAndGetDigits(*args)
     def streamFile(*args): return _freeswitch.CoreSession_streamFile(*args)
+    def sleep(*args): return _freeswitch.CoreSession_sleep(*args)
     def flushEvents(*args): return _freeswitch.CoreSession_flushEvents(*args)
     def flushDigits(*args): return _freeswitch.CoreSession_flushDigits(*args)
     def setAutoHangup(*args): return _freeswitch.CoreSession_setAutoHangup(*args)
     def setHangupHook(*args): return _freeswitch.CoreSession_setHangupHook(*args)
     def ready(*args): return _freeswitch.CoreSession_ready(*args)
+    def answered(*args): return _freeswitch.CoreSession_answered(*args)
+    def mediaReady(*args): return _freeswitch.CoreSession_mediaReady(*args)
+    def waitForAnswer(*args): return _freeswitch.CoreSession_waitForAnswer(*args)
     def execute(*args): return _freeswitch.CoreSession_execute(*args)
     def sendEvent(*args): return _freeswitch.CoreSession_sendEvent(*args)
     def setEventData(*args): return _freeswitch.CoreSession_setEventData(*args)
@@ -236,31 +304,43 @@
 bridge = _freeswitch.bridge
 hanguphook = _freeswitch.hanguphook
 dtmf_callback = _freeswitch.dtmf_callback
-S_SWAPPED_IN = _freeswitch.S_SWAPPED_IN
-S_SWAPPED_OUT = _freeswitch.S_SWAPPED_OUT
-class PySession(CoreSession):
+class Session(CoreSession):
     __swig_setmethods__ = {}
     for _s in [CoreSession]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
-    __setattr__ = lambda self, name, value: _swig_setattr(self, PySession, name, value)
+    __setattr__ = lambda self, name, value: _swig_setattr(self, Session, name, value)
     __swig_getmethods__ = {}
     for _s in [CoreSession]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
-    __getattr__ = lambda self, name: _swig_getattr(self, PySession, name)
+    __getattr__ = lambda self, name: _swig_getattr(self, Session, name)
     __repr__ = _swig_repr
     def __init__(self, *args): 
-        this = _freeswitch.new_PySession(*args)
+        this = _freeswitch.new_Session(*args)
         try: self.this.append(this)
         except: self.this = this
-    __swig_destroy__ = _freeswitch.delete_PySession
+    __swig_destroy__ = _freeswitch.delete_Session
     __del__ = lambda self : None;
-    def setDTMFCallback(*args): return _freeswitch.PySession_setDTMFCallback(*args)
-    def setHangupHook(*args): return _freeswitch.PySession_setHangupHook(*args)
-    def check_hangup_hook(*args): return _freeswitch.PySession_check_hangup_hook(*args)
-    def hangup(*args): return _freeswitch.PySession_hangup(*args)
-    def begin_allow_threads(*args): return _freeswitch.PySession_begin_allow_threads(*args)
-    def end_allow_threads(*args): return _freeswitch.PySession_end_allow_threads(*args)
-    def run_dtmf_callback(*args): return _freeswitch.PySession_run_dtmf_callback(*args)
-PySession_swigregister = _freeswitch.PySession_swigregister
-PySession_swigregister(PySession)
+    def begin_allow_threads(*args): return _freeswitch.Session_begin_allow_threads(*args)
+    def end_allow_threads(*args): return _freeswitch.Session_end_allow_threads(*args)
+    def check_hangup_hook(*args): return _freeswitch.Session_check_hangup_hook(*args)
+    def run_dtmf_callback(*args): return _freeswitch.Session_run_dtmf_callback(*args)
+    def setInputCallback(*args): return _freeswitch.Session_setInputCallback(*args)
+    def setHangupHook(*args): return _freeswitch.Session_setHangupHook(*args)
+    def ready(*args): return _freeswitch.Session_ready(*args)
+    __swig_setmethods__["cb_function"] = _freeswitch.Session_cb_function_set
+    __swig_getmethods__["cb_function"] = _freeswitch.Session_cb_function_get
+    if _newclass:cb_function = _swig_property(_freeswitch.Session_cb_function_get, _freeswitch.Session_cb_function_set)
+    __swig_setmethods__["cb_arg"] = _freeswitch.Session_cb_arg_set
+    __swig_getmethods__["cb_arg"] = _freeswitch.Session_cb_arg_get
+    if _newclass:cb_arg = _swig_property(_freeswitch.Session_cb_arg_get, _freeswitch.Session_cb_arg_set)
+    __swig_setmethods__["hangup_func"] = _freeswitch.Session_hangup_func_set
+    __swig_getmethods__["hangup_func"] = _freeswitch.Session_hangup_func_get
+    if _newclass:hangup_func = _swig_property(_freeswitch.Session_hangup_func_get, _freeswitch.Session_hangup_func_set)
+    __swig_setmethods__["hangup_func_arg"] = _freeswitch.Session_hangup_func_arg_set
+    __swig_getmethods__["hangup_func_arg"] = _freeswitch.Session_hangup_func_arg_get
+    if _newclass:hangup_func_arg = _swig_property(_freeswitch.Session_hangup_func_arg_get, _freeswitch.Session_hangup_func_arg_set)
+    def setPython(*args): return _freeswitch.Session_setPython(*args)
+    def setSelf(*args): return _freeswitch.Session_setSelf(*args)
+Session_swigregister = _freeswitch.Session_swigregister
+Session_swigregister(Session)
 
 
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.cpp	Mon Aug  4 21:29:58 2008
@@ -1,319 +1,314 @@
+
+#include <switch.h>
 #include "freeswitch_python.h"
+using namespace PYTHON;
 
-#define sanity_check(x) do { if (!session) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
-#define init_vars() do { caller_profile.source = "mod_python"; swapstate = S_SWAPPED_IN; } while(0)
+#define py_init_vars() cb_function = cb_arg = hangup_func = hangup_func_arg = NULL; hh = mark = 0; TS = NULL
 
-PySession::PySession():CoreSession()
+Session::Session():CoreSession()
 {
-	init_vars();
+	py_init_vars();
 }
 
-PySession::PySession(char *uuid):CoreSession(uuid)
+Session::Session(char *nuuid, CoreSession *a_leg):CoreSession(nuuid, a_leg)
 {
-	init_vars();
+	py_init_vars();
 }
 
-PySession::PySession(switch_core_session_t *new_session):CoreSession(new_session)
+Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
 {
-	init_vars();
+	py_init_vars();
 }
+static switch_status_t python_hanguphook(switch_core_session_t *session_hungup);
 
-
-void PySession::setDTMFCallback(PyObject * pyfunc, char *funcargs)
+Session::~Session()
 {
-	sanity_check();
+	
+	if (hangup_func) {
+		if (session) {
+			switch_core_event_hook_remove_state_change(session, python_hanguphook);
+		}
+		Py_DECREF(hangup_func);
+		hangup_func = NULL;
+	}
+	
+	if (hangup_func_arg) {
+		Py_DECREF(hangup_func_arg);
+		hangup_func_arg = NULL;
+	}
 
-	if (!PyCallable_Check(pyfunc)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "DTMF function is not a python function.\n");
-		return;
+	if (cb_function) {
+		Py_DECREF(cb_function);
+		cb_function = NULL;
 	}
-	Py_XINCREF(pyfunc);
-	CoreSession::setDTMFCallback((void *) pyfunc, funcargs);
 
+	if (cb_arg) {
+		Py_DECREF(cb_arg);
+		cb_arg = NULL;
+	}
 
+	if (Self) {
+		Py_DECREF(Self);
+	}
 }
 
-void PySession::setHangupHook(PyObject * pyfunc)
+bool Session::begin_allow_threads()
 {
 
-	if (!PyCallable_Check(pyfunc)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n");
-		return;
+	do_hangup_hook();
+
+	if (!TS) {
+		TS = PyEval_SaveThread();
+		if (channel) {
+			switch_channel_set_private(channel, "SwapInThreadState", TS);
+		}
+		return true;
 	}
-	// without this Py_XINCREF, there will be segfaults.  basically the python
-	// interpreter will not know that it should not GC this object.
-	// callback example: http://docs.python.org/ext/callingPython.html
-	Py_XINCREF(pyfunc);
-	CoreSession::setHangupHook((void *) pyfunc);
 
+	return false;
 }
 
-
-void PySession::check_hangup_hook()
+bool Session::end_allow_threads()
 {
-	PyObject *func;
-	PyObject *result;
-	char *resultStr;
-	bool did_swap_in = false;
-
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-					  "check_hangup_hook has been DISABLED, please do not use hangup hooks in python code until further notice!\n");
 
-	if (!session) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
-		return;
+	if (!TS) {
+		return false;
 	}
 
-	return;
-
-	/*! NEEDS TO BE FIXED:
+	PyEval_RestoreThread(TS);
+	TS = NULL;
 
-	   // The did_swap_in boolean was added to fix the following problem:
-	   // Design flaw - we swap in threadstate based on the assumption that thread state 
-	   // is currently _swapped out_ when this hangup hook is called.  However, nothing known to 
-	   // guarantee that, and  if thread state is already swapped in when this is invoked, 
-	   // bad things will happen.
-	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook end_allow_threads\n");
-	   did_swap_in = end_allow_threads();
-
-	   if (on_hangup == NULL) {
-	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "on_hangup is null\n");
-	   return;
-	   }
-
-	   func = (PyObject *) on_hangup;
-
-	   // TODO: to match js implementation, should pass the _python_ PySession 
-	   // object instance wrapping this C++ PySession instance. but how do we do that?
-	   // for now, pass the uuid since its better than nothing
-	   PyObject* func_arg = Py_BuildValue("(s)", uuid);
+	if (channel) {
+		switch_channel_set_private(channel, "SwapInThreadState", NULL);
+	}
 
-	   result = PyEval_CallObject(func, func_arg);
-	   Py_XDECREF(func_arg);
+	do_hangup_hook();
 
-	   if (result) {
-	   resultStr = (char *) PyString_AsString(result);
-	   // currently just ignore the result
-	   }
-	   else {
-	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to call python hangup callback\n");
-	   PyErr_Print();
-	   PyErr_Clear();
-	   }
+	return true;
+}
 
-	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook begin_allow_threads\n");
-	   if (did_swap_in) {
-	   begin_allow_threads();
-	   }
+void Session::setPython(PyObject *state)
+{
+	Py = state;
+}
 
-	   Py_XDECREF(result);
-	 */
+void Session::setSelf(PyObject *state)
+{
+	Self = state;
 }
 
-switch_status_t PySession::run_dtmf_callback(void *input, switch_input_type_t itype)
+PyObject *Session::getPython()
 {
+	return Py;
+}
 
-	PyObject *func, *arglist;
-	PyObject *pyresult;
-	PyObject *headerdict;
 
-	char *resultStr;
-	char *funcargs;
-	switch_file_handle_t *fh = NULL;
-	bool did_swap_in = false;
+bool Session::ready()
+{
+	bool r;
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback\n");
+	sanity_check(false);
+	r = switch_channel_ready(channel) != 0;
 
+	/*! this is called every time ready is called as a workaround to
+	  make it threadsafe.  it sets a flag, and all the places where it
+	  comes in and out of threadswap, check it.  so the end result is 
+	  you still get the hangup hook executed pretty soon after you
+	  hangup.  */
+	do_hangup_hook();
 
-	if (!cb_state.function) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");
-		return SWITCH_STATUS_FALSE;
-	}
+	return r;
+}
 
-	func = (PyObject *) cb_state.function;
-	if (!func) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");
-		return SWITCH_STATUS_FALSE;
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state->function is NOT null\n");
-	}
-	if (!PyCallable_Check(func)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
-		return SWITCH_STATUS_FALSE;
+void Session::check_hangup_hook()
+{
+	if (hangup_func && (hook_state == CS_HANGUP || hook_state == CS_ROUTING)) {
+		hh++;
 	}
+}
 
-	funcargs = (char *) cb_state.funcargs;
-
-	if (itype == SWITCH_INPUT_TYPE_DTMF) {
-
-		arglist = Py_BuildValue("(sis)", input, itype, funcargs);
-	} else if (itype == SWITCH_INPUT_TYPE_EVENT) {
-		// DUNNO if this is correct in the case we have an event
-		// will be of type switch_event_t *event;
-		// http://www.freeswitch.org/docs/structswitch__event.html
-		switch_event_t *event = (switch_event_t *) input;
-		arglist = Py_BuildValue("({s:s}is)", "body", event->body, itype, funcargs);
-
-		// build a dictionary with all the headers
-
-		switch_event_header_t *hp;
-		headerdict = PyDict_New();
-		for (hp = event->headers; hp; hp = hp->next) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding event header to result");
-
-			// TODO: create PyObject pointers for name and value
-			// and explicitly decref them.  all ref counting stuff is 
-			// a mess and needs to be tested and looked at closer.
-			PyDict_SetItem(headerdict, Py_BuildValue("s", hp->name), Py_BuildValue("s", hp->value));
-
-		}
+void Session::do_hangup_hook()
+{
+	PyObject *result, *arglist;
+	const char *what = hook_state == CS_HANGUP ? "hangup" : "transfer";
 
-		// add it to the main event dictionary (first arg in list)
-		// under key 'headers'
-		PyObject *dict = PyTuple_GetItem(arglist, 0);
-		PyDict_SetItemString(dict, "headers", headerdict);
+	if (hh && !mark) {
+		mark++;
 
-		Py_XDECREF(headerdict);
+		if (hangup_func) {
+			
+			if (!PyCallable_Check(hangup_func)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
+				return;
+			}
 
+			if (!Self) {
+				mod_python_conjure_session(NULL, session);
+			}
+			
+			if (hangup_func_arg) {
+				arglist = Py_BuildValue("(OsO)", Self, what, hangup_func_arg);
+			} else {
+				arglist = Py_BuildValue("(Os)", Self, what);
+			}
 
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown input type: %d\n", itype);
-		return SWITCH_STATUS_FALSE;
+			if (!(result = PyEval_CallObject(hangup_func, arglist))) {
+				PyErr_Print();
+			}
+			
+			Py_XDECREF(arglist);
+			Py_XDECREF(hangup_func_arg);
+		}
 	}
 
+}
 
-	if (!arglist) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error building arglist");
-		return SWITCH_STATUS_FALSE;
+static switch_status_t python_hanguphook(switch_core_session_t *session_hungup)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
+	CoreSession *coresession = NULL;
+	switch_channel_state_t state = switch_channel_get_state(channel);
+
+	if ((coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"))) {
+		if (coresession->hook_state != state) {
+			coresession->hook_state = state;
+			coresession->check_hangup_hook();
+		}
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback end_allow_threads\n");
-	did_swap_in = end_allow_threads();
+	return SWITCH_STATUS_SUCCESS;
+}
 
-	pyresult = PyEval_CallObject(func, arglist);
 
+void Session::setHangupHook(PyObject *pyfunc, PyObject *arg)
+{
 
-	Py_XDECREF(arglist);		// Trash arglist
+	if (!PyCallable_Check(pyfunc)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n");
+		return;
+	}
 
-	if (pyresult && pyresult != Py_None) {
-		resultStr = (char *) PyString_AsString(pyresult);
-		switch_status_t cbresult = process_callback_result(resultStr);
-		return cbresult;
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Python callback\n returned None");
-		PyErr_Print();
-		PyErr_Clear();
+	if (hangup_func) {
+		if (session) {
+			switch_core_event_hook_remove_state_change(session, python_hanguphook);
+		}
+		Py_XDECREF(hangup_func);
+		hangup_func = NULL;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback begin_allow_threads\n");
-	if (did_swap_in) {
-		begin_allow_threads();
+	if (hangup_func_arg) {
+		Py_XDECREF(hangup_func_arg);
+		hangup_func_arg = NULL;
 	}
+	
+	hangup_func = pyfunc;
+	hangup_func_arg = arg;
 
-	Py_XDECREF(pyresult);
+	Py_XINCREF(hangup_func);
 
-	return SWITCH_STATUS_SUCCESS;
+	if (hangup_func_arg) {
+		Py_XINCREF(hangup_func_arg);
+	}
+
+	switch_channel_set_private(channel, "CoreSession", this);
+	hook_state = switch_channel_get_state(channel);
+	switch_core_event_hook_add_state_change(session, python_hanguphook);
 
 }
 
-bool PySession::begin_allow_threads(void)
+void Session::setInputCallback(PyObject *cbfunc, PyObject *funcargs)
 {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::begin_allow_threads() called\n");
 
-	if (!session) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
-		return false;
+	if (!PyCallable_Check(cbfunc)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n");
+		return;
 	}
-	// swap out threadstate and store in instance variable 
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-	PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
-	// so lets assume the thread state was swapped in when the python script was started,
-	// therefore swapin_tstate will be NULL (because there is nothing to swap in, since its 
-	// _already_ swapped in.)
-	if (swapin_tstate == NULL) {
-		// currently swapped in
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-out!\n");
-		swapin_tstate = PyEval_SaveThread();
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);
-		// give future swapper-inners something to actually swap in
-		switch_channel_set_private(channel, "SwapInThreadState", (void *) swapin_tstate);
-		cb_state.threadState = threadState;	// TODO: get rid of this
-		args.buf = &cb_state;
-		ap = &args;
-		return true;
 
-	} else {
-		// currently swapped out
-		return false;
+	if (cb_function) {
+		Py_XDECREF(cb_function);
+		cb_function = NULL;
 	}
 
-}
-
-bool PySession::end_allow_threads(void)
-{
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::end_allow_threads() called\n");
-	// swap in threadstate from instance variable saved earlier
-	if (!session) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
-		return false;
+	if (cb_arg) {
+		Py_XDECREF(cb_arg);
+		cb_arg = NULL;
 	}
 
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-	PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
-	if (swapin_tstate == NULL) {
-		// currently swapped in
-		return false;
-	} else {
-		// currently swapped out
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-in!\n");
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);
-		PyEval_RestoreThread(swapin_tstate);
-		// dont give any swapper-inners the opportunity to do a double swap
-		switch_channel_set_private(channel, "SwapInThreadState", NULL);
-		return true;
+	cb_function = cbfunc;
+	cb_arg = funcargs;
+	args.buf = this;
+    switch_channel_set_private(channel, "CoreSession", this);
+
+	Py_XINCREF(cb_function);
+
+	if (cb_arg) {
+		Py_XINCREF(cb_arg);
 	}
 
+    args.input_callback = dtmf_callback;
+    ap = &args;
 
 }
 
-void PySession::hangup(char *cause)
+switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
 {
 
+	PyObject *pyresult, *arglist, *io = NULL;
+	int ts = 0;
+	char *str = NULL, *what = "";
 
-	// since we INCREF'd this function pointer earlier (so the py gc didnt reclaim it)
-	// we have to DECREF it, or else the PySession dtor will never get called and
-	// a zombie channel will be left over using up resources
+	if (TS) {
+		ts++;
+		end_allow_threads();
+	}
 
-	if (cb_state.function != NULL) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "xdecref on cb_state_function\n");
-		PyObject *func = (PyObject *) cb_state.function;
-		Py_XDECREF(func);
+	if (!PyCallable_Check(cb_function)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	if (itype == SWITCH_INPUT_TYPE_DTMF) {
+		switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+		io = mod_python_conjure_DTMF(dtmf->digit, dtmf->duration);
+		what = "dtmf";
+	} else if (itype == SWITCH_INPUT_TYPE_EVENT){
+		what = "event";
+		io = mod_python_conjure_event((switch_event_t *) input);
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state.function is null\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unsupported type!\n");
+		return SWITCH_STATUS_FALSE;
 	}
 
+	if (!Self) {
+		mod_python_conjure_session(NULL, session);
+	}
+	
+	if (cb_arg) {
+		arglist = Py_BuildValue("(OsOO)", Self, what, io, cb_arg);
+	} else {
+		arglist = Py_BuildValue("(OsO)", Self, what, io);
+	}
 
-	CoreSession::hangup(cause);
-
-}
-
+	if ((pyresult = PyEval_CallObject(cb_function, arglist))) {
+		str = (char *) PyString_AsString(pyresult);
+	} else {
+		PyErr_Print();
+	}
 
-PySession::~PySession()
-{
-	// Should we do any cleanup here?
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession started\n");
+	Py_XDECREF(arglist);
+	Py_XDECREF(io);
 
-	if (on_hangup) {
-		PyObject *func = (PyObject *) on_hangup;
-		Py_XDECREF(func);
+	if (cb_arg) {
+		Py_XDECREF(cb_arg);
 	}
 
-
-	if (cb_state.function != NULL) {
-		PyObject *func = (PyObject *) cb_state.function;
-		Py_XDECREF(func);
+	if (ts) {
+		begin_allow_threads();
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession finished\n");
+	if (str) {
+		return process_callback_result(str);
+	}
 
+	return SWITCH_STATUS_FALSE;
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.h	Mon Aug  4 21:29:58 2008
@@ -1,61 +1,49 @@
 #ifndef FREESWITCH_PYTHON_H
 #define FREESWITCH_PYTHON_H
 
-#include <Python.h>
-
-#ifdef __cplusplus
 extern "C" {
-#endif
-#ifdef DOH
+#include <Python.h>
+#include "mod_python_extra.h"
 }
-#endif
 
 #include <switch_cpp.h>
 
-
-
-typedef enum {
-	S_SWAPPED_IN = (1 << 0),
-	S_SWAPPED_OUT = (1 << 1)
-} swap_state_t;
-
-void console_log(char *level_str, char *msg);
-void console_clean_log(char *msg);
-
-class PySession : public CoreSession {
+namespace PYTHON {
+class Session : public CoreSession {
  private:
-    void *threadState;
-    int swapstate;
+	virtual void do_hangup_hook();
+	PyObject *getPython();
+	PyObject *Py;
+	PyObject *Self;
+	int hh;
+	int mark;
+	PyThreadState *TS;
  public:
-    PySession();
-    PySession(char *uuid);
-    PySession(switch_core_session_t *session);
-    ~PySession();        
-    void setDTMFCallback(PyObject *pyfunc, char *funcargs);
-    void setHangupHook(PyObject *pyfunc);
-    void check_hangup_hook();
-    void hangup(char *cause);
-    bool begin_allow_threads();
-    bool end_allow_threads();
-
-	/**
-	 * Run DTMF callback
-	 * 
-     * A static method in CoreSession is the first thing called
-	 * upon receving a dtmf/event callback from fs engine, and then
-	 * it gets the PySession instance and calls this method with
-	 * dtmf/event object.
-	 *
-	 * @param input - a dtmf char buffer, or an event 'object' (not sure..)
-	 * @param itype - a SWITCH_INPUT_TYPE_DTMF or a SWITCH_INPUT_TYPE_EVENT
-     */
-    switch_status_t run_dtmf_callback(void *input, 
-									  switch_input_type_t itype);
+    Session();
+    Session(char *nuuid, CoreSession *a_leg = NULL);
+    Session(switch_core_session_t *session);
+    virtual ~Session();        
+	
+	virtual bool begin_allow_threads();
+	virtual bool end_allow_threads();
+	virtual void check_hangup_hook();
+
+	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
+	void setInputCallback(PyObject *cbfunc, PyObject *funcargs = NULL);
+	void setHangupHook(PyObject *pyfunc, PyObject *arg = NULL);
+	bool ready();
+	
+	PyObject *cb_function;
+	PyObject *cb_arg;
+	PyObject *hangup_func;
+	PyObject *hangup_func_arg;
 
-};
+	/* keep a pointer to parent module, internal use only*/
+	void setPython(PyObject *state);
 
+	/* keeps the PyObject * version of the Session so it can be used as args to the callback */
+	void setSelf(PyObject *state);
 
-#ifdef __cplusplus
+};
 }
 #endif
-#endif

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.c	Mon Aug  4 21:29:58 2008
@@ -42,30 +42,42 @@
 #endif
 
 #include <switch.h>
-
+#include "mod_python_extra.h"
 
 PyThreadState *mainThreadState = NULL;
 
 void init_freeswitch(void);
+int py_thread(const char *text);
 static switch_api_interface_t python_run_interface;
 
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_python_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown);
 SWITCH_MODULE_DEFINITION(mod_python, mod_python_load, mod_python_shutdown, NULL);
 
-static void eval_some_python(char *uuid, char *args, switch_core_session_t *session)
+static struct {
+	switch_memory_pool_t *pool;
+	char *xml_handler;
+	switch_event_node_t *node;
+} globals;
+
+static void eval_some_python(const char *funcname, char *args, switch_core_session_t *session, switch_stream_handle_t *stream, switch_event_t *params, char **str)
 {
 	PyThreadState *tstate = NULL;
 	char *dupargs = NULL;
-	char *argv[128] = { 0 };
+	char *argv[2] = { 0 };
 	int argc;
 	int lead = 0;
 	char *script = NULL;
-	PyObject *module = NULL;
+	PyObject *module = NULL, *sp = NULL, *stp = NULL, *eve = NULL;
 	PyObject *function = NULL;
 	PyObject *arg = NULL;
 	PyObject *result = NULL;
+	switch_channel_t *channel = NULL;
+	char *p;
+
+	if (str) {
+		*str = NULL;
+	}
 
 	if (args) {
 		dupargs = strdup(args);
@@ -80,11 +92,20 @@
 		goto done;
 	}
 
-	script = argv[0];
+	script = strdup(switch_str_nil(argv[0]));
+	
 	lead = 1;
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Invoking py module: %s\n", script);
+	if ((p = strstr(script, "::"))) {
+		*p = '\0';
+		p += 2;
+		if (p) {
+			funcname = p;
+		}
+	}
 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Invoking py module: %s\n", script);
+	
 	tstate = PyThreadState_New(mainThreadState->interp);
 	if (!tstate) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error acquiring tstate\n");
@@ -92,11 +113,6 @@
 	}
 	// swap in thread state
 	PyEval_AcquireThread(tstate);
-	if (session) {
-		// record the fact that thread state is swapped in
-		switch_channel_t *channel = switch_core_session_get_channel(session);
-		switch_channel_set_private(channel, "SwapInThreadState", NULL);
-	}
 	init_freeswitch();
 
 	// import the module
@@ -115,89 +131,152 @@
 		PyErr_Clear();
 		goto done_swap_out;
 	}
+
 	// get the handler function to be called
-	function = PyObject_GetAttrString(module, "handler");
+	function = PyObject_GetAttrString(module, (char *)funcname);
 	if (!function) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Module does not define handler(uuid)\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Module does not define %s\n", funcname);
 		PyErr_Print();
 		PyErr_Clear();
 		goto done_swap_out;
 	}
 
-	if (uuid) {
-		// build a tuple to pass the args, the uuid of session
-		arg = Py_BuildValue("(s)", uuid);
-		if (!arg) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error building args\n");
-			PyErr_Print();
-			PyErr_Clear();
-			goto done_swap_out;
+	if (session) {
+		channel = switch_core_session_get_channel(session);
+		sp = mod_python_conjure_session(module, session);
+	}
+
+	if (params) {
+		eve = mod_python_conjure_event(params);
+	}
+
+	if (stream) {
+		stp = mod_python_conjure_stream(stream);
+		if (stream->param_event) {
+			eve = mod_python_conjure_event(stream->param_event);
 		}
-	} else {
-		arg = PyTuple_New(1);
-		PyObject *nada = Py_BuildValue("");
-		PyTuple_SetItem(arg, 0, nada);
 	}
 
+	if (sp && eve && stp) {
+		arg = Py_BuildValue("(OOOs)", sp, stp, eve, switch_str_nil(argv[1]));
+	} else if (eve && stp) {
+		arg = Py_BuildValue("(sOOs)", "na", stp, eve, switch_str_nil(argv[1]));
+	} else if (eve) {
+		arg = Py_BuildValue("(Os)", eve, switch_str_nil(argv[1]));
+	} else if (sp) {
+		arg = Py_BuildValue("(Os)", sp, switch_str_nil(argv[1]));
+	} else {
+		arg = Py_BuildValue("(s)", switch_str_nil(argv[1]));
+	}
+	
 	// invoke the handler 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call python script \n");
 	result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *) NULL);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Finished calling python script \n");
-
+	
 	// check the result and print out any errors
-	if (!result) {
+	if (result) {
+		if (str) {
+			*str = strdup((char *) PyString_AsString(result));
+		}
+	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error calling python script\n");
 		PyErr_Print();
 		PyErr_Clear();
+		PyRun_SimpleString("python_makes_sense");
+		PyGC_Collect();
 	}
 
-	goto done_swap_out;
+ done_swap_out:
+
+	if (arg) {
+		Py_DECREF(arg);
+	}
+	
+	if (sp) {
+		Py_DECREF(sp);
+	}
+	
+	if (tstate) {
+		PyEval_ReleaseThread(tstate);
+	}
+	
+ done:
 
-  done:
 	switch_safe_free(dupargs);
+	switch_safe_free(script);
 
-  done_swap_out:
-	// decrement ref counts 
-	Py_XDECREF(module);
-	Py_XDECREF(function);
-	Py_XDECREF(arg);
-	Py_XDECREF(result);
 
-	// swap out thread state
-	if (session) {
-		// record the fact that thread state is swapped in
-		switch_channel_t *channel = switch_core_session_get_channel(session);
-		PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
-		// so lets assume nothing in the python script swapped any thread state in
-		// or out .. thread state will currently be swapped in, and the SwapInThreadState 
-		// will be null
-		if (swapin_tstate == NULL) {
-			// clear out threadstate
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "clear threadstate \n");
-			// we know we are swapped in because swapin_tstate is NULL, and therefore we have the GIL, so
-			// it is safe to call PyThreadState_Get.
-			PyThreadState *cur_tstate = PyThreadState_Get();
-			PyThreadState_Clear(cur_tstate);
-			PyEval_ReleaseThread(cur_tstate);
-			PyThreadState_Delete(cur_tstate);
-		} else {
-			// thread state is already swapped out, so, nothing for us to do
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "according to chan priv data, already swapped out \n");
+}
+
+
+static switch_xml_t python_fetch(const char *section,
+							  const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
+{
+
+	switch_xml_t xml = NULL;
+	char *str = NULL;
+
+	if (!switch_strlen_zero(globals.xml_handler)) {
+		char *mycmd = strdup(globals.xml_handler);
+
+		switch_assert(mycmd);
+
+		eval_some_python("xml_fetch", mycmd, NULL, NULL, params, &str);
+
+		if (str) {
+			if (switch_strlen_zero(str)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
+			} else if (!(xml = switch_xml_parse_str((char *) str, strlen(str)))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
+			}
+			switch_safe_free(str);
 		}
-	} else {
-		// they ran python script from cmd line, behave a bit differently (untested)
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No session: Threadstate mod_python.c swap-out! \n");
-		PyEval_ReleaseThread(tstate);
+
+		free(mycmd);
 	}
 
-	switch_safe_free(dupargs);
+	return xml;
+}
+
+static switch_status_t do_config(void)
+{
+	char *cf = "python.conf";
+	switch_xml_t cfg, xml, settings, param;
+
+	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
+		return SWITCH_STATUS_TERM;
+	}
+
+	if ((settings = switch_xml_child(cfg, "settings"))) {
+		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+			char *var = (char *) switch_xml_attr_soft(param, "name");
+			char *val = (char *) switch_xml_attr_soft(param, "value");
+
+			if (!strcmp(var, "xml-handler-script")) {
+				globals.xml_handler = switch_core_strdup(globals.pool, val);
+			} else if (!strcmp(var, "xml-handler-bindings")) {
+				if (!switch_strlen_zero(globals.xml_handler)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, val);
+					switch_xml_bind_search_function(python_fetch, switch_xml_parse_section_string(val), NULL);
+				}
+			} else if (!strcmp(var, "startup-script")) {
+				if (val) {
+					py_thread(val);
+				}
+			}
+		}
+	}
 
+	switch_xml_free(xml);
 
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_STANDARD_APP(python_function)
 {
-	eval_some_python(switch_core_session_get_uuid(session), (char *) data, session);
+	eval_some_python("handler", (char *) data, session, NULL, NULL, NULL);
 
 }
 
@@ -211,7 +290,7 @@
 	switch_memory_pool_t *pool;
 	struct switch_py_thread *pt = (struct switch_py_thread *) obj;
 
-	eval_some_python(NULL, strdup(pt->args), NULL);
+	eval_some_python("runtime", pt->args, NULL, NULL, NULL, NULL);
 
 	pool = pt->pool;
 	switch_core_destroy_memory_pool(&pool);
@@ -219,18 +298,21 @@
 	return NULL;
 }
 
-SWITCH_STANDARD_API(launch_python)
+SWITCH_STANDARD_API(api_python)
+{
+	
+	eval_some_python("fsapi", (char *) cmd, session, stream, NULL, NULL);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+int py_thread(const char *text)
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
 	switch_memory_pool_t *pool;
 	struct switch_py_thread *pt;
 
-	if (switch_strlen_zero(cmd)) {
-		stream->write_function(stream, "USAGE: %s\n", python_run_interface.syntax);
-		return SWITCH_STATUS_SUCCESS;
-	}
-
 	switch_core_new_memory_pool(&pool);
 	assert(pool != NULL);
 
@@ -238,58 +320,79 @@
 	assert(pt != NULL);
 
 	pt->pool = pool;
-	pt->args = switch_core_strdup(pt->pool, cmd);
+	pt->args = switch_core_strdup(pt->pool, text);
 
 	switch_threadattr_create(&thd_attr, pt->pool);
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 	switch_thread_create(&thread, thd_attr, py_thread_run, pt, pt->pool);
 
-	stream->write_function(stream, "OK\n");
-	return SWITCH_STATUS_SUCCESS;
+	return 0;
 }
 
-static switch_application_interface_t python_application_interface = {
-	/*.interface_name */ "python",
-	/*.application_function */ python_function,
-	NULL, NULL, NULL,
-	/* flags */ SAF_NONE,
-	/* should we support no media mode here?  If so, we need to detect the mode, and either disable the media functions or indicate media if/when we need */
-	/*.next */ NULL
-};
+static void message_query_handler(switch_event_t *event)
+{
+	char *account = switch_event_get_header(event, "message-account");
 
-static switch_api_interface_t python_run_interface = {
-	/*.interface_name */ "python",
-	/*.desc */ "run a python script",
-	/*.function */ launch_python,
-	/*.syntax */ "python </path/to/script>",
-	/*.next */ NULL
-};
+	if (account) {
+		char *path, *cmd;
+		
+		path = switch_mprintf("%s%smwi.py", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
+		switch_assert(path != NULL);
+		
+		if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
+			cmd = switch_mprintf("%s %s", path, account);
+			switch_assert(cmd != NULL);
+			py_thread(cmd);
+			switch_safe_free(cmd);
+		}
+		switch_safe_free(path);
+	}
+}
 
-static switch_loadable_module_interface_t python_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ &python_application_interface,
-	/*.api_interface */ &python_run_interface,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL
-};
+SWITCH_STANDARD_API(launch_python)
+{
+
+	if (switch_strlen_zero(cmd)) {
+		stream->write_function(stream, "USAGE: %s\n", python_run_interface.syntax);
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	py_thread(cmd);
+	stream->write_function(stream, "OK\n");
+	return SWITCH_STATUS_SUCCESS;
+}
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_python_load)
 {
-	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &python_module_interface;
+	switch_api_interface_t *api_interface;
+	switch_application_interface_t *app_interface;
+	char *pp = getenv("PYTHONPATH");
+
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL, &globals.node)
+		!= SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+	if (pp) {
+		char *path = switch_mprintf("%s:%s", pp, SWITCH_GLOBAL_dirs.script_dir);
+		setenv("PYTHONPATH", path, 1);
+		free(path);
+	} else {
+		setenv("PYTHONPATH", SWITCH_GLOBAL_dirs.script_dir, 1);
+	}
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Python Framework Loading...\n");
 
+	globals.pool = pool;
+	do_config();
+
 	if (!Py_IsInitialized()) {
 
 		// initialize python system
 		Py_Initialize();
-
+		
 		// create GIL and a threadstate
 		PyEval_InitThreads();
 
@@ -305,6 +408,14 @@
 		PyEval_ReleaseLock();
 	}
 
+
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_API(api_interface, "pyrun", "run a python script", launch_python, "python </path/to/script>");
+	SWITCH_ADD_API(api_interface, "python", "run a python script", api_python, "python </path/to/script>");
+	SWITCH_ADD_APP(app_interface, "python", "Launch python ivr", "Run a python ivr on a channel", python_function, "<script> [additional_vars [...]]",
+				   SAF_SUPPORT_NOMEDIA);
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -324,7 +435,8 @@
 
 	Py_Finalize();
 	PyEval_ReleaseLock();
-	return SWITCH_STATUS_SUCCESS;
+	switch_event_unbind(&globals.node);
+	return SWITCH_STATUS_UNLOAD;
 
 }
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.i
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.i	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.i	Mon Aug  4 21:29:58 2008
@@ -26,5 +26,3 @@
 %include switch_swigable_cpp.h
 %include freeswitch_python.h
 
-
-

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp	Mon Aug  4 21:29:58 2008
@@ -12,35 +12,22 @@
 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
 
 #ifdef __cplusplus
-template < typename T > class SwigValueWrapper {
-	T *tt;
-  public:
-  SwigValueWrapper():tt(0) {
-	}
-	SwigValueWrapper(const SwigValueWrapper < T > &rhs):tt(new T(*rhs.tt)) {
-	}
-	SwigValueWrapper(const T & t):tt(new T(t)) {
-	}
-	~SwigValueWrapper() {
-		delete tt;
-	}
-	SwigValueWrapper & operator=(const T & t) {
-		delete tt;
-		tt = new T(t);
-		return *this;
-	}
-	operator  T & () const {
-		return *tt;
-	} T *operator&() {
-		return tt;
-	}
-  private:
-	SwigValueWrapper & operator=(const SwigValueWrapper < T > &rhs);
+template<typename T> class SwigValueWrapper {
+    T *tt;
+public:
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
 };
 
-template < typename T > T SwigValueInit()
-{
-	return T();
+template <typename T> T SwigValueInit() {
+  return T();
 }
 #endif
 
@@ -75,14 +62,14 @@
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__))
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
 # else
-#   define SWIGUNUSED
+#   define SWIGUNUSED 
 # endif
 #endif
 
@@ -90,7 +77,7 @@
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
 # endif
 #endif
 
@@ -133,7 +120,7 @@
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif
+# endif 
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -281,10 +268,10 @@
 
 
  */
-#define SWIG_OK                    (0)
+#define SWIG_OK                    (0) 
 #define SWIG_ERROR                 (-1)
 #define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
 
 /* The CastRankLimit says how many bits are used for the cast rank */
 #define SWIG_CASTRANKLIMIT         (1 << 8)
@@ -311,18 +298,16 @@
 #  ifndef SWIG_TypeRank
 #    define SWIG_TypeRank             unsigned long
 #  endif
-#  ifndef SWIG_MAXCASTRANK		/* Default cast allowed */
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
 #    define SWIG_MAXCASTRANK          (2)
 #  endif
 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r)
-{
-	return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
 }
-SWIGINTERNINLINE int SWIG_CheckState(int r)
-{
-	return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
 }
 #else /* no cast-rank mode */
 #  define SWIG_AddCast
@@ -338,38 +323,38 @@
 extern "C" {
 #endif
 
-	typedef void *(*swig_converter_func) (void *, int *);
-	typedef struct swig_type_info *(*swig_dycast_func) (void **);
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
 /* Structure to store information on one type */
-	typedef struct swig_type_info {
-		const char *name;		/* mangled name of this type */
-		const char *str;		/* human readable name of this type */
-		swig_dycast_func dcast;	/* dynamic cast function down a hierarchy */
-		struct swig_cast_info *cast;	/* linked list of types that can cast into this type */
-		void *clientdata;		/* language specific type data */
-		int owndata;			/* flag if the structure owns the clientdata */
-	} swig_type_info;
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
 
 /* Structure to store a type and conversion function used for casting */
-	typedef struct swig_cast_info {
-		swig_type_info *type;	/* pointer to type that is equivalent to this type */
-		swig_converter_func converter;	/* function to cast the void pointers */
-		struct swig_cast_info *next;	/* pointer to next cast in linked list */
-		struct swig_cast_info *prev;	/* pointer to the previous cast */
-	} swig_cast_info;
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
 
 /* Structure used to store module information
  * Each module generates one structure like this, and the runtime collects
  * all of these structures and stores them in a circularly linked list.*/
-	typedef struct swig_module_info {
-		swig_type_info **types;	/* Array of pointers to swig_type_info structures that are in this module */
-		size_t size;			/* Number of types in this module */
-		struct swig_module_info *next;	/* Pointer to next element in circularly linked list */
-		swig_type_info **type_initial;	/* Array of initially generated type structures */
-		swig_cast_info **cast_initial;	/* Array of initially generated casting structures */
-		void *clientdata;		/* Language specific module data */
-	} swig_module_info;
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
 
 /* 
   Compare two type names skipping the space characters, therefore
@@ -378,56 +363,54 @@
   Return 0 when the two name types are equivalent, as in
   strncmp, but skipping ' '.
 */
-	SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) {
-		for (; (f1 != l1) && (f2 != l2); ++f1, ++f2) {
-			while ((*f1 == ' ') && (f1 != l1))
-				++f1;
-			while ((*f2 == ' ') && (f2 != l2))
-				++f2;
-			if (*f1 != *f2)
-				return (*f1 > *f2) ? 1 : -1;
-		} return (int) ((l1 - f1) - (l2 - f2));
-	}
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if not equal, 1 if equal
 */
-	SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) {
-		int equiv = 0;
-		const char *te = tb + strlen(tb);
-		const char *ne = nb;
-		while (!equiv && *ne) {
-			for (nb = ne; *ne; ++ne) {
-				if (*ne == '|')
-					break;
-			}
-			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-			if (*ne)
-				++ne;
-		}
-		return equiv;
-	}
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
 
 /*
   Check type equivalence in a name list like <name1>|<name2>|...
   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
 */
-	SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) {
-		int equiv = 0;
-		const char *te = tb + strlen(tb);
-		const char *ne = nb;
-		while (!equiv && *ne) {
-			for (nb = ne; *ne; ++ne) {
-				if (*ne == '|')
-					break;
-			}
-			equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-			if (*ne)
-				++ne;
-		}
-		return equiv;
-	}
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
 
 
 /* think of this as a c++ template<> or a scheme macro */
@@ -455,89 +438,94 @@
 /*
   Check the typename
 */
-	SWIGRUNTIME swig_cast_info *SWIG_TypeCheck(const char *c, swig_type_info * ty) {
-		SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-	}
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
 
 /* Same as previous function, except strcmp is replaced with a pointer comparison */
-	SWIGRUNTIME swig_cast_info *SWIG_TypeCheckStruct(swig_type_info * from, swig_type_info * into) {
-		SWIG_TypeCheck_Template(iter->type == from, into);
-	}
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
 
 /*
   Cast a pointer up an inheritance hierarchy
 */
-	SWIGRUNTIMEINLINE void *SWIG_TypeCast(swig_cast_info * ty, void *ptr, int *newmemory) {
-		return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter) (ptr, newmemory);
-	}
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
 
 /* 
    Dynamic pointer casting. Down an inheritance hierarchy
 */
-	SWIGRUNTIME swig_type_info *SWIG_TypeDynamicCast(swig_type_info * ty, void **ptr) {
-		swig_type_info *lastty = ty;
-		if (!ty || !ty->dcast)
-			return ty;
-		while (ty && (ty->dcast)) {
-			ty = (*ty->dcast) (ptr);
-			if (ty)
-				lastty = ty;
-		}
-		return lastty;
-	}
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
 
 /*
   Return the name associated with this type
 */
-	SWIGRUNTIMEINLINE const char *SWIG_TypeName(const swig_type_info * ty) {
-		return ty->name;
-	}
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
 
 /*
   Return the pretty name associated with this type,
   that is an unmangled type name in a form presentable to the user.
 */
-	SWIGRUNTIME const char *SWIG_TypePrettyName(const swig_type_info * type) {
-		/* The "str" field contains the equivalent pretty names of the
-		   type, separated by vertical-bar characters.  We choose
-		   to print the last name, as it is often (?) the most
-		   specific. */
-		if (!type)
-			return NULL;
-		if (type->str != NULL) {
-			const char *last_name = type->str;
-			const char *s;
-			for (s = type->str; *s; s++)
-				if (*s == '|')
-					last_name = s + 1;
-			return last_name;
-		} else
-			return type->name;
-	}
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
 
 /* 
    Set the clientdata field for a type
 */
-	SWIGRUNTIME void SWIG_TypeClientData(swig_type_info * ti, void *clientdata) {
-		swig_cast_info *cast = ti->cast;
-		/* if (ti->clientdata == clientdata) return; */
-		ti->clientdata = clientdata;
-
-		while (cast) {
-			if (!cast->converter) {
-				swig_type_info *tc = cast->type;
-				if (!tc->clientdata) {
-					SWIG_TypeClientData(tc, clientdata);
-				}
-			}
-			cast = cast->next;
-		}
-	}
-	SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info * ti, void *clientdata) {
-		SWIG_TypeClientData(ti, clientdata);
-		ti->owndata = 1;
-	}
-
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
 /*
   Search for a swig_type_info structure only by mangled name
   Search is a O(log #types)
@@ -546,38 +534,41 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-	SWIGRUNTIME swig_type_info *SWIG_MangledTypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
-		swig_module_info *iter = start;
-		do {
-			if (iter->size) {
-				register size_t l = 0;
-				register size_t r = iter->size - 1;
-				do {
-					/* since l+r >= 0, we can (>> 1) instead (/ 2) */
-					register size_t i = (l + r) >> 1;
-					const char *iname = iter->types[i]->name;
-					if (iname) {
-						register int compare = strcmp(name, iname);
-						if (compare == 0) {
-							return iter->types[i];
-						} else if (compare < 0) {
-							if (i) {
-								r = i - 1;
-							} else {
-								break;
-							}
-						} else if (compare > 0) {
-							l = i + 1;
-						}
-					} else {
-						break;	/* should never happen */
-					}
-				} while (l <= r);
-			}
-			iter = iter->next;
-		} while (iter != end);
-		return 0;
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1; 
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {	    
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
 	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
 
 /*
   Search for a swig_type_info structure for either a mangled name or a human readable name.
@@ -588,142 +579,148 @@
   Note: if start == end at the beginning of the function, we go all the way around
   the circular list.
 */
-	SWIGRUNTIME swig_type_info *SWIG_TypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
-		/* STEP 1: Search the name field using binary search */
-		swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
-		if (ret) {
-			return ret;
-		} else {
-			/* STEP 2: If the type hasn't been found, do a complete search
-			   of the str field (the human readable name) */
-			swig_module_info *iter = start;
-			do {
-				register size_t i = 0;
-				for (; i < iter->size; ++i) {
-					if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
-						return iter->types[i];
-				}
-				iter = iter->next;
-			} while (iter != end);
-		}
-
-		/* neither found a match */
-		return 0;
-	}
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
 
 /* 
    Pack binary data into a string
 */
-	SWIGRUNTIME char *SWIG_PackData(char *c, void *ptr, size_t sz) {
-		static const char hex[17] = "0123456789abcdef";
-		register const unsigned char *u = (unsigned char *) ptr;
-		register const unsigned char *eu = u + sz;
-		for (; u != eu; ++u) {
-			register unsigned char uu = *u;
-			*(c++) = hex[(uu & 0xf0) >> 4];
-			*(c++) = hex[uu & 0xf];
-		}
-		return c;
-	}
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
 
 /* 
    Unpack binary data from a string
 */
-	SWIGRUNTIME const char *SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
-		register unsigned char *u = (unsigned char *) ptr;
-		register const unsigned char *eu = u + sz;
-		for (; u != eu; ++u) {
-			register char d = *(c++);
-			register unsigned char uu;
-			if ((d >= '0') && (d <= '9'))
-				uu = ((d - '0') << 4);
-			else if ((d >= 'a') && (d <= 'f'))
-				uu = ((d - ('a' - 10)) << 4);
-			else
-				return (char *) 0;
-			d = *(c++);
-			if ((d >= '0') && (d <= '9'))
-				uu |= (d - '0');
-			else if ((d >= 'a') && (d <= 'f'))
-				uu |= (d - ('a' - 10));
-			else
-				return (char *) 0;
-			*u = uu;
-		}
-		return c;
-	}
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
 
 /* 
    Pack 'void *' into a string buffer.
 */
-	SWIGRUNTIME char *SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
-		char *r = buff;
-		if ((2 * sizeof(void *) + 2) > bsz)
-			return 0;
-		*(r++) = '_';
-		r = SWIG_PackData(r, &ptr, sizeof(void *));
-		if (strlen(name) + 1 > (bsz - (r - buff)))
-			return 0;
-		strcpy(r, name);
-		return buff;
-	}
-
-	SWIGRUNTIME const char *SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
-		if (*c != '_') {
-			if (strcmp(c, "NULL") == 0) {
-				*ptr = (void *) 0;
-				return name;
-			} else {
-				return 0;
-			}
-		}
-		return SWIG_UnpackData(++c, ptr, sizeof(void *));
-	}
-
-	SWIGRUNTIME char *SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
-		char *r = buff;
-		size_t lname = (name ? strlen(name) : 0);
-		if ((2 * sz + 2 + lname) > bsz)
-			return 0;
-		*(r++) = '_';
-		r = SWIG_PackData(r, ptr, sz);
-		if (lname) {
-			strncpy(r, name, lname + 1);
-		} else {
-			*r = 0;
-		}
-		return buff;
-	}
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
 
-	SWIGRUNTIME const char *SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
-		if (*c != '_') {
-			if (strcmp(c, "NULL") == 0) {
-				memset(ptr, 0, sz);
-				return name;
-			} else {
-				return 0;
-			}
-		}
-		return SWIG_UnpackData(++c, ptr, sz);
-	}
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
 
 #ifdef __cplusplus
 }
 #endif
 
 /*  Errors in SWIG */
-#define  SWIG_UnknownError    	   -1
-#define  SWIG_IOError        	   -2
-#define  SWIG_RuntimeError   	   -3
-#define  SWIG_IndexError     	   -4
-#define  SWIG_TypeError      	   -5
-#define  SWIG_DivisionByZero 	   -6
-#define  SWIG_OverflowError  	   -7
-#define  SWIG_SyntaxError    	   -8
-#define  SWIG_ValueError     	   -9
+#define  SWIG_UnknownError    	   -1 
+#define  SWIG_IOError        	   -2 
+#define  SWIG_RuntimeError   	   -3 
+#define  SWIG_IndexError     	   -4 
+#define  SWIG_TypeError      	   -5 
+#define  SWIG_DivisionByZero 	   -6 
+#define  SWIG_OverflowError  	   -7 
+#define  SWIG_SyntaxError    	   -8 
+#define  SWIG_ValueError     	   -9 
 #define  SWIG_SystemError    	   -10
 #define  SWIG_AttributeError 	   -11
-#define  SWIG_MemoryError    	   -12
+#define  SWIG_MemoryError    	   -12 
 #define  SWIG_NullReferenceError   -13
 
 
@@ -745,15 +742,15 @@
 # define SWIG_PYBUFFER_SIZE 1024
 #endif
 
-static PyObject *PyString_FromFormat(const char *fmt, ...)
-{
-	va_list ap;
-	char buf[SWIG_PYBUFFER_SIZE * 2];
-	int res;
-	va_start(ap, fmt);
-	res = vsnprintf(buf, sizeof(buf), fmt, ap);
-	va_end(ap);
-	return (res < 0 || res >= (int) sizeof(buf)) ? 0 : PyString_FromString(buf);
+static PyObject *
+PyString_FromFormat(const char *fmt, ...) {
+  va_list ap;
+  char buf[SWIG_PYBUFFER_SIZE * 2];
+  int res;
+  va_start(ap, fmt);
+  res = vsnprintf(buf, sizeof(buf), fmt, ap);
+  va_end(ap);
+  return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
 }
 #endif
 
@@ -802,9 +799,9 @@
 static
 PyObject *PyBool_FromLong(long ok)
 {
-	PyObject *result = ok ? Py_True : Py_False;
-	Py_INCREF(result);
-	return result;
+  PyObject *result = ok ? Py_True : Py_False;
+  Py_INCREF(result);
+  return result;
 }
 #endif
 
@@ -821,68 +818,68 @@
  * error manipulation
  * ----------------------------------------------------------------------------- */
 
-SWIGRUNTIME PyObject *SWIG_Python_ErrorType(int code)
-{
-	PyObject *type = 0;
-	switch (code) {
-	case SWIG_MemoryError:
-		type = PyExc_MemoryError;
-		break;
-	case SWIG_IOError:
-		type = PyExc_IOError;
-		break;
-	case SWIG_RuntimeError:
-		type = PyExc_RuntimeError;
-		break;
-	case SWIG_IndexError:
-		type = PyExc_IndexError;
-		break;
-	case SWIG_TypeError:
-		type = PyExc_TypeError;
-		break;
-	case SWIG_DivisionByZero:
-		type = PyExc_ZeroDivisionError;
-		break;
-	case SWIG_OverflowError:
-		type = PyExc_OverflowError;
-		break;
-	case SWIG_SyntaxError:
-		type = PyExc_SyntaxError;
-		break;
-	case SWIG_ValueError:
-		type = PyExc_ValueError;
-		break;
-	case SWIG_SystemError:
-		type = PyExc_SystemError;
-		break;
-	case SWIG_AttributeError:
-		type = PyExc_AttributeError;
-		break;
-	default:
-		type = PyExc_RuntimeError;
-	}
-	return type;
+SWIGRUNTIME PyObject*
+SWIG_Python_ErrorType(int code) {
+  PyObject* type = 0;
+  switch(code) {
+  case SWIG_MemoryError:
+    type = PyExc_MemoryError;
+    break;
+  case SWIG_IOError:
+    type = PyExc_IOError;
+    break;
+  case SWIG_RuntimeError:
+    type = PyExc_RuntimeError;
+    break;
+  case SWIG_IndexError:
+    type = PyExc_IndexError;
+    break;
+  case SWIG_TypeError:
+    type = PyExc_TypeError;
+    break;
+  case SWIG_DivisionByZero:
+    type = PyExc_ZeroDivisionError;
+    break;
+  case SWIG_OverflowError:
+    type = PyExc_OverflowError;
+    break;
+  case SWIG_SyntaxError:
+    type = PyExc_SyntaxError;
+    break;
+  case SWIG_ValueError:
+    type = PyExc_ValueError;
+    break;
+  case SWIG_SystemError:
+    type = PyExc_SystemError;
+    break;
+  case SWIG_AttributeError:
+    type = PyExc_AttributeError;
+    break;
+  default:
+    type = PyExc_RuntimeError;
+  }
+  return type;
 }
 
 
-SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char *mesg)
-{
-	PyObject *type = 0;
-	PyObject *value = 0;
-	PyObject *traceback = 0;
-
-	if (PyErr_Occurred())
-		PyErr_Fetch(&type, &value, &traceback);
-	if (value) {
-		PyObject *old_str = PyObject_Str(value);
-		PyErr_Clear();
-		Py_XINCREF(type);
-		PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
-		Py_DECREF(old_str);
-		Py_DECREF(value);
-	} else {
-		PyErr_SetString(PyExc_RuntimeError, mesg);
-	}
+SWIGRUNTIME void
+SWIG_Python_AddErrorMsg(const char* mesg)
+{
+  PyObject *type = 0;
+  PyObject *value = 0;
+  PyObject *traceback = 0;
+
+  if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
+  if (value) {
+    PyObject *old_str = PyObject_Str(value);
+    PyErr_Clear();
+    Py_XINCREF(type);
+    PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
+    Py_DECREF(old_str);
+    Py_DECREF(value);
+  } else {
+    PyErr_SetString(PyExc_RuntimeError, mesg);
+  }
 }
 
 
@@ -892,48 +889,33 @@
 #    undef SWIG_PYTHON_THREADS
 #  endif
 #endif
-#if defined(SWIG_PYTHON_THREADS)	/* Threading support is enabled */
+#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
 #  if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
-#    if (PY_VERSION_HEX >= 0x02030000)	/* For 2.3 or later, use the PyGILState calls */
+#    if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
 #      define SWIG_PYTHON_USE_GIL
 #    endif
 #  endif
-#  if defined(SWIG_PYTHON_USE_GIL)	/* Use PyGILState threads calls */
+#  if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
 #    ifndef SWIG_PYTHON_INITIALIZE_THREADS
-#     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads()
+#     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads() 
 #    endif
-#    ifdef __cplusplus			/* C++ code */
-class SWIG_Python_Thread_Block {
-	bool status;
-	PyGILState_STATE state;
-  public:
-	void end() {
-		if (status) {
-			PyGILState_Release(state);
-			status = false;
-		}
-	} SWIG_Python_Thread_Block():status(true), state(PyGILState_Ensure()) {
-	}
-	~SWIG_Python_Thread_Block() {
-		end();
-	}
-};
-class SWIG_Python_Thread_Allow {
-	bool status;
-	PyThreadState *save;
-  public:
-	void end() {
-		if (status) {
-			PyEval_RestoreThread(save);
-			status = false;
-		}
-	} SWIG_Python_Thread_Allow():status(true), save(PyEval_SaveThread()) {
-	}
-	~SWIG_Python_Thread_Allow() {
-		end();
-	}
-};
-
+#    ifdef __cplusplus /* C++ code */
+       class SWIG_Python_Thread_Block {
+         bool status;
+         PyGILState_STATE state;
+       public:
+         void end() { if (status) { PyGILState_Release(state); status = false;} }
+         SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
+         ~SWIG_Python_Thread_Block() { end(); }
+       };
+       class SWIG_Python_Thread_Allow {
+         bool status;
+         PyThreadState *save;
+       public:
+         void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
+         SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
+         ~SWIG_Python_Thread_Allow() { end(); }
+       };
 #      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   SWIG_Python_Thread_Block _swig_thread_block
 #      define SWIG_PYTHON_THREAD_END_BLOCK     _swig_thread_block.end()
 #      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   SWIG_Python_Thread_Allow _swig_thread_allow
@@ -944,7 +926,7 @@
 #      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   PyThreadState *_swig_thread_allow = PyEval_SaveThread()
 #      define SWIG_PYTHON_THREAD_END_ALLOW     PyEval_RestoreThread(_swig_thread_allow)
 #    endif
-#  else	/* Old thread way, not implemented, user must provide it */
+#  else /* Old thread way, not implemented, user must provide it */
 #    if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
 #      define SWIG_PYTHON_INITIALIZE_THREADS
 #    endif
@@ -976,26 +958,31 @@
 #ifdef __cplusplus
 extern "C" {
 #if 0
-}								/* cc-mode */
+} /* cc-mode */
 #endif
 #endif
+
 /* -----------------------------------------------------------------------------
  * Constant declarations
- * ----------------------------------------------------------------------------- *//* Constant Types */
+ * ----------------------------------------------------------------------------- */
+
+/* Constant Types */
 #define SWIG_PY_POINTER 4
 #define SWIG_PY_BINARY  5
-/* Constant information structure */ typedef struct swig_const_info {
-	int type;
-	char *name;
-	long lvalue;
-	double dvalue;
-	void *pvalue;
-	swig_type_info **ptype;
+
+/* Constant information structure */
+typedef struct swig_const_info {
+  int type;
+  char *name;
+  long lvalue;
+  double dvalue;
+  void   *pvalue;
+  swig_type_info **ptype;
 } swig_const_info;
 
 #ifdef __cplusplus
 #if 0
-{								/* cc-mode */
+{ /* cc-mode */
 #endif
 }
 #endif
@@ -1020,7 +1007,7 @@
 #define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Python_ConvertPtr(obj, pptr, type, flags)
 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
 #define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(ptr, type, flags)
-#define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty)
+#define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty) 
 #define SWIG_AcquirePtr(ptr, src)                       SWIG_Python_AcquirePtr(ptr, src)
 #define swig_owntype                                    int
 
@@ -1047,121 +1034,125 @@
 #define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
 #define SWIG_NewClientData(obj)                         PySwigClientData_New(obj)
 
-#define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj
-#define SWIG_SetErrorMsg                        	SWIG_Python_SetErrorMsg
-#define SWIG_ErrorType(code)                    	SWIG_Python_ErrorType(code)
-#define SWIG_Error(code, msg)            		SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
-#define SWIG_fail                        		goto fail
+#define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj                            
+#define SWIG_SetErrorMsg                        	SWIG_Python_SetErrorMsg				   
+#define SWIG_ErrorType(code)                    	SWIG_Python_ErrorType(code)                        
+#define SWIG_Error(code, msg)            		SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 
+#define SWIG_fail                        		goto fail					   
 
 
 /* Runtime API implementation */
 
 /* Error manipulation */
 
-SWIGINTERN void SWIG_Python_SetErrorObj(PyObject * errtype, PyObject * obj)
-{
-	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
-	PyErr_SetObject(errtype, obj);
-	Py_DECREF(obj);
-	SWIG_PYTHON_THREAD_END_BLOCK;
+SWIGINTERN void 
+SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
+  SWIG_PYTHON_THREAD_BEGIN_BLOCK; 
+  PyErr_SetObject(errtype, obj);
+  Py_DECREF(obj);
+  SWIG_PYTHON_THREAD_END_BLOCK;
 }
 
-SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject * errtype, const char *msg)
-{
-	SWIG_PYTHON_THREAD_BEGIN_BLOCK;
-	PyErr_SetString(errtype, (char *) msg);
-	SWIG_PYTHON_THREAD_END_BLOCK;
+SWIGINTERN void 
+SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
+  SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+  PyErr_SetString(errtype, (char *) msg);
+  SWIG_PYTHON_THREAD_END_BLOCK;
 }
 
 #define SWIG_Python_Raise(obj, type, desc)  SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
 
 /* Set a constant value */
 
-SWIGINTERN void SWIG_Python_SetConstant(PyObject * d, const char *name, PyObject * obj)
-{
-	PyDict_SetItemString(d, (char *) name, obj);
-	Py_DECREF(obj);
+SWIGINTERN void
+SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {   
+  PyDict_SetItemString(d, (char*) name, obj);
+  Py_DECREF(obj);                            
 }
 
 /* Append a value to the result obj */
 
-SWIGINTERN PyObject *SWIG_Python_AppendOutput(PyObject * result, PyObject * obj)
-{
+SWIGINTERN PyObject*
+SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
 #if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
-	if (!result) {
-		result = obj;
-	} else if (result == Py_None) {
-		Py_DECREF(result);
-		result = obj;
-	} else {
-		if (!PyList_Check(result)) {
-			PyObject *o2 = result;
-			result = PyList_New(1);
-			PyList_SetItem(result, 0, o2);
-		}
-		PyList_Append(result, obj);
-		Py_DECREF(obj);
-	}
-	return result;
+  if (!result) {
+    result = obj;
+  } else if (result == Py_None) {
+    Py_DECREF(result);
+    result = obj;
+  } else {
+    if (!PyList_Check(result)) {
+      PyObject *o2 = result;
+      result = PyList_New(1);
+      PyList_SetItem(result, 0, o2);
+    }
+    PyList_Append(result,obj);
+    Py_DECREF(obj);
+  }
+  return result;
 #else
-	PyObject *o2;
-	PyObject *o3;
-	if (!result) {
-		result = obj;
-	} else if (result == Py_None) {
-		Py_DECREF(result);
-		result = obj;
-	} else {
-		if (!PyTuple_Check(result)) {
-			o2 = result;
-			result = PyTuple_New(1);
-			PyTuple_SET_ITEM(result, 0, o2);
-		}
-		o3 = PyTuple_New(1);
-		PyTuple_SET_ITEM(o3, 0, obj);
-		o2 = result;
-		result = PySequence_Concat(o2, o3);
-		Py_DECREF(o2);
-		Py_DECREF(o3);
-	}
-	return result;
+  PyObject*   o2;
+  PyObject*   o3;
+  if (!result) {
+    result = obj;
+  } else if (result == Py_None) {
+    Py_DECREF(result);
+    result = obj;
+  } else {
+    if (!PyTuple_Check(result)) {
+      o2 = result;
+      result = PyTuple_New(1);
+      PyTuple_SET_ITEM(result, 0, o2);
+    }
+    o3 = PyTuple_New(1);
+    PyTuple_SET_ITEM(o3, 0, obj);
+    o2 = result;
+    result = PySequence_Concat(o2, o3);
+    Py_DECREF(o2);
+    Py_DECREF(o3);
+  }
+  return result;
 #endif
 }
 
 /* Unpack the argument tuple */
 
-SWIGINTERN int SWIG_Python_UnpackTuple(PyObject * args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject ** objs)
+SWIGINTERN int
+SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
 {
-	if (!args) {
-		if (!min && !max) {
-			return 1;
-		} else {
-			PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int) min);
-			return 0;
-		}
-	}
-	if (!PyTuple_Check(args)) {
-		PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
-		return 0;
-	} else {
-		register Py_ssize_t l = PyTuple_GET_SIZE(args);
-		if (l < min) {
-			PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int) min, (int) l);
-			return 0;
-		} else if (l > max) {
-			PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int) max, (int) l);
-			return 0;
-		} else {
-			register int i;
-			for (i = 0; i < l; ++i) {
-				objs[i] = PyTuple_GET_ITEM(args, i);
-			}
-			for (; l < max; ++l) {
-				objs[l] = 0;
-			}
-			return i + 1;
-		}
-	}
+  if (!args) {
+    if (!min && !max) {
+      return 1;
+    } else {
+      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 
+		   name, (min == max ? "" : "at least "), (int)min);
+      return 0;
+    }
+  }  
+  if (!PyTuple_Check(args)) {
+    PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
+    return 0;
+  } else {
+    register Py_ssize_t l = PyTuple_GET_SIZE(args);
+    if (l < min) {
+      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
+		   name, (min == max ? "" : "at least "), (int)min, (int)l);
+      return 0;
+    } else if (l > max) {
+      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
+		   name, (min == max ? "" : "at most "), (int)max, (int)l);
+      return 0;
+    } else {
+      register int i;
+      for (i = 0; i < l; ++i) {
+	objs[i] = PyTuple_GET_ITEM(args, i);
+      }
+      for (; l < max; ++l) {
+	objs[l] = 0;
+      }
+      return i + 1;
+    }    
+  }
 }
 
 /* A functor is a function object with one single object argument */
@@ -1194,9 +1185,10 @@
 #ifdef __cplusplus
 extern "C" {
 #if 0
-}								/* cc-mode */
+} /* cc-mode */
 #endif
 #endif
+
 /*  How to access Py_None */
 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
 #  ifndef SWIG_PYTHON_NO_BUILD_NONE
@@ -1205,494 +1197,520 @@
 #    endif
 #  endif
 #endif
+
 #ifdef SWIG_PYTHON_BUILD_NONE
 #  ifdef Py_None
 #   undef Py_None
 #   define Py_None SWIG_Py_None()
 #  endif
-SWIGRUNTIMEINLINE PyObject *_SWIG_Py_None(void)
+SWIGRUNTIMEINLINE PyObject * 
+_SWIG_Py_None(void)
 {
-	PyObject *none = Py_BuildValue((char *) "");
-	Py_DECREF(none);
-	return none;
+  PyObject *none = Py_BuildValue((char*)"");
+  Py_DECREF(none);
+  return none;
 }
-SWIGRUNTIME PyObject *SWIG_Py_None(void)
+SWIGRUNTIME PyObject * 
+SWIG_Py_None(void)
 {
-	static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
-	return none;
+  static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
+  return none;
 }
 #endif
 
 /* The python void return value */
 
-SWIGRUNTIMEINLINE PyObject *SWIG_Py_Void(void)
+SWIGRUNTIMEINLINE PyObject * 
+SWIG_Py_Void(void)
 {
-	PyObject *none = Py_None;
-	Py_INCREF(none);
-	return none;
+  PyObject *none = Py_None;
+  Py_INCREF(none);
+  return none;
 }
 
 /* PySwigClientData */
 
 typedef struct {
-	PyObject *klass;
-	PyObject *newraw;
-	PyObject *newargs;
-	PyObject *destroy;
-	int delargs;
-	int implicitconv;
+  PyObject *klass;
+  PyObject *newraw;
+  PyObject *newargs;
+  PyObject *destroy;
+  int delargs;
+  int implicitconv;
 } PySwigClientData;
 
-SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info * ty)
+SWIGRUNTIMEINLINE int 
+SWIG_Python_CheckImplicit(swig_type_info *ty)
 {
-	PySwigClientData *data = (PySwigClientData *) ty->clientdata;
-	return data ? data->implicitconv : 0;
+  PySwigClientData *data = (PySwigClientData *)ty->clientdata;
+  return data ? data->implicitconv : 0;
 }
 
-SWIGRUNTIMEINLINE PyObject *SWIG_Python_ExceptionType(swig_type_info * desc)
-{
-	PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
-	PyObject *klass = data ? data->klass : 0;
-	return (klass ? klass : PyExc_RuntimeError);
+SWIGRUNTIMEINLINE PyObject *
+SWIG_Python_ExceptionType(swig_type_info *desc) {
+  PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
+  PyObject *klass = data ? data->klass : 0;
+  return (klass ? klass : PyExc_RuntimeError);
 }
 
 
-SWIGRUNTIME PySwigClientData *PySwigClientData_New(PyObject * obj)
-{
-	if (!obj) {
-		return 0;
-	} else {
-		PySwigClientData *data = (PySwigClientData *) malloc(sizeof(PySwigClientData));
-		/* the klass element */
-		data->klass = obj;
-		Py_INCREF(data->klass);
-		/* the newraw method and newargs arguments used to create a new raw instance */
-		if (PyClass_Check(obj)) {
-			data->newraw = 0;
-			data->newargs = obj;
-			Py_INCREF(obj);
-		} else {
+SWIGRUNTIME PySwigClientData * 
+PySwigClientData_New(PyObject* obj)
+{
+  if (!obj) {
+    return 0;
+  } else {
+    PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
+    /* the klass element */
+    data->klass = obj;
+    Py_INCREF(data->klass);
+    /* the newraw method and newargs arguments used to create a new raw instance */
+    if (PyClass_Check(obj)) {
+      data->newraw = 0;
+      data->newargs = obj;
+      Py_INCREF(obj);
+    } else {
 #if (PY_VERSION_HEX < 0x02020000)
-			data->newraw = 0;
+      data->newraw = 0;
 #else
-			data->newraw = PyObject_GetAttrString(data->klass, (char *) "__new__");
+      data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
 #endif
-			if (data->newraw) {
-				Py_INCREF(data->newraw);
-				data->newargs = PyTuple_New(1);
-				PyTuple_SetItem(data->newargs, 0, obj);
-			} else {
-				data->newargs = obj;
-			}
-			Py_INCREF(data->newargs);
-		}
-		/* the destroy method, aka as the C++ delete method */
-		data->destroy = PyObject_GetAttrString(data->klass, (char *) "__swig_destroy__");
-		if (PyErr_Occurred()) {
-			PyErr_Clear();
-			data->destroy = 0;
-		}
-		if (data->destroy) {
-			int flags;
-			Py_INCREF(data->destroy);
-			flags = PyCFunction_GET_FLAGS(data->destroy);
+      if (data->newraw) {
+	Py_INCREF(data->newraw);
+	data->newargs = PyTuple_New(1);
+	PyTuple_SetItem(data->newargs, 0, obj);
+      } else {
+	data->newargs = obj;
+      }
+      Py_INCREF(data->newargs);
+    }
+    /* the destroy method, aka as the C++ delete method */
+    data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
+    if (PyErr_Occurred()) {
+      PyErr_Clear();
+      data->destroy = 0;
+    }
+    if (data->destroy) {
+      int flags;
+      Py_INCREF(data->destroy);
+      flags = PyCFunction_GET_FLAGS(data->destroy);
 #ifdef METH_O
-			data->delargs = !(flags & (METH_O));
+      data->delargs = !(flags & (METH_O));
 #else
-			data->delargs = 0;
+      data->delargs = 0;
 #endif
-		} else {
-			data->delargs = 0;
-		}
-		data->implicitconv = 0;
-		return data;
-	}
+    } else {
+      data->delargs = 0;
+    }
+    data->implicitconv = 0;
+    return data;
+  }
 }
 
-SWIGRUNTIME void PySwigClientData_Del(PySwigClientData * data)
+SWIGRUNTIME void 
+PySwigClientData_Del(PySwigClientData* data)
 {
-	Py_XDECREF(data->newraw);
-	Py_XDECREF(data->newargs);
-	Py_XDECREF(data->destroy);
+  Py_XDECREF(data->newraw);
+  Py_XDECREF(data->newargs);
+  Py_XDECREF(data->destroy);
 }
 
 /* =============== PySwigObject =====================*/
 
 typedef struct {
-	PyObject_HEAD void *ptr;
-	swig_type_info *ty;
-	int own;
-	PyObject *next;
+  PyObject_HEAD
+  void *ptr;
+  swig_type_info *ty;
+  int own;
+  PyObject *next;
 } PySwigObject;
 
-SWIGRUNTIME PyObject *PySwigObject_long(PySwigObject * v)
+SWIGRUNTIME PyObject *
+PySwigObject_long(PySwigObject *v)
 {
-	return PyLong_FromVoidPtr(v->ptr);
+  return PyLong_FromVoidPtr(v->ptr);
 }
 
-SWIGRUNTIME PyObject *PySwigObject_format(const char *fmt, PySwigObject * v)
+SWIGRUNTIME PyObject *
+PySwigObject_format(const char* fmt, PySwigObject *v)
 {
-	PyObject *res = NULL;
-	PyObject *args = PyTuple_New(1);
-	if (args) {
-		if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
-			PyObject *ofmt = PyString_FromString(fmt);
-			if (ofmt) {
-				res = PyString_Format(ofmt, args);
-				Py_DECREF(ofmt);
-			}
-			Py_DECREF(args);
-		}
-	}
-	return res;
+  PyObject *res = NULL;
+  PyObject *args = PyTuple_New(1);
+  if (args) {
+    if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
+      PyObject *ofmt = PyString_FromString(fmt);
+      if (ofmt) {
+	res = PyString_Format(ofmt,args);
+	Py_DECREF(ofmt);
+      }
+      Py_DECREF(args);
+    }
+  }
+  return res;
 }
 
-SWIGRUNTIME PyObject *PySwigObject_oct(PySwigObject * v)
+SWIGRUNTIME PyObject *
+PySwigObject_oct(PySwigObject *v)
 {
-	return PySwigObject_format("%o", v);
+  return PySwigObject_format("%o",v);
 }
 
-SWIGRUNTIME PyObject *PySwigObject_hex(PySwigObject * v)
+SWIGRUNTIME PyObject *
+PySwigObject_hex(PySwigObject *v)
 {
-	return PySwigObject_format("%x", v);
+  return PySwigObject_format("%x",v);
 }
 
 SWIGRUNTIME PyObject *
 #ifdef METH_NOARGS
-PySwigObject_repr(PySwigObject * v)
+PySwigObject_repr(PySwigObject *v)
 #else
-PySwigObject_repr(PySwigObject * v, PyObject * args)
+PySwigObject_repr(PySwigObject *v, PyObject *args)
 #endif
 {
-	const char *name = SWIG_TypePrettyName(v->ty);
-	PyObject *hex = PySwigObject_hex(v);
-	PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
-	Py_DECREF(hex);
-	if (v->next) {
+  const char *name = SWIG_TypePrettyName(v->ty);
+  PyObject *hex = PySwigObject_hex(v);    
+  PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
+  Py_DECREF(hex);
+  if (v->next) {
 #ifdef METH_NOARGS
-		PyObject *nrep = PySwigObject_repr((PySwigObject *) v->next);
+    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
 #else
-		PyObject *nrep = PySwigObject_repr((PySwigObject *) v->next, args);
+    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
 #endif
-		PyString_ConcatAndDel(&repr, nrep);
-	}
-	return repr;
+    PyString_ConcatAndDel(&repr,nrep);
+  }
+  return repr;  
 }
 
-SWIGRUNTIME int PySwigObject_print(PySwigObject * v, FILE * fp, int SWIGUNUSEDPARM(flags))
+SWIGRUNTIME int
+PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
 {
 #ifdef METH_NOARGS
-	PyObject *repr = PySwigObject_repr(v);
+  PyObject *repr = PySwigObject_repr(v);
 #else
-	PyObject *repr = PySwigObject_repr(v, NULL);
+  PyObject *repr = PySwigObject_repr(v, NULL);
 #endif
-	if (repr) {
-		fputs(PyString_AsString(repr), fp);
-		Py_DECREF(repr);
-		return 0;
-	} else {
-		return 1;
-	}
+  if (repr) {
+    fputs(PyString_AsString(repr), fp);
+    Py_DECREF(repr);
+    return 0; 
+  } else {
+    return 1; 
+  }
 }
 
-SWIGRUNTIME PyObject *PySwigObject_str(PySwigObject * v)
+SWIGRUNTIME PyObject *
+PySwigObject_str(PySwigObject *v)
 {
-	char result[SWIG_BUFFER_SIZE];
-	return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? PyString_FromString(result) : 0;
+  char result[SWIG_BUFFER_SIZE];
+  return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
+    PyString_FromString(result) : 0;
 }
 
-SWIGRUNTIME int PySwigObject_compare(PySwigObject * v, PySwigObject * w)
+SWIGRUNTIME int
+PySwigObject_compare(PySwigObject *v, PySwigObject *w)
 {
-	void *i = v->ptr;
-	void *j = w->ptr;
-	return (i < j) ? -1 : ((i > j) ? 1 : 0);
+  void *i = v->ptr;
+  void *j = w->ptr;
+  return (i < j) ? -1 : ((i > j) ? 1 : 0);
 }
 
-SWIGRUNTIME PyTypeObject *_PySwigObject_type(void);
+SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
 
-SWIGRUNTIME PyTypeObject *PySwigObject_type(void)
-{
-	static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
-	return type;
+SWIGRUNTIME PyTypeObject*
+PySwigObject_type(void) {
+  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
+  return type;
 }
 
-SWIGRUNTIMEINLINE int PySwigObject_Check(PyObject * op)
-{
-	return ((op)->ob_type == PySwigObject_type())
-		|| (strcmp((op)->ob_type->tp_name, "PySwigObject") == 0);
+SWIGRUNTIMEINLINE int
+PySwigObject_Check(PyObject *op) {
+  return ((op)->ob_type == PySwigObject_type())
+    || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
 }
 
-SWIGRUNTIME PyObject *PySwigObject_New(void *ptr, swig_type_info * ty, int own);
+SWIGRUNTIME PyObject *
+PySwigObject_New(void *ptr, swig_type_info *ty, int own);
 
-SWIGRUNTIME void PySwigObject_dealloc(PyObject * v)
+SWIGRUNTIME void
+PySwigObject_dealloc(PyObject *v)
 {
-	PySwigObject *sobj = (PySwigObject *) v;
-	PyObject *next = sobj->next;
-	if (sobj->own == SWIG_POINTER_OWN) {
-		swig_type_info *ty = sobj->ty;
-		PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
-		PyObject *destroy = data ? data->destroy : 0;
-		if (destroy) {
-			/* destroy is always a VARARGS method */
-			PyObject *res;
-			if (data->delargs) {
-				/* we need to create a temporal object to carry the destroy operation */
-				PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
-				res = SWIG_Python_CallFunctor(destroy, tmp);
-				Py_DECREF(tmp);
-			} else {
-				PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
-				PyObject *mself = PyCFunction_GET_SELF(destroy);
-				res = ((*meth) (mself, v));
-			}
-			Py_XDECREF(res);
-		}
+  PySwigObject *sobj = (PySwigObject *) v;
+  PyObject *next = sobj->next;
+  if (sobj->own == SWIG_POINTER_OWN) {
+    swig_type_info *ty = sobj->ty;
+    PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
+    PyObject *destroy = data ? data->destroy : 0;
+    if (destroy) {
+      /* destroy is always a VARARGS method */
+      PyObject *res;
+      if (data->delargs) {
+	/* we need to create a temporal object to carry the destroy operation */
+	PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
+	res = SWIG_Python_CallFunctor(destroy, tmp);
+	Py_DECREF(tmp);
+      } else {
+	PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
+	PyObject *mself = PyCFunction_GET_SELF(destroy);
+	res = ((*meth)(mself, v));
+      }
+      Py_XDECREF(res);
+    } 
 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
-		else {
-			const char *name = SWIG_TypePrettyName(ty);
-			printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
-		}
+    else {
+      const char *name = SWIG_TypePrettyName(ty);
+      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
+    }
 #endif
-	}
-	Py_XDECREF(next);
-	PyObject_DEL(v);
+  } 
+  Py_XDECREF(next);
+  PyObject_DEL(v);
 }
 
-SWIGRUNTIME PyObject *PySwigObject_append(PyObject * v, PyObject * next)
+SWIGRUNTIME PyObject* 
+PySwigObject_append(PyObject* v, PyObject* next)
 {
-	PySwigObject *sobj = (PySwigObject *) v;
+  PySwigObject *sobj = (PySwigObject *) v;
 #ifndef METH_O
-	PyObject *tmp = 0;
-	if (!PyArg_ParseTuple(next, (char *) "O:append", &tmp))
-		return NULL;
-	next = tmp;
-#endif
-	if (!PySwigObject_Check(next)) {
-		return NULL;
-	}
-	sobj->next = next;
-	Py_INCREF(next);
-	return SWIG_Py_Void();
+  PyObject *tmp = 0;
+  if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
+  next = tmp;
+#endif
+  if (!PySwigObject_Check(next)) {
+    return NULL;
+  }
+  sobj->next = next;
+  Py_INCREF(next);
+  return SWIG_Py_Void();
 }
 
-SWIGRUNTIME PyObject *
+SWIGRUNTIME PyObject* 
 #ifdef METH_NOARGS
-PySwigObject_next(PyObject * v)
+PySwigObject_next(PyObject* v)
 #else
-PySwigObject_next(PyObject * v, PyObject * SWIGUNUSEDPARM(args))
+PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 #endif
 {
-	PySwigObject *sobj = (PySwigObject *) v;
-	if (sobj->next) {
-		Py_INCREF(sobj->next);
-		return sobj->next;
-	} else {
-		return SWIG_Py_Void();
-	}
+  PySwigObject *sobj = (PySwigObject *) v;
+  if (sobj->next) {    
+    Py_INCREF(sobj->next);
+    return sobj->next;
+  } else {
+    return SWIG_Py_Void();
+  }
 }
 
-SWIGINTERN PyObject *
+SWIGINTERN PyObject*
 #ifdef METH_NOARGS
-PySwigObject_disown(PyObject * v)
+PySwigObject_disown(PyObject *v)
 #else
-PySwigObject_disown(PyObject * v, PyObject * SWIGUNUSEDPARM(args))
+PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 #endif
 {
-	PySwigObject *sobj = (PySwigObject *) v;
-	sobj->own = 0;
-	return SWIG_Py_Void();
+  PySwigObject *sobj = (PySwigObject *)v;
+  sobj->own = 0;
+  return SWIG_Py_Void();
 }
 
-SWIGINTERN PyObject *
+SWIGINTERN PyObject*
 #ifdef METH_NOARGS
-PySwigObject_acquire(PyObject * v)
+PySwigObject_acquire(PyObject *v)
 #else
-PySwigObject_acquire(PyObject * v, PyObject * SWIGUNUSEDPARM(args))
+PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
 #endif
 {
-	PySwigObject *sobj = (PySwigObject *) v;
-	sobj->own = SWIG_POINTER_OWN;
-	return SWIG_Py_Void();
+  PySwigObject *sobj = (PySwigObject *)v;
+  sobj->own = SWIG_POINTER_OWN;
+  return SWIG_Py_Void();
 }
 
-SWIGINTERN PyObject *PySwigObject_own(PyObject * v, PyObject * args)
+SWIGINTERN PyObject*
+PySwigObject_own(PyObject *v, PyObject *args)
 {
-	PyObject *val = 0;
+  PyObject *val = 0;
 #if (PY_VERSION_HEX < 0x02020000)
-	if (!PyArg_ParseTuple(args, (char *) "|O:own", &val))
+  if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
 #else
-	if (!PyArg_UnpackTuple(args, (char *) "own", 0, 1, &val))
+  if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) 
 #endif
-	{
-		return NULL;
-	} else {
-		PySwigObject *sobj = (PySwigObject *) v;
-		PyObject *obj = PyBool_FromLong(sobj->own);
-		if (val) {
+    {
+      return NULL;
+    } 
+  else
+    {
+      PySwigObject *sobj = (PySwigObject *)v;
+      PyObject *obj = PyBool_FromLong(sobj->own);
+      if (val) {
 #ifdef METH_NOARGS
-			if (PyObject_IsTrue(val)) {
-				PySwigObject_acquire(v);
-			} else {
-				PySwigObject_disown(v);
-			}
+	if (PyObject_IsTrue(val)) {
+	  PySwigObject_acquire(v);
+	} else {
+	  PySwigObject_disown(v);
+	}
 #else
-			if (PyObject_IsTrue(val)) {
-				PySwigObject_acquire(v, args);
-			} else {
-				PySwigObject_disown(v, args);
-			}
-#endif
-		}
-		return obj;
+	if (PyObject_IsTrue(val)) {
+	  PySwigObject_acquire(v,args);
+	} else {
+	  PySwigObject_disown(v,args);
 	}
+#endif
+      } 
+      return obj;
+    }
 }
 
 #ifdef METH_O
-static PyMethodDef swigobject_methods[] = {
-	{(char *) "disown", (PyCFunction) PySwigObject_disown, METH_NOARGS, (char *) "releases ownership of the pointer"},
-	{(char *) "acquire", (PyCFunction) PySwigObject_acquire, METH_NOARGS, (char *) "aquires ownership of the pointer"},
-	{(char *) "own", (PyCFunction) PySwigObject_own, METH_VARARGS, (char *) "returns/sets ownership of the pointer"},
-	{(char *) "append", (PyCFunction) PySwigObject_append, METH_O, (char *) "appends another 'this' object"},
-	{(char *) "next", (PyCFunction) PySwigObject_next, METH_NOARGS, (char *) "returns the next 'this' object"},
-	{(char *) "__repr__", (PyCFunction) PySwigObject_repr, METH_NOARGS, (char *) "returns object representation"},
-	{0, 0, 0, 0}
+static PyMethodDef
+swigobject_methods[] = {
+  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
+  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS,  (char *)"aquires ownership of the pointer"},
+  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
+  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_O,       (char *)"appends another 'this' object"},
+  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
+  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,    METH_NOARGS,  (char *)"returns object representation"},
+  {0, 0, 0, 0}  
 };
 #else
-static PyMethodDef swigobject_methods[] = {
-	{(char *) "disown", (PyCFunction) PySwigObject_disown, METH_VARARGS, (char *) "releases ownership of the pointer"},
-	{(char *) "acquire", (PyCFunction) PySwigObject_acquire, METH_VARARGS, (char *) "aquires ownership of the pointer"},
-	{(char *) "own", (PyCFunction) PySwigObject_own, METH_VARARGS, (char *) "returns/sets ownership of the pointer"},
-	{(char *) "append", (PyCFunction) PySwigObject_append, METH_VARARGS, (char *) "appends another 'this' object"},
-	{(char *) "next", (PyCFunction) PySwigObject_next, METH_VARARGS, (char *) "returns the next 'this' object"},
-	{(char *) "__repr__", (PyCFunction) PySwigObject_repr, METH_VARARGS, (char *) "returns object representation"},
-	{0, 0, 0, 0}
+static PyMethodDef
+swigobject_methods[] = {
+  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
+  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS,  (char *)"aquires ownership of the pointer"},
+  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
+  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
+  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
+  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,   METH_VARARGS,  (char *)"returns object representation"},
+  {0, 0, 0, 0}  
 };
 #endif
 
 #if PY_VERSION_HEX < 0x02020000
-SWIGINTERN PyObject *PySwigObject_getattr(PySwigObject * sobj, char *name)
+SWIGINTERN PyObject *
+PySwigObject_getattr(PySwigObject *sobj,char *name)
 {
-	return Py_FindMethod(swigobject_methods, (PyObject *) sobj, name);
+  return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
 }
 #endif
 
-SWIGRUNTIME PyTypeObject *_PySwigObject_type(void)
-{
-	static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
-
-	static PyNumberMethods PySwigObject_as_number = {
-		(binaryfunc) 0,			/*nb_add */
-		(binaryfunc) 0,			/*nb_subtract */
-		(binaryfunc) 0,			/*nb_multiply */
-		(binaryfunc) 0,			/*nb_divide */
-		(binaryfunc) 0,			/*nb_remainder */
-		(binaryfunc) 0,			/*nb_divmod */
-		(ternaryfunc) 0,		/*nb_power */
-		(unaryfunc) 0,			/*nb_negative */
-		(unaryfunc) 0,			/*nb_positive */
-		(unaryfunc) 0,			/*nb_absolute */
-		(inquiry) 0,			/*nb_nonzero */
-		0,						/*nb_invert */
-		0,						/*nb_lshift */
-		0,						/*nb_rshift */
-		0,						/*nb_and */
-		0,						/*nb_xor */
-		0,						/*nb_or */
-		(coercion) 0,			/*nb_coerce */
-		(unaryfunc) PySwigObject_long,	/*nb_int */
-		(unaryfunc) PySwigObject_long,	/*nb_long */
-		(unaryfunc) 0,			/*nb_float */
-		(unaryfunc) PySwigObject_oct,	/*nb_oct */
-		(unaryfunc) PySwigObject_hex,	/*nb_hex */
-#if PY_VERSION_HEX >= 0x02050000	/* 2.5.0 */
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0	/* nb_inplace_add -> nb_index */
-#elif PY_VERSION_HEX >= 0x02020000	/* 2.2.0 */
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0	/* nb_inplace_add -> nb_inplace_true_divide */
-#elif PY_VERSION_HEX >= 0x02000000	/* 2.0.0 */
-		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0	/* nb_inplace_add -> nb_inplace_or */
-#endif
-	};
-
-	static PyTypeObject pyswigobject_type;
-	static int type_init = 0;
-	if (!type_init) {
-		const PyTypeObject tmp = {
-			PyObject_HEAD_INIT(NULL)
-				0,				/* ob_size */
-			(char *) "PySwigObject",	/* tp_name */
-			sizeof(PySwigObject),	/* tp_basicsize */
-			0,					/* tp_itemsize */
-			(destructor) PySwigObject_dealloc,	/* tp_dealloc */
-			(printfunc) PySwigObject_print,	/* tp_print */
+SWIGRUNTIME PyTypeObject*
+_PySwigObject_type(void) {
+  static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
+  
+  static PyNumberMethods PySwigObject_as_number = {
+    (binaryfunc)0, /*nb_add*/
+    (binaryfunc)0, /*nb_subtract*/
+    (binaryfunc)0, /*nb_multiply*/
+    (binaryfunc)0, /*nb_divide*/
+    (binaryfunc)0, /*nb_remainder*/
+    (binaryfunc)0, /*nb_divmod*/
+    (ternaryfunc)0,/*nb_power*/
+    (unaryfunc)0,  /*nb_negative*/
+    (unaryfunc)0,  /*nb_positive*/
+    (unaryfunc)0,  /*nb_absolute*/
+    (inquiry)0,    /*nb_nonzero*/
+    0,		   /*nb_invert*/
+    0,		   /*nb_lshift*/
+    0,		   /*nb_rshift*/
+    0,		   /*nb_and*/
+    0,		   /*nb_xor*/
+    0,		   /*nb_or*/
+    (coercion)0,   /*nb_coerce*/
+    (unaryfunc)PySwigObject_long, /*nb_int*/
+    (unaryfunc)PySwigObject_long, /*nb_long*/
+    (unaryfunc)0,                 /*nb_float*/
+    (unaryfunc)PySwigObject_oct,  /*nb_oct*/
+    (unaryfunc)PySwigObject_hex,  /*nb_hex*/
+#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
+#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
+#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
+    0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
+#endif
+  };
+
+  static PyTypeObject pyswigobject_type;  
+  static int type_init = 0;
+  if (!type_init) {
+    const PyTypeObject tmp
+      = {
+	PyObject_HEAD_INIT(NULL)
+	0,				    /* ob_size */
+	(char *)"PySwigObject",		    /* tp_name */
+	sizeof(PySwigObject),		    /* tp_basicsize */
+	0,			            /* tp_itemsize */
+	(destructor)PySwigObject_dealloc,   /* tp_dealloc */
+	(printfunc)PySwigObject_print,	    /* tp_print */
 #if PY_VERSION_HEX < 0x02020000
-			(getattrfunc) PySwigObject_getattr,	/* tp_getattr */
+	(getattrfunc)PySwigObject_getattr,  /* tp_getattr */ 
 #else
-			(getattrfunc) 0,	/* tp_getattr */
+	(getattrfunc)0,			    /* tp_getattr */ 
 #endif
-			(setattrfunc) 0,	/* tp_setattr */
-			(cmpfunc) PySwigObject_compare,	/* tp_compare */
-			(reprfunc) PySwigObject_repr,	/* tp_repr */
-			&PySwigObject_as_number,	/* tp_as_number */
-			0,					/* tp_as_sequence */
-			0,					/* tp_as_mapping */
-			(hashfunc) 0,		/* tp_hash */
-			(ternaryfunc) 0,	/* tp_call */
-			(reprfunc) PySwigObject_str,	/* tp_str */
-			PyObject_GenericGetAttr,	/* tp_getattro */
-			0,					/* tp_setattro */
-			0,					/* tp_as_buffer */
-			Py_TPFLAGS_DEFAULT,	/* tp_flags */
-			swigobject_doc,		/* tp_doc */
-			0,					/* tp_traverse */
-			0,					/* tp_clear */
-			0,					/* tp_richcompare */
-			0,					/* tp_weaklistoffset */
+	(setattrfunc)0,			    /* tp_setattr */ 
+	(cmpfunc)PySwigObject_compare,	    /* tp_compare */ 
+	(reprfunc)PySwigObject_repr,	    /* tp_repr */    
+	&PySwigObject_as_number,	    /* tp_as_number */
+	0,				    /* tp_as_sequence */
+	0,				    /* tp_as_mapping */
+	(hashfunc)0,			    /* tp_hash */
+	(ternaryfunc)0,			    /* tp_call */
+	(reprfunc)PySwigObject_str,	    /* tp_str */
+	PyObject_GenericGetAttr,            /* tp_getattro */
+	0,				    /* tp_setattro */
+	0,		                    /* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT,	            /* tp_flags */
+	swigobject_doc, 	            /* tp_doc */        
+	0,                                  /* tp_traverse */
+	0,                                  /* tp_clear */
+	0,                                  /* tp_richcompare */
+	0,                                  /* tp_weaklistoffset */
 #if PY_VERSION_HEX >= 0x02020000
-			0,					/* tp_iter */
-			0,					/* tp_iternext */
-			swigobject_methods,	/* tp_methods */
-			0,					/* tp_members */
-			0,					/* tp_getset */
-			0,					/* tp_base */
-			0,					/* tp_dict */
-			0,					/* tp_descr_get */
-			0,					/* tp_descr_set */
-			0,					/* tp_dictoffset */
-			0,					/* tp_init */
-			0,					/* tp_alloc */
-			0,					/* tp_new */
-			0,					/* tp_free */
-			0,					/* tp_is_gc */
-			0,					/* tp_bases */
-			0,					/* tp_mro */
-			0,					/* tp_cache */
-			0,					/* tp_subclasses */
-			0,					/* tp_weaklist */
+	0,                                  /* tp_iter */
+	0,                                  /* tp_iternext */
+	swigobject_methods,		    /* tp_methods */ 
+	0,			            /* tp_members */
+	0,				    /* tp_getset */	    	
+	0,			            /* tp_base */	        
+	0,				    /* tp_dict */	    	
+	0,				    /* tp_descr_get */  	
+	0,				    /* tp_descr_set */  	
+	0,				    /* tp_dictoffset */ 	
+	0,				    /* tp_init */	    	
+	0,				    /* tp_alloc */	    	
+	0,			            /* tp_new */	    	
+	0,	                            /* tp_free */	   
+        0,                                  /* tp_is_gc */  
+	0,				    /* tp_bases */   
+	0,				    /* tp_mro */
+	0,				    /* tp_cache */   
+ 	0,				    /* tp_subclasses */
+	0,				    /* tp_weaklist */
 #endif
 #if PY_VERSION_HEX >= 0x02030000
-			0,					/* tp_del */
+	0,                                  /* tp_del */
 #endif
 #ifdef COUNT_ALLOCS
-			0, 0, 0, 0			/* tp_alloc -> tp_next */
+	0,0,0,0                             /* tp_alloc -> tp_next */
 #endif
-		};
-		pyswigobject_type = tmp;
-		pyswigobject_type.ob_type = &PyType_Type;
-		type_init = 1;
-	}
-	return &pyswigobject_type;
+      };
+    pyswigobject_type = tmp;
+    pyswigobject_type.ob_type = &PyType_Type;
+    type_init = 1;
+  }
+  return &pyswigobject_type;
 }
 
-SWIGRUNTIME PyObject *PySwigObject_New(void *ptr, swig_type_info * ty, int own)
+SWIGRUNTIME PyObject *
+PySwigObject_New(void *ptr, swig_type_info *ty, int own)
 {
-	PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
-	if (sobj) {
-		sobj->ptr = ptr;
-		sobj->ty = ty;
-		sobj->own = own;
-		sobj->next = 0;
-	}
-	return (PyObject *) sobj;
+  PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
+  if (sobj) {
+    sobj->ptr  = ptr;
+    sobj->ty   = ty;
+    sobj->own  = own;
+    sobj->next = 0;
+  }
+  return (PyObject *)sobj;
 }
 
 /* -----------------------------------------------------------------------------
@@ -1700,402 +1718,404 @@
  * ----------------------------------------------------------------------------- */
 
 typedef struct {
-	PyObject_HEAD void *pack;
-	swig_type_info *ty;
-	size_t size;
+  PyObject_HEAD
+  void *pack;
+  swig_type_info *ty;
+  size_t size;
 } PySwigPacked;
 
-SWIGRUNTIME int PySwigPacked_print(PySwigPacked * v, FILE * fp, int SWIGUNUSEDPARM(flags))
-{
-	char result[SWIG_BUFFER_SIZE];
-	fputs("<Swig Packed ", fp);
-	if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
-		fputs("at ", fp);
-		fputs(result, fp);
-	}
-	fputs(v->ty->name, fp);
-	fputs(">", fp);
-	return 0;
-}
-
-SWIGRUNTIME PyObject *PySwigPacked_repr(PySwigPacked * v)
-{
-	char result[SWIG_BUFFER_SIZE];
-	if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
-		return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
-	} else {
-		return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
-	}
-}
-
-SWIGRUNTIME PyObject *PySwigPacked_str(PySwigPacked * v)
-{
-	char result[SWIG_BUFFER_SIZE];
-	if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
-		return PyString_FromFormat("%s%s", result, v->ty->name);
-	} else {
-		return PyString_FromString(v->ty->name);
-	}
-}
-
-SWIGRUNTIME int PySwigPacked_compare(PySwigPacked * v, PySwigPacked * w)
-{
-	size_t i = v->size;
-	size_t j = w->size;
-	int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
-	return s ? s : strncmp((char *) v->pack, (char *) w->pack, 2 * v->size);
-}
-
-SWIGRUNTIME PyTypeObject *_PySwigPacked_type(void);
-
-SWIGRUNTIME PyTypeObject *PySwigPacked_type(void)
-{
-	static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
-	return type;
-}
-
-SWIGRUNTIMEINLINE int PySwigPacked_Check(PyObject * op)
+SWIGRUNTIME int
+PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
 {
-	return ((op)->ob_type == _PySwigPacked_type())
-		|| (strcmp((op)->ob_type->tp_name, "PySwigPacked") == 0);
+  char result[SWIG_BUFFER_SIZE];
+  fputs("<Swig Packed ", fp); 
+  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+    fputs("at ", fp); 
+    fputs(result, fp); 
+  }
+  fputs(v->ty->name,fp); 
+  fputs(">", fp);
+  return 0; 
 }
-
-SWIGRUNTIME void PySwigPacked_dealloc(PyObject * v)
+  
+SWIGRUNTIME PyObject *
+PySwigPacked_repr(PySwigPacked *v)
 {
-	if (PySwigPacked_Check(v)) {
-		PySwigPacked *sobj = (PySwigPacked *) v;
-		free(sobj->pack);
-	}
-	PyObject_DEL(v);
+  char result[SWIG_BUFFER_SIZE];
+  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+    return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
+  } else {
+    return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
+  }  
 }
 
-SWIGRUNTIME PyTypeObject *_PySwigPacked_type(void)
+SWIGRUNTIME PyObject *
+PySwigPacked_str(PySwigPacked *v)
 {
-	static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
-	static PyTypeObject pyswigpacked_type;
-	static int type_init = 0;
-	if (!type_init) {
-		const PyTypeObject tmp = {
-			PyObject_HEAD_INIT(NULL)
-				0,				/* ob_size */
-			(char *) "PySwigPacked",	/* tp_name */
-			sizeof(PySwigPacked),	/* tp_basicsize */
-			0,					/* tp_itemsize */
-			(destructor) PySwigPacked_dealloc,	/* tp_dealloc */
-			(printfunc) PySwigPacked_print,	/* tp_print */
-			(getattrfunc) 0,	/* tp_getattr */
-			(setattrfunc) 0,	/* tp_setattr */
-			(cmpfunc) PySwigPacked_compare,	/* tp_compare */
-			(reprfunc) PySwigPacked_repr,	/* tp_repr */
-			0,					/* tp_as_number */
-			0,					/* tp_as_sequence */
-			0,					/* tp_as_mapping */
-			(hashfunc) 0,		/* tp_hash */
-			(ternaryfunc) 0,	/* tp_call */
-			(reprfunc) PySwigPacked_str,	/* tp_str */
-			PyObject_GenericGetAttr,	/* tp_getattro */
-			0,					/* tp_setattro */
-			0,					/* tp_as_buffer */
-			Py_TPFLAGS_DEFAULT,	/* tp_flags */
-			swigpacked_doc,		/* tp_doc */
-			0,					/* tp_traverse */
-			0,					/* tp_clear */
-			0,					/* tp_richcompare */
-			0,					/* tp_weaklistoffset */
+  char result[SWIG_BUFFER_SIZE];
+  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
+    return PyString_FromFormat("%s%s", result, v->ty->name);
+  } else {
+    return PyString_FromString(v->ty->name);
+  }  
+}
+
+SWIGRUNTIME int
+PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
+{
+  size_t i = v->size;
+  size_t j = w->size;
+  int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
+  return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
+}
+
+SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
+
+SWIGRUNTIME PyTypeObject*
+PySwigPacked_type(void) {
+  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
+  return type;
+}
+
+SWIGRUNTIMEINLINE int
+PySwigPacked_Check(PyObject *op) {
+  return ((op)->ob_type == _PySwigPacked_type()) 
+    || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
+}
+
+SWIGRUNTIME void
+PySwigPacked_dealloc(PyObject *v)
+{
+  if (PySwigPacked_Check(v)) {
+    PySwigPacked *sobj = (PySwigPacked *) v;
+    free(sobj->pack);
+  }
+  PyObject_DEL(v);
+}
+
+SWIGRUNTIME PyTypeObject*
+_PySwigPacked_type(void) {
+  static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
+  static PyTypeObject pyswigpacked_type;
+  static int type_init = 0;  
+  if (!type_init) {
+    const PyTypeObject tmp
+      = {
+	PyObject_HEAD_INIT(NULL)
+	0,				    /* ob_size */	
+	(char *)"PySwigPacked",		    /* tp_name */	
+	sizeof(PySwigPacked),		    /* tp_basicsize */	
+	0,				    /* tp_itemsize */	
+	(destructor)PySwigPacked_dealloc,   /* tp_dealloc */	
+	(printfunc)PySwigPacked_print,	    /* tp_print */   	
+	(getattrfunc)0,			    /* tp_getattr */ 	
+	(setattrfunc)0,			    /* tp_setattr */ 	
+	(cmpfunc)PySwigPacked_compare,	    /* tp_compare */ 	
+	(reprfunc)PySwigPacked_repr,	    /* tp_repr */    	
+	0,	                            /* tp_as_number */	
+	0,				    /* tp_as_sequence */
+	0,				    /* tp_as_mapping */	
+	(hashfunc)0,			    /* tp_hash */	
+	(ternaryfunc)0,			    /* tp_call */	
+	(reprfunc)PySwigPacked_str,	    /* tp_str */	
+	PyObject_GenericGetAttr,            /* tp_getattro */
+	0,				    /* tp_setattro */
+	0,		                    /* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT,	            /* tp_flags */
+	swigpacked_doc, 	            /* tp_doc */
+	0,                                  /* tp_traverse */
+	0,                                  /* tp_clear */
+	0,                                  /* tp_richcompare */
+	0,                                  /* tp_weaklistoffset */
 #if PY_VERSION_HEX >= 0x02020000
-			0,					/* tp_iter */
-			0,					/* tp_iternext */
-			0,					/* tp_methods */
-			0,					/* tp_members */
-			0,					/* tp_getset */
-			0,					/* tp_base */
-			0,					/* tp_dict */
-			0,					/* tp_descr_get */
-			0,					/* tp_descr_set */
-			0,					/* tp_dictoffset */
-			0,					/* tp_init */
-			0,					/* tp_alloc */
-			0,					/* tp_new */
-			0,					/* tp_free */
-			0,					/* tp_is_gc */
-			0,					/* tp_bases */
-			0,					/* tp_mro */
-			0,					/* tp_cache */
-			0,					/* tp_subclasses */
-			0,					/* tp_weaklist */
+	0,                                  /* tp_iter */
+	0,                                  /* tp_iternext */
+	0,		                    /* tp_methods */ 
+	0,			            /* tp_members */
+	0,				    /* tp_getset */	    	
+	0,			            /* tp_base */	        
+	0,				    /* tp_dict */	    	
+	0,				    /* tp_descr_get */  	
+	0,				    /* tp_descr_set */  	
+	0,				    /* tp_dictoffset */ 	
+	0,				    /* tp_init */	    	
+	0,				    /* tp_alloc */	    	
+	0,			            /* tp_new */	    	
+	0, 	                            /* tp_free */	   
+        0,                                  /* tp_is_gc */  
+	0,				    /* tp_bases */   
+	0,				    /* tp_mro */
+	0,				    /* tp_cache */   
+ 	0,				    /* tp_subclasses */
+	0,				    /* tp_weaklist */
 #endif
 #if PY_VERSION_HEX >= 0x02030000
-			0,					/* tp_del */
+	0,                                  /* tp_del */
 #endif
 #ifdef COUNT_ALLOCS
-			0, 0, 0, 0			/* tp_alloc -> tp_next */
+	0,0,0,0                             /* tp_alloc -> tp_next */
 #endif
-		};
-		pyswigpacked_type = tmp;
-		pyswigpacked_type.ob_type = &PyType_Type;
-		type_init = 1;
-	}
-	return &pyswigpacked_type;
+      };
+    pyswigpacked_type = tmp;
+    pyswigpacked_type.ob_type = &PyType_Type;
+    type_init = 1;
+  }
+  return &pyswigpacked_type;
 }
 
-SWIGRUNTIME PyObject *PySwigPacked_New(void *ptr, size_t size, swig_type_info * ty)
+SWIGRUNTIME PyObject *
+PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
 {
-	PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
-	if (sobj) {
-		void *pack = malloc(size);
-		if (pack) {
-			memcpy(pack, ptr, size);
-			sobj->pack = pack;
-			sobj->ty = ty;
-			sobj->size = size;
-		} else {
-			PyObject_DEL((PyObject *) sobj);
-			sobj = 0;
-		}
-	}
-	return (PyObject *) sobj;
+  PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
+  if (sobj) {
+    void *pack = malloc(size);
+    if (pack) {
+      memcpy(pack, ptr, size);
+      sobj->pack = pack;
+      sobj->ty   = ty;
+      sobj->size = size;
+    } else {
+      PyObject_DEL((PyObject *) sobj);
+      sobj = 0;
+    }
+  }
+  return (PyObject *) sobj;
 }
 
-SWIGRUNTIME swig_type_info *PySwigPacked_UnpackData(PyObject * obj, void *ptr, size_t size)
+SWIGRUNTIME swig_type_info *
+PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
 {
-	if (PySwigPacked_Check(obj)) {
-		PySwigPacked *sobj = (PySwigPacked *) obj;
-		if (sobj->size != size)
-			return 0;
-		memcpy(ptr, sobj->pack, size);
-		return sobj->ty;
-	} else {
-		return 0;
-	}
+  if (PySwigPacked_Check(obj)) {
+    PySwigPacked *sobj = (PySwigPacked *)obj;
+    if (sobj->size != size) return 0;
+    memcpy(ptr, sobj->pack, size);
+    return sobj->ty;
+  } else {
+    return 0;
+  }
 }
 
 /* -----------------------------------------------------------------------------
  * pointers/data manipulation
  * ----------------------------------------------------------------------------- */
 
-SWIGRUNTIMEINLINE PyObject *_SWIG_This(void)
+SWIGRUNTIMEINLINE PyObject *
+_SWIG_This(void)
 {
-	return PyString_FromString("this");
+  return PyString_FromString("this");
 }
 
-SWIGRUNTIME PyObject *SWIG_This(void)
+SWIGRUNTIME PyObject *
+SWIG_This(void)
 {
-	static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
-	return swig_this;
+  static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
+  return swig_this;
 }
 
 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
 
-SWIGRUNTIME PySwigObject *SWIG_Python_GetSwigThis(PyObject * pyobj)
+SWIGRUNTIME PySwigObject *
+SWIG_Python_GetSwigThis(PyObject *pyobj) 
 {
-	if (PySwigObject_Check(pyobj)) {
-		return (PySwigObject *) pyobj;
-	} else {
-		PyObject *obj = 0;
+  if (PySwigObject_Check(pyobj)) {
+    return (PySwigObject *) pyobj;
+  } else {
+    PyObject *obj = 0;
 #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
-		if (PyInstance_Check(pyobj)) {
-			obj = _PyInstance_Lookup(pyobj, SWIG_This());
-		} else {
-			PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
-			if (dictptr != NULL) {
-				PyObject *dict = *dictptr;
-				obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
-			} else {
+    if (PyInstance_Check(pyobj)) {
+      obj = _PyInstance_Lookup(pyobj, SWIG_This());      
+    } else {
+      PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
+      if (dictptr != NULL) {
+	PyObject *dict = *dictptr;
+	obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
+      } else {
 #ifdef PyWeakref_CheckProxy
-				if (PyWeakref_CheckProxy(pyobj)) {
-					PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
-					return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
-				}
-#endif
-				obj = PyObject_GetAttr(pyobj, SWIG_This());
-				if (obj) {
-					Py_DECREF(obj);
-				} else {
-					if (PyErr_Occurred())
-						PyErr_Clear();
-					return 0;
-				}
-			}
-		}
-#else
-		obj = PyObject_GetAttr(pyobj, SWIG_This());
-		if (obj) {
-			Py_DECREF(obj);
-		} else {
-			if (PyErr_Occurred())
-				PyErr_Clear();
-			return 0;
-		}
+	if (PyWeakref_CheckProxy(pyobj)) {
+	  PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
+	  return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
+	}
 #endif
-		if (obj && !PySwigObject_Check(obj)) {
-			/* a PyObject is called 'this', try to get the 'real this'
-			   PySwigObject from it */
-			return SWIG_Python_GetSwigThis(obj);
-		}
-		return (PySwigObject *) obj;
+	obj = PyObject_GetAttr(pyobj,SWIG_This());
+	if (obj) {
+	  Py_DECREF(obj);
+	} else {
+	  if (PyErr_Occurred()) PyErr_Clear();
+	  return 0;
 	}
+      }
+    }
+#else
+    obj = PyObject_GetAttr(pyobj,SWIG_This());
+    if (obj) {
+      Py_DECREF(obj);
+    } else {
+      if (PyErr_Occurred()) PyErr_Clear();
+      return 0;
+    }
+#endif
+    if (obj && !PySwigObject_Check(obj)) {
+      /* a PyObject is called 'this', try to get the 'real this'
+	 PySwigObject from it */ 
+      return SWIG_Python_GetSwigThis(obj);
+    }
+    return (PySwigObject *)obj;
+  }
 }
 
 /* Acquire a pointer value */
 
-SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject * obj, int own)
-{
-	if (own == SWIG_POINTER_OWN) {
-		PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
-		if (sobj) {
-			int oldown = sobj->own;
-			sobj->own = own;
-			return oldown;
-		}
-	}
-	return 0;
+SWIGRUNTIME int
+SWIG_Python_AcquirePtr(PyObject *obj, int own) {
+  if (own == SWIG_POINTER_OWN) {
+    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+    if (sobj) {
+      int oldown = sobj->own;
+      sobj->own = own;
+      return oldown;
+    }
+  }
+  return 0;
 }
 
 /* Convert a pointer value */
 
-SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject * obj, void **ptr, swig_type_info * ty, int flags, int *own)
-{
-	if (!obj)
-		return SWIG_ERROR;
-	if (obj == Py_None) {
-		if (ptr)
-			*ptr = 0;
-		return SWIG_OK;
+SWIGRUNTIME int
+SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
+  if (!obj) return SWIG_ERROR;
+  if (obj == Py_None) {
+    if (ptr) *ptr = 0;
+    return SWIG_OK;
+  } else {
+    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+    if (own)
+      *own = 0;
+    while (sobj) {
+      void *vptr = sobj->ptr;
+      if (ty) {
+	swig_type_info *to = sobj->ty;
+	if (to == ty) {
+	  /* no type cast needed */
+	  if (ptr) *ptr = vptr;
+	  break;
 	} else {
-		PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
-		if (own)
-			*own = 0;
-		while (sobj) {
-			void *vptr = sobj->ptr;
-			if (ty) {
-				swig_type_info *to = sobj->ty;
-				if (to == ty) {
-					/* no type cast needed */
-					if (ptr)
-						*ptr = vptr;
-					break;
-				} else {
-					swig_cast_info *tc = SWIG_TypeCheck(to->name, ty);
-					if (!tc) {
-						sobj = (PySwigObject *) sobj->next;
-					} else {
-						if (ptr) {
-							int newmemory = 0;
-							*ptr = SWIG_TypeCast(tc, vptr, &newmemory);
-							if (newmemory == SWIG_CAST_NEW_MEMORY) {
-								assert(own);
-								if (own)
-									*own = *own | SWIG_CAST_NEW_MEMORY;
-							}
-						}
-						break;
-					}
-				}
-			} else {
-				if (ptr)
-					*ptr = vptr;
-				break;
-			}
-		}
-		if (sobj) {
-			if (own)
-				*own = *own | sobj->own;
-			if (flags & SWIG_POINTER_DISOWN) {
-				sobj->own = 0;
-			}
-			return SWIG_OK;
-		} else {
-			int res = SWIG_ERROR;
-			if (flags & SWIG_POINTER_IMPLICIT_CONV) {
-				PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
-				if (data && !data->implicitconv) {
-					PyObject *klass = data->klass;
-					if (klass) {
-						PyObject *impconv;
-						data->implicitconv = 1;	/* avoid recursion and call 'explicit' constructors */
-						impconv = SWIG_Python_CallFunctor(klass, obj);
-						data->implicitconv = 0;
-						if (PyErr_Occurred()) {
-							PyErr_Clear();
-							impconv = 0;
-						}
-						if (impconv) {
-							PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
-							if (iobj) {
-								void *vptr;
-								res = SWIG_Python_ConvertPtrAndOwn((PyObject *) iobj, &vptr, ty, 0, 0);
-								if (SWIG_IsOK(res)) {
-									if (ptr) {
-										*ptr = vptr;
-										/* transfer the ownership to 'ptr' */
-										iobj->own = 0;
-										res = SWIG_AddCast(res);
-										res = SWIG_AddNewMask(res);
-									} else {
-										res = SWIG_AddCast(res);
-									}
-								}
-							}
-							Py_DECREF(impconv);
-						}
-					}
-				}
-			}
-			return res;
-		}
+	  swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
+	  if (!tc) {
+	    sobj = (PySwigObject *)sobj->next;
+	  } else {
+	    if (ptr) {
+              int newmemory = 0;
+              *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+              if (newmemory == SWIG_CAST_NEW_MEMORY) {
+                assert(own);
+                if (own)
+                  *own = *own | SWIG_CAST_NEW_MEMORY;
+              }
+            }
+	    break;
+	  }
+	}
+      } else {
+	if (ptr) *ptr = vptr;
+	break;
+      }
+    }
+    if (sobj) {
+      if (own)
+        *own = *own | sobj->own;
+      if (flags & SWIG_POINTER_DISOWN) {
+	sobj->own = 0;
+      }
+      return SWIG_OK;
+    } else {
+      int res = SWIG_ERROR;
+      if (flags & SWIG_POINTER_IMPLICIT_CONV) {
+	PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
+	if (data && !data->implicitconv) {
+	  PyObject *klass = data->klass;
+	  if (klass) {
+	    PyObject *impconv;
+	    data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
+	    impconv = SWIG_Python_CallFunctor(klass, obj);
+	    data->implicitconv = 0;
+	    if (PyErr_Occurred()) {
+	      PyErr_Clear();
+	      impconv = 0;
+	    }
+	    if (impconv) {
+	      PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
+	      if (iobj) {
+		void *vptr;
+		res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
+		if (SWIG_IsOK(res)) {
+		  if (ptr) {
+		    *ptr = vptr;
+		    /* transfer the ownership to 'ptr' */
+		    iobj->own = 0;
+		    res = SWIG_AddCast(res);
+		    res = SWIG_AddNewMask(res);
+		  } else {
+		    res = SWIG_AddCast(res);		    
+		  }
+		}
+	      }
+	      Py_DECREF(impconv);
+	    }
+	  }
 	}
+      }
+      return res;
+    }
+  }
 }
 
 /* Convert a function ptr value */
 
-SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject * obj, void **ptr, swig_type_info * ty)
-{
-	if (!PyCFunction_Check(obj)) {
-		return SWIG_ConvertPtr(obj, ptr, ty, 0);
-	} else {
-		void *vptr = 0;
-
-		/* here we get the method pointer for callbacks */
-		const char *doc = (((PyCFunctionObject *) obj)->m_ml->ml_doc);
-		const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
-		if (desc) {
-			desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
-			if (!desc)
-				return SWIG_ERROR;
-		}
-		if (ty) {
-			swig_cast_info *tc = SWIG_TypeCheck(desc, ty);
-			if (tc) {
-				int newmemory = 0;
-				*ptr = SWIG_TypeCast(tc, vptr, &newmemory);
-				assert(!newmemory);	/* newmemory handling not yet implemented */
-			} else {
-				return SWIG_ERROR;
-			}
-		} else {
-			*ptr = vptr;
-		}
-		return SWIG_OK;
-	}
+SWIGRUNTIME int
+SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
+  if (!PyCFunction_Check(obj)) {
+    return SWIG_ConvertPtr(obj, ptr, ty, 0);
+  } else {
+    void *vptr = 0;
+    
+    /* here we get the method pointer for callbacks */
+    const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
+    const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
+    if (desc) {
+      desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
+      if (!desc) return SWIG_ERROR;
+    }
+    if (ty) {
+      swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
+      if (tc) {
+        int newmemory = 0;
+        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+        assert(!newmemory); /* newmemory handling not yet implemented */
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      *ptr = vptr;
+    }
+    return SWIG_OK;
+  }
 }
 
 /* Convert a packed value value */
 
-SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject * obj, void *ptr, size_t sz, swig_type_info * ty)
-{
-	swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
-	if (!to)
-		return SWIG_ERROR;
-	if (ty) {
-		if (to != ty) {
-			/* check type cast? */
-			swig_cast_info *tc = SWIG_TypeCheck(to->name, ty);
-			if (!tc)
-				return SWIG_ERROR;
-		}
-	}
-	return SWIG_OK;
-}
+SWIGRUNTIME int
+SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
+  swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
+  if (!to) return SWIG_ERROR;
+  if (ty) {
+    if (to != ty) {
+      /* check type cast? */
+      swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
+      if (!tc) return SWIG_ERROR;
+    }
+  }
+  return SWIG_OK;
+}  
 
 /* -----------------------------------------------------------------------------
  * Create a new pointer object
@@ -2106,131 +2126,133 @@
   'this' attribute.
 */
 
-SWIGRUNTIME PyObject *SWIG_Python_NewShadowInstance(PySwigClientData * data, PyObject * swig_this)
+SWIGRUNTIME PyObject* 
+SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
 {
 #if (PY_VERSION_HEX >= 0x02020000)
-	PyObject *inst = 0;
-	PyObject *newraw = data->newraw;
-	if (newraw) {
-		inst = PyObject_Call(newraw, data->newargs, NULL);
-		if (inst) {
+  PyObject *inst = 0;
+  PyObject *newraw = data->newraw;
+  if (newraw) {
+    inst = PyObject_Call(newraw, data->newargs, NULL);
+    if (inst) {
 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
-			PyObject **dictptr = _PyObject_GetDictPtr(inst);
-			if (dictptr != NULL) {
-				PyObject *dict = *dictptr;
-				if (dict == NULL) {
-					dict = PyDict_New();
-					*dictptr = dict;
-					PyDict_SetItem(dict, SWIG_This(), swig_this);
-				}
-			}
+      PyObject **dictptr = _PyObject_GetDictPtr(inst);
+      if (dictptr != NULL) {
+	PyObject *dict = *dictptr;
+	if (dict == NULL) {
+	  dict = PyDict_New();
+	  *dictptr = dict;
+	  PyDict_SetItem(dict, SWIG_This(), swig_this);
+	}
+      }
 #else
-			PyObject *key = SWIG_This();
-			PyObject_SetAttr(inst, key, swig_this);
+      PyObject *key = SWIG_This();
+      PyObject_SetAttr(inst, key, swig_this);
 #endif
-		}
-	} else {
-		PyObject *dict = PyDict_New();
-		PyDict_SetItem(dict, SWIG_This(), swig_this);
-		inst = PyInstance_NewRaw(data->newargs, dict);
-		Py_DECREF(dict);
-	}
-	return inst;
+    }
+  } else {
+    PyObject *dict = PyDict_New();
+    PyDict_SetItem(dict, SWIG_This(), swig_this);
+    inst = PyInstance_NewRaw(data->newargs, dict);
+    Py_DECREF(dict);
+  }
+  return inst;
 #else
 #if (PY_VERSION_HEX >= 0x02010000)
-	PyObject *inst;
-	PyObject *dict = PyDict_New();
-	PyDict_SetItem(dict, SWIG_This(), swig_this);
-	inst = PyInstance_NewRaw(data->newargs, dict);
-	Py_DECREF(dict);
-	return (PyObject *) inst;
+  PyObject *inst;
+  PyObject *dict = PyDict_New();
+  PyDict_SetItem(dict, SWIG_This(), swig_this);
+  inst = PyInstance_NewRaw(data->newargs, dict);
+  Py_DECREF(dict);
+  return (PyObject *) inst;
 #else
-	PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
-	if (inst == NULL) {
-		return NULL;
-	}
-	inst->in_class = (PyClassObject *) data->newargs;
-	Py_INCREF(inst->in_class);
-	inst->in_dict = PyDict_New();
-	if (inst->in_dict == NULL) {
-		Py_DECREF(inst);
-		return NULL;
-	}
+  PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
+  if (inst == NULL) {
+    return NULL;
+  }
+  inst->in_class = (PyClassObject *)data->newargs;
+  Py_INCREF(inst->in_class);
+  inst->in_dict = PyDict_New();
+  if (inst->in_dict == NULL) {
+    Py_DECREF(inst);
+    return NULL;
+  }
 #ifdef Py_TPFLAGS_HAVE_WEAKREFS
-	inst->in_weakreflist = NULL;
+  inst->in_weakreflist = NULL;
 #endif
 #ifdef Py_TPFLAGS_GC
-	PyObject_GC_Init(inst);
+  PyObject_GC_Init(inst);
 #endif
-	PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
-	return (PyObject *) inst;
+  PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
+  return (PyObject *) inst;
 #endif
 #endif
 }
 
-SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject * inst, PyObject * swig_this)
+SWIGRUNTIME void
+SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
 {
-	PyObject *dict;
+ PyObject *dict;
 #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
-	PyObject **dictptr = _PyObject_GetDictPtr(inst);
-	if (dictptr != NULL) {
-		dict = *dictptr;
-		if (dict == NULL) {
-			dict = PyDict_New();
-			*dictptr = dict;
-		}
-		PyDict_SetItem(dict, SWIG_This(), swig_this);
-		return;
-	}
-#endif
-	dict = PyObject_GetAttrString(inst, (char *) "__dict__");
-	PyDict_SetItem(dict, SWIG_This(), swig_this);
-	Py_DECREF(dict);
-}
+ PyObject **dictptr = _PyObject_GetDictPtr(inst);
+ if (dictptr != NULL) {
+   dict = *dictptr;
+   if (dict == NULL) {
+     dict = PyDict_New();
+     *dictptr = dict;
+   }
+   PyDict_SetItem(dict, SWIG_This(), swig_this);
+   return;
+ }
+#endif
+ dict = PyObject_GetAttrString(inst, (char*)"__dict__");
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ Py_DECREF(dict);
+} 
 
 
-SWIGINTERN PyObject *SWIG_Python_InitShadowInstance(PyObject * args)
-{
-	PyObject *obj[2];
-	if (!SWIG_Python_UnpackTuple(args, (char *) "swiginit", 2, 2, obj)) {
-		return NULL;
-	} else {
-		PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
-		if (sthis) {
-			PySwigObject_append((PyObject *) sthis, obj[1]);
-		} else {
-			SWIG_Python_SetSwigThis(obj[0], obj[1]);
-		}
-		return SWIG_Py_Void();
-	}
+SWIGINTERN PyObject *
+SWIG_Python_InitShadowInstance(PyObject *args) {
+  PyObject *obj[2];
+  if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
+    return NULL;
+  } else {
+    PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
+    if (sthis) {
+      PySwigObject_append((PyObject*) sthis, obj[1]);
+    } else {
+      SWIG_Python_SetSwigThis(obj[0], obj[1]);
+    }
+    return SWIG_Py_Void();
+  }
 }
 
 /* Create a new pointer object */
 
-SWIGRUNTIME PyObject *SWIG_Python_NewPointerObj(void *ptr, swig_type_info * type, int flags)
-{
-	if (!ptr) {
-		return SWIG_Py_Void();
-	} else {
-		int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
-		PyObject *robj = PySwigObject_New(ptr, type, own);
-		PySwigClientData *clientdata = type ? (PySwigClientData *) (type->clientdata) : 0;
-		if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
-			PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
-			if (inst) {
-				Py_DECREF(robj);
-				robj = inst;
-			}
-		}
-		return robj;
-	}
+SWIGRUNTIME PyObject *
+SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
+  if (!ptr) {
+    return SWIG_Py_Void();
+  } else {
+    int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
+    PyObject *robj = PySwigObject_New(ptr, type, own);
+    PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
+    if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
+      PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
+      if (inst) {
+	Py_DECREF(robj);
+	robj = inst;
+      }
+    }
+    return robj;
+  }
 }
 
 /* Create a new packed object */
 
-SWIGRUNTIMEINLINE PyObject *SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info * type)
-{
-	return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
+SWIGRUNTIMEINLINE PyObject *
+SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
+  return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
 }
 
 /* -----------------------------------------------------------------------------*
@@ -2241,108 +2263,114 @@
 void *SWIG_ReturnGlobalTypeList(void *);
 #endif
 
-SWIGRUNTIME swig_module_info *SWIG_Python_GetModule(void)
-{
-	static void *type_pointer = (void *) 0;
-	/* first check if module already created */
-	if (!type_pointer) {
+SWIGRUNTIME swig_module_info *
+SWIG_Python_GetModule(void) {
+  static void *type_pointer = (void *)0;
+  /* first check if module already created */
+  if (!type_pointer) {
 #ifdef SWIG_LINK_RUNTIME
-		type_pointer = SWIG_ReturnGlobalTypeList((void *) 0);
+    type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
 #else
-		type_pointer = PyCObject_Import((char *) "swig_runtime_data" SWIG_RUNTIME_VERSION, (char *) "type_pointer" SWIG_TYPE_TABLE_NAME);
-		if (PyErr_Occurred()) {
-			PyErr_Clear();
-			type_pointer = (void *) 0;
-		}
+    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
+				    (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
+    if (PyErr_Occurred()) {
+      PyErr_Clear();
+      type_pointer = (void *)0;
+    }
 #endif
-	}
-	return (swig_module_info *) type_pointer;
+  }
+  return (swig_module_info *) type_pointer;
 }
 
 #if PY_MAJOR_VERSION < 2
 /* PyModule_AddObject function was introduced in Python 2.0.  The following function
    is copied out of Python/modsupport.c in python version 2.3.4 */
-SWIGINTERN int PyModule_AddObject(PyObject * m, char *name, PyObject * o)
+SWIGINTERN int
+PyModule_AddObject(PyObject *m, char *name, PyObject *o)
 {
-	PyObject *dict;
-	if (!PyModule_Check(m)) {
-		PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg");
-		return SWIG_ERROR;
-	}
-	if (!o) {
-		PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value");
-		return SWIG_ERROR;
-	}
-
-	dict = PyModule_GetDict(m);
-	if (dict == NULL) {
-		/* Internal error -- modules must have a dict! */
-		PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m));
-		return SWIG_ERROR;
-	}
-	if (PyDict_SetItemString(dict, name, o))
-		return SWIG_ERROR;
-	Py_DECREF(o);
-	return SWIG_OK;
+  PyObject *dict;
+  if (!PyModule_Check(m)) {
+    PyErr_SetString(PyExc_TypeError,
+		    "PyModule_AddObject() needs module as first arg");
+    return SWIG_ERROR;
+  }
+  if (!o) {
+    PyErr_SetString(PyExc_TypeError,
+		    "PyModule_AddObject() needs non-NULL value");
+    return SWIG_ERROR;
+  }
+  
+  dict = PyModule_GetDict(m);
+  if (dict == NULL) {
+    /* Internal error -- modules must have a dict! */
+    PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
+		 PyModule_GetName(m));
+    return SWIG_ERROR;
+  }
+  if (PyDict_SetItemString(dict, name, o))
+    return SWIG_ERROR;
+  Py_DECREF(o);
+  return SWIG_OK;
 }
 #endif
 
-SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr)
-{
-	swig_module_info *swig_module = (swig_module_info *) vptr;
-	swig_type_info **types = swig_module->types;
-	size_t i;
-	for (i = 0; i < swig_module->size; ++i) {
-		swig_type_info *ty = types[i];
-		if (ty->owndata) {
-			PySwigClientData *data = (PySwigClientData *) ty->clientdata;
-			if (data)
-				PySwigClientData_Del(data);
-		}
-	}
-	Py_DECREF(SWIG_This());
+SWIGRUNTIME void
+SWIG_Python_DestroyModule(void *vptr)
+{
+  swig_module_info *swig_module = (swig_module_info *) vptr;
+  swig_type_info **types = swig_module->types;
+  size_t i;
+  for (i =0; i < swig_module->size; ++i) {
+    swig_type_info *ty = types[i];
+    if (ty->owndata) {
+      PySwigClientData *data = (PySwigClientData *) ty->clientdata;
+      if (data) PySwigClientData_Del(data);
+    }
+  }
+  Py_DECREF(SWIG_This());
 }
 
-SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info * swig_module)
-{
-	static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };	/* Sentinel */
-
-	PyObject *module = Py_InitModule((char *) "swig_runtime_data" SWIG_RUNTIME_VERSION,
-									 swig_empty_runtime_method_table);
-	PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
-	if (pointer && module) {
-		PyModule_AddObject(module, (char *) "type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
-	} else {
-		Py_XDECREF(pointer);
-	}
+SWIGRUNTIME void
+SWIG_Python_SetModule(swig_module_info *swig_module) {
+  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
+
+  PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
+				   swig_empty_runtime_method_table);
+  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
+  if (pointer && module) {
+    PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
+  } else {
+    Py_XDECREF(pointer);
+  }
 }
 
 /* The python cached type query */
-SWIGRUNTIME PyObject *SWIG_Python_TypeCache(void)
-{
-	static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
-	return cache;
-}
-
-SWIGRUNTIME swig_type_info *SWIG_Python_TypeQuery(const char *type)
-{
-	PyObject *cache = SWIG_Python_TypeCache();
-	PyObject *key = PyString_FromString(type);
-	PyObject *obj = PyDict_GetItem(cache, key);
-	swig_type_info *descriptor;
-	if (obj) {
-		descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
-	} else {
-		swig_module_info *swig_module = SWIG_Python_GetModule();
-		descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
-		if (descriptor) {
-			obj = PyCObject_FromVoidPtr(descriptor, NULL);
-			PyDict_SetItem(cache, key, obj);
-			Py_DECREF(obj);
-		}
-	}
-	Py_DECREF(key);
-	return descriptor;
+SWIGRUNTIME PyObject *
+SWIG_Python_TypeCache(void) {
+  static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
+  return cache;
+}
+
+SWIGRUNTIME swig_type_info *
+SWIG_Python_TypeQuery(const char *type)
+{
+  PyObject *cache = SWIG_Python_TypeCache();
+  PyObject *key = PyString_FromString(type); 
+  PyObject *obj = PyDict_GetItem(cache, key);
+  swig_type_info *descriptor;
+  if (obj) {
+    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
+  } else {
+    swig_module_info *swig_module = SWIG_Python_GetModule();
+    descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
+    if (descriptor) {
+      obj = PyCObject_FromVoidPtr(descriptor, NULL);
+      PyDict_SetItem(cache, key, obj);
+      Py_DECREF(obj);
+    }
+  }
+  Py_DECREF(key);
+  return descriptor;
 }
 
 /* 
@@ -2352,109 +2380,116 @@
 #define SWIG_arg_fail(arg)      SWIG_Python_ArgFail(arg)
 #define SWIG_MustGetPtr(p, type, argnum, flags)  SWIG_Python_MustGetPtr(p, type, argnum, flags)
 
-SWIGRUNTIME int SWIG_Python_AddErrMesg(const char *mesg, int infront)
+SWIGRUNTIME int
+SWIG_Python_AddErrMesg(const char* mesg, int infront)
 {
-	if (PyErr_Occurred()) {
-		PyObject *type = 0;
-		PyObject *value = 0;
-		PyObject *traceback = 0;
-		PyErr_Fetch(&type, &value, &traceback);
-		if (value) {
-			PyObject *old_str = PyObject_Str(value);
-			Py_XINCREF(type);
-			PyErr_Clear();
-			if (infront) {
-				PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
-			} else {
-				PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
-			}
-			Py_DECREF(old_str);
-		}
-		return 1;
-	} else {
-		return 0;
-	}
+  if (PyErr_Occurred()) {
+    PyObject *type = 0;
+    PyObject *value = 0;
+    PyObject *traceback = 0;
+    PyErr_Fetch(&type, &value, &traceback);
+    if (value) {
+      PyObject *old_str = PyObject_Str(value);
+      Py_XINCREF(type);
+      PyErr_Clear();
+      if (infront) {
+	PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
+      } else {
+	PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
+      }
+      Py_DECREF(old_str);
+    }
+    return 1;
+  } else {
+    return 0;
+  }
 }
-
-SWIGRUNTIME int SWIG_Python_ArgFail(int argnum)
+  
+SWIGRUNTIME int
+SWIG_Python_ArgFail(int argnum)
 {
-	if (PyErr_Occurred()) {
-		/* add information about failing argument */
-		char mesg[256];
-		PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
-		return SWIG_Python_AddErrMesg(mesg, 1);
-	} else {
-		return 0;
-	}
+  if (PyErr_Occurred()) {
+    /* add information about failing argument */
+    char mesg[256];
+    PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
+    return SWIG_Python_AddErrMesg(mesg, 1);
+  } else {
+    return 0;
+  }
 }
 
-SWIGRUNTIMEINLINE const char *PySwigObject_GetDesc(PyObject * self)
+SWIGRUNTIMEINLINE const char *
+PySwigObject_GetDesc(PyObject *self)
 {
-	PySwigObject *v = (PySwigObject *) self;
-	swig_type_info *ty = v ? v->ty : 0;
-	return ty ? ty->str : (char *) "";
+  PySwigObject *v = (PySwigObject *)self;
+  swig_type_info *ty = v ? v->ty : 0;
+  return ty ? ty->str : (char*)"";
 }
 
-SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject * obj)
+SWIGRUNTIME void
+SWIG_Python_TypeError(const char *type, PyObject *obj)
 {
-	if (type) {
+  if (type) {
 #if defined(SWIG_COBJECT_TYPES)
-		if (obj && PySwigObject_Check(obj)) {
-			const char *otype = (const char *) PySwigObject_GetDesc(obj);
-			if (otype) {
-				PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received", type, otype);
-				return;
-			}
-		} else
-#endif
-		{
-			const char *otype = (obj ? obj->ob_type->tp_name : 0);
-			if (otype) {
-				PyObject *str = PyObject_Str(obj);
-				const char *cstr = str ? PyString_AsString(str) : 0;
-				if (cstr) {
-					PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr);
-				} else {
-					PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype);
-				}
-				Py_XDECREF(str);
-				return;
-			}
-		}
-		PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
+    if (obj && PySwigObject_Check(obj)) {
+      const char *otype = (const char *) PySwigObject_GetDesc(obj);
+      if (otype) {
+	PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
+		     type, otype);
+	return;
+      }
+    } else 
+#endif      
+    {
+      const char *otype = (obj ? obj->ob_type->tp_name : 0); 
+      if (otype) {
+	PyObject *str = PyObject_Str(obj);
+	const char *cstr = str ? PyString_AsString(str) : 0;
+	if (cstr) {
+	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
+		       type, otype, cstr);
 	} else {
-		PyErr_Format(PyExc_TypeError, "unexpected type is received");
+	  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
+		       type, otype);
 	}
+	Py_XDECREF(str);
+	return;
+      }
+    }   
+    PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
+  } else {
+    PyErr_Format(PyExc_TypeError, "unexpected type is received");
+  }
 }
 
 
 /* Convert a pointer value, signal an exception on a type mismatch */
-SWIGRUNTIME void *SWIG_Python_MustGetPtr(PyObject * obj, swig_type_info * ty, int argnum, int flags)
-{
-	void *result;
-	if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
-		PyErr_Clear();
-		if (flags & SWIG_POINTER_EXCEPTION) {
-			SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
-			SWIG_Python_ArgFail(argnum);
-		}
-	}
-	return result;
+SWIGRUNTIME void *
+SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
+  void *result;
+  if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
+    PyErr_Clear();
+    if (flags & SWIG_POINTER_EXCEPTION) {
+      SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
+      SWIG_Python_ArgFail(argnum);
+    }
+  }
+  return result;
 }
 
 
 #ifdef __cplusplus
 #if 0
-{								/* cc-mode */
+{ /* cc-mode */
 #endif
 }
 #endif
 
 
 
-#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
 
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
 
 
 
@@ -2462,27 +2497,31 @@
 
 #define SWIGTYPE_p_API swig_types[0]
 #define SWIGTYPE_p_CoreSession swig_types[1]
-#define SWIGTYPE_p_Event swig_types[2]
-#define SWIGTYPE_p_IVRMenu swig_types[3]
-#define SWIGTYPE_p_PySession swig_types[4]
-#define SWIGTYPE_p_Stream swig_types[5]
-#define SWIGTYPE_p_char swig_types[6]
-#define SWIGTYPE_p_input_callback_state swig_types[7]
-#define SWIGTYPE_p_session_flag_t swig_types[8]
-#define SWIGTYPE_p_swap_state_t swig_types[9]
-#define SWIGTYPE_p_switch_channel_state_t swig_types[10]
-#define SWIGTYPE_p_switch_channel_t swig_types[11]
-#define SWIGTYPE_p_switch_core_session_t swig_types[12]
-#define SWIGTYPE_p_switch_event_t swig_types[13]
-#define SWIGTYPE_p_switch_input_args_t swig_types[14]
-#define SWIGTYPE_p_switch_input_type_t swig_types[15]
-#define SWIGTYPE_p_switch_priority_t swig_types[16]
-#define SWIGTYPE_p_switch_status_t swig_types[17]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[18]
-#define SWIGTYPE_p_void swig_types[19]
-static swig_type_info *swig_types[21];
-static swig_module_info swig_module = { swig_types, 20, 0, 0, 0, 0 };
-
+#define SWIGTYPE_p_DTMF swig_types[2]
+#define SWIGTYPE_p_Event swig_types[3]
+#define SWIGTYPE_p_EventConsumer swig_types[4]
+#define SWIGTYPE_p_IVRMenu swig_types[5]
+#define SWIGTYPE_p_PYTHON__Session swig_types[6]
+#define SWIGTYPE_p_Stream swig_types[7]
+#define SWIGTYPE_p_char swig_types[8]
+#define SWIGTYPE_p_input_callback_state swig_types[9]
+#define SWIGTYPE_p_session_flag_t swig_types[10]
+#define SWIGTYPE_p_switch_channel_state_t swig_types[11]
+#define SWIGTYPE_p_switch_channel_t swig_types[12]
+#define SWIGTYPE_p_switch_core_session_t swig_types[13]
+#define SWIGTYPE_p_switch_event_node_t swig_types[14]
+#define SWIGTYPE_p_switch_event_t swig_types[15]
+#define SWIGTYPE_p_switch_event_types_t swig_types[16]
+#define SWIGTYPE_p_switch_input_args_t swig_types[17]
+#define SWIGTYPE_p_switch_input_type_t swig_types[18]
+#define SWIGTYPE_p_switch_priority_t swig_types[19]
+#define SWIGTYPE_p_switch_queue_t swig_types[20]
+#define SWIGTYPE_p_switch_status_t swig_types[21]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[22]
+#define SWIGTYPE_p_uint32_t swig_types[23]
+#define SWIGTYPE_p_void swig_types[24]
+static swig_type_info *swig_types[26];
+static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -2501,59 +2540,76 @@
 
 #define SWIG_name    "_freeswitch"
 
-#define SWIGVERSION 0x010335
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
-#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
-#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
 
 
 #include <stdexcept>
 
 
 namespace swig {
-	class PyObject_ptr {
-	  protected:
-		PyObject * _obj;
-
-	  public:
-		PyObject_ptr():_obj(0) {
-		} PyObject_ptr(const PyObject_ptr & item):_obj(item._obj) {
-			Py_XINCREF(_obj);
-	  } PyObject_ptr(PyObject * obj, bool initial_ref = true):_obj(obj) {
-			if (initial_ref) {
-				Py_XINCREF(_obj);
-			}
-		}
+  class PyObject_ptr {
+  protected:
+    PyObject *_obj;
 
-		PyObject_ptr & operator=(const PyObject_ptr & item) {
-			Py_XINCREF(item._obj);
-			Py_XDECREF(_obj);
-			_obj = item._obj;
-			return *this;
-		}
+  public:
+    PyObject_ptr() :_obj(0)
+    {
+    }
 
-		~PyObject_ptr() {
-			Py_XDECREF(_obj);
-		}
+    PyObject_ptr(const PyObject_ptr& item) : _obj(item._obj)
+    {
+      Py_XINCREF(_obj);      
+    }
+    
+    PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
+    {
+      if (initial_ref) {
+        Py_XINCREF(_obj);
+      }
+    }
+    
+    PyObject_ptr & operator=(const PyObject_ptr& item) 
+    {
+      Py_XINCREF(item._obj);
+      Py_XDECREF(_obj);
+      _obj = item._obj;
+      return *this;      
+    }
+    
+    ~PyObject_ptr() 
+    {
+      Py_XDECREF(_obj);
+    }
+    
+    operator PyObject *() const
+    {
+      return _obj;
+    }
 
-		operator  PyObject *() const {
-			return _obj;
-		} PyObject *operator->() const {
-			return _obj;
-	}};
+    PyObject *operator->() const
+    {
+      return _obj;
+    }
+  };
 }
 
 
 namespace swig {
-	struct PyObject_var:PyObject_ptr {
-	  PyObject_var(PyObject * obj = 0):PyObject_ptr(obj, false) {
-		} PyObject_var & operator =(PyObject * obj) {
-			Py_XDECREF(_obj);
-			_obj = obj;
-			return *this;
-	}};
+  struct PyObject_var : PyObject_ptr {
+    PyObject_var(PyObject* obj = 0) : PyObject_ptr(obj, false) { }
+    
+    PyObject_var & operator = (PyObject* obj)
+    {
+      Py_XDECREF(_obj);
+      _obj = obj;
+      return *this;      
+    }
+  };
 }
 
 
@@ -2561,70 +2617,68 @@
 #include "freeswitch_python.h"
 
 
-SWIGINTERN swig_type_info *SWIG_pchar_descriptor(void)
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
 {
-	static int init = 0;
-	static swig_type_info *info = 0;
-	if (!init) {
-		info = SWIG_TypeQuery("_p_char");
-		init = 1;
-	}
-	return info;
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
 }
 
 
-SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject * obj, char **cptr, size_t *psize, int *alloc)
-{
-	if (PyString_Check(obj)) {
-		char *cstr;
-		Py_ssize_t len;
-		PyString_AsStringAndSize(obj, &cstr, &len);
-		if (cptr) {
-			if (alloc) {
-				/* 
-				   In python the user should not be able to modify the inner
-				   string representation. To warranty that, if you define
-				   SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
-				   buffer is always returned.
-
-				   The default behavior is just to return the pointer value,
-				   so, be careful.
-				 */
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (PyString_Check(obj)) {
+    char *cstr; Py_ssize_t len;
+    PyString_AsStringAndSize(obj, &cstr, &len);
+    if (cptr)  {
+      if (alloc) {
+	/* 
+	   In python the user should not be able to modify the inner
+	   string representation. To warranty that, if you define
+	   SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
+	   buffer is always returned.
+
+	   The default behavior is just to return the pointer value,
+	   so, be careful.
+	*/ 
 #if defined(SWIG_PYTHON_SAFE_CSTRINGS)
-				if (*alloc != SWIG_OLDOBJ)
+	if (*alloc != SWIG_OLDOBJ) 
 #else
-				if (*alloc == SWIG_NEWOBJ)
+	if (*alloc == SWIG_NEWOBJ) 
 #endif
-				{
-					*cptr = reinterpret_cast < char *>(memcpy((new char[len + 1]), cstr, sizeof(char) * (len + 1)));
-					*alloc = SWIG_NEWOBJ;
-				} else {
-					*cptr = cstr;
-					*alloc = SWIG_OLDOBJ;
-				}
-			} else {
-				*cptr = PyString_AsString(obj);
-			}
-		}
-		if (psize)
-			*psize = len + 1;
-		return SWIG_OK;
-	} else {
-		swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
-		if (pchar_descriptor) {
-			void *vptr = 0;
-			if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
-				if (cptr)
-					*cptr = (char *) vptr;
-				if (psize)
-					*psize = vptr ? (strlen((char *) vptr) + 1) : 0;
-				if (alloc)
-					*alloc = SWIG_OLDOBJ;
-				return SWIG_OK;
-			}
-		}
+	  {
+	    *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1)));
+	    *alloc = SWIG_NEWOBJ;
+	  }
+	else {
+	  *cptr = cstr;
+	  *alloc = SWIG_OLDOBJ;
 	}
-	return SWIG_TypeError;
+      } else {
+	*cptr = PyString_AsString(obj);
+      }
+    }
+    if (psize) *psize = len + 1;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      void* vptr = 0;
+      if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
+	if (cptr) *cptr = (char *) vptr;
+	if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
+	if (alloc) *alloc = SWIG_OLDOBJ;
+	return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
 }
 
 
@@ -2641,51 +2695,47 @@
 #endif
 
 
-SWIGINTERN int SWIG_AsVal_double(PyObject * obj, double *val)
+SWIGINTERN int
+SWIG_AsVal_double (PyObject *obj, double *val)
 {
-	int res = SWIG_TypeError;
-	if (PyFloat_Check(obj)) {
-		if (val)
-			*val = PyFloat_AsDouble(obj);
-		return SWIG_OK;
-	} else if (PyInt_Check(obj)) {
-		if (val)
-			*val = PyInt_AsLong(obj);
-		return SWIG_OK;
-	} else if (PyLong_Check(obj)) {
-		double v = PyLong_AsDouble(obj);
-		if (!PyErr_Occurred()) {
-			if (val)
-				*val = v;
-			return SWIG_OK;
-		} else {
-			PyErr_Clear();
-		}
-	}
+  int res = SWIG_TypeError;
+  if (PyFloat_Check(obj)) {
+    if (val) *val = PyFloat_AsDouble(obj);
+    return SWIG_OK;
+  } else if (PyInt_Check(obj)) {
+    if (val) *val = PyInt_AsLong(obj);
+    return SWIG_OK;
+  } else if (PyLong_Check(obj)) {
+    double v = PyLong_AsDouble(obj);
+    if (!PyErr_Occurred()) {
+      if (val) *val = v;
+      return SWIG_OK;
+    } else {
+      PyErr_Clear();
+    }
+  }
 #ifdef SWIG_PYTHON_CAST_MODE
-	{
-		int dispatch = 0;
-		double d = PyFloat_AsDouble(obj);
-		if (!PyErr_Occurred()) {
-			if (val)
-				*val = d;
-			return SWIG_AddCast(SWIG_OK);
-		} else {
-			PyErr_Clear();
-		}
-		if (!dispatch) {
-			long v = PyLong_AsLong(obj);
-			if (!PyErr_Occurred()) {
-				if (val)
-					*val = v;
-				return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
-			} else {
-				PyErr_Clear();
-			}
-		}
-	}
+  {
+    int dispatch = 0;
+    double d = PyFloat_AsDouble(obj);
+    if (!PyErr_Occurred()) {
+      if (val) *val = d;
+      return SWIG_AddCast(SWIG_OK);
+    } else {
+      PyErr_Clear();
+    }
+    if (!dispatch) {
+      long v = PyLong_AsLong(obj);
+      if (!PyErr_Occurred()) {
+	if (val) *val = v;
+	return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
+      } else {
+	PyErr_Clear();
+      }
+    }
+  }
 #endif
-	return res;
+  return res;
 }
 
 
@@ -2695,5461 +2745,6903 @@
 #include <math.h>
 
 
-SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max)
-{
-	double x = *d;
-	if ((min <= x && x <= max)) {
-		double fx = floor(x);
-		double cx = ceil(x);
-		double rd = ((x - fx) < 0.5) ? fx : cx;	/* simple rint */
-		if ((errno == EDOM) || (errno == ERANGE)) {
-			errno = 0;
-		} else {
-			double summ, reps, diff;
-			if (rd < x) {
-				diff = x - rd;
-			} else if (rd > x) {
-				diff = rd - x;
-			} else {
-				return 1;
-			}
-			summ = rd + x;
-			reps = diff / summ;
-			if (reps < 8 * DBL_EPSILON) {
-				*d = rd;
-				return 1;
-			}
-		}
-	}
-	return 0;
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
 }
 
 
-SWIGINTERN int SWIG_AsVal_long(PyObject * obj, long *val)
-{
-	if (PyInt_Check(obj)) {
-		if (val)
-			*val = PyInt_AsLong(obj);
-		return SWIG_OK;
-	} else if (PyLong_Check(obj)) {
-		long v = PyLong_AsLong(obj);
-		if (!PyErr_Occurred()) {
-			if (val)
-				*val = v;
-			return SWIG_OK;
-		} else {
-			PyErr_Clear();
-		}
-	}
+SWIGINTERN int
+SWIG_AsVal_long (PyObject *obj, long* val)
+{
+  if (PyInt_Check(obj)) {
+    if (val) *val = PyInt_AsLong(obj);
+    return SWIG_OK;
+  } else if (PyLong_Check(obj)) {
+    long v = PyLong_AsLong(obj);
+    if (!PyErr_Occurred()) {
+      if (val) *val = v;
+      return SWIG_OK;
+    } else {
+      PyErr_Clear();
+    }
+  }
 #ifdef SWIG_PYTHON_CAST_MODE
-	{
-		int dispatch = 0;
-		long v = PyInt_AsLong(obj);
-		if (!PyErr_Occurred()) {
-			if (val)
-				*val = v;
-			return SWIG_AddCast(SWIG_OK);
-		} else {
-			PyErr_Clear();
-		}
-		if (!dispatch) {
-			double d;
-			int res = SWIG_AddCast(SWIG_AsVal_double(obj, &d));
-			if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
-				if (val)
-					*val = (long) (d);
-				return res;
-			}
-		}
-	}
+  {
+    int dispatch = 0;
+    long v = PyInt_AsLong(obj);
+    if (!PyErr_Occurred()) {
+      if (val) *val = v;
+      return SWIG_AddCast(SWIG_OK);
+    } else {
+      PyErr_Clear();
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+	if (val) *val = (long)(d);
+	return res;
+      }
+    }
+  }
 #endif
-	return SWIG_TypeError;
+  return SWIG_TypeError;
 }
 
 
-SWIGINTERN int SWIG_AsVal_int(PyObject * obj, int *val)
+SWIGINTERN int
+SWIG_AsVal_int (PyObject * obj, int *val)
 {
-	long v;
-	int res = SWIG_AsVal_long(obj, &v);
-	if (SWIG_IsOK(res)) {
-		if ((v < INT_MIN || v > INT_MAX)) {
-			return SWIG_OverflowError;
-		} else {
-			if (val)
-				*val = static_cast < int >(v);
-		}
-	}
-	return res;
+  long v;
+  int res = SWIG_AsVal_long (obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< int >(v);
+    }
+  }  
+  return res;
 }
 
 
-SWIGINTERNINLINE PyObject *SWIG_FromCharPtrAndSize(const char *carray, size_t size)
+SWIGINTERNINLINE PyObject *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
 {
-	if (carray) {
-		if (size > INT_MAX) {
-			swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
-			return pchar_descriptor ? SWIG_NewPointerObj(const_cast < char *>(carray), pchar_descriptor, 0) : SWIG_Py_Void();
-		} else {
-			return PyString_FromStringAndSize(carray, static_cast < int >(size));
-		}
-	} else {
-		return SWIG_Py_Void();
-	}
+  if (carray) {
+    if (size > INT_MAX) {
+      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+      return pchar_descriptor ? 
+	SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
+    } else {
+      return PyString_FromStringAndSize(carray, static_cast< int >(size));
+    }
+  } else {
+    return SWIG_Py_Void();
+  }
 }
 
 
-SWIGINTERNINLINE PyObject *SWIG_FromCharPtr(const char *cptr)
-{
-	return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+SWIGINTERNINLINE PyObject * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
 }
 
 
-#define SWIG_From_long   PyInt_FromLong
+  #define SWIG_From_long   PyInt_FromLong 
 
 
-SWIGINTERNINLINE PyObject *SWIG_From_int(int value)
-{
-	return SWIG_From_long(value);
+SWIGINTERNINLINE PyObject *
+SWIG_From_int  (int value)
+{    
+  return SWIG_From_long  (value);
+}
+
+
+SWIGINTERN int
+SWIG_AsCharArray(PyObject * obj, char *val, size_t size)
+{ 
+  char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ;
+  int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc);
+  if (SWIG_IsOK(res)) {
+    if ((csize == size + 1) && cptr && !(cptr[csize-1])) --csize;
+    if (csize <= size) {
+      if (val) {
+	if (csize) memcpy(val, cptr, csize*sizeof(char));
+	if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char));
+      }
+      if (alloc == SWIG_NEWOBJ) {
+	delete[] cptr;
+	res = SWIG_DelNewMask(res);
+      }      
+      return res;
+    }
+    if (alloc == SWIG_NEWOBJ) delete[] cptr;
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_char (PyObject * obj, char *val)
+{    
+  int res = SWIG_AsCharArray(obj, val, 1);
+  if (!SWIG_IsOK(res)) {
+    long v;
+    res = SWIG_AddCast(SWIG_AsVal_long (obj, &v));
+    if (SWIG_IsOK(res)) {
+      if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) {
+	if (val) *val = static_cast< char >(v);
+      } else {
+	res = SWIG_OverflowError;
+      }
+    }
+  }
+  return res;
+}
+
+
+SWIGINTERNINLINE PyObject *
+SWIG_From_char  (char c) 
+{ 
+  return SWIG_FromCharPtrAndSize(&c,1);
 }
 
 
-SWIGINTERNINLINE PyObject *SWIG_From_bool(bool value)
+SWIGINTERNINLINE PyObject*
+  SWIG_From_bool  (bool value)
 {
-	return PyBool_FromLong(value ? 1 : 0);
+  return PyBool_FromLong(value ? 1 : 0);
 }
 
 
-SWIGINTERN int SWIG_AsVal_unsigned_SS_long(PyObject * obj, unsigned long *val)
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) 
 {
-	if (PyInt_Check(obj)) {
-		long v = PyInt_AsLong(obj);
-		if (v >= 0) {
-			if (val)
-				*val = v;
-			return SWIG_OK;
-		} else {
-			return SWIG_OverflowError;
-		}
-	} else if (PyLong_Check(obj)) {
-		unsigned long v = PyLong_AsUnsignedLong(obj);
-		if (!PyErr_Occurred()) {
-			if (val)
-				*val = v;
-			return SWIG_OK;
-		} else {
-			PyErr_Clear();
-		}
-	}
+  if (PyInt_Check(obj)) {
+    long v = PyInt_AsLong(obj);
+    if (v >= 0) {
+      if (val) *val = v;
+      return SWIG_OK;
+    } else {
+      return SWIG_OverflowError;
+    }
+  } else if (PyLong_Check(obj)) {
+    unsigned long v = PyLong_AsUnsignedLong(obj);
+    if (!PyErr_Occurred()) {
+      if (val) *val = v;
+      return SWIG_OK;
+    } else {
+      PyErr_Clear();
+    }
+  }
 #ifdef SWIG_PYTHON_CAST_MODE
-	{
-		int dispatch = 0;
-		unsigned long v = PyLong_AsUnsignedLong(obj);
-		if (!PyErr_Occurred()) {
-			if (val)
-				*val = v;
-			return SWIG_AddCast(SWIG_OK);
-		} else {
-			PyErr_Clear();
-		}
-		if (!dispatch) {
-			double d;
-			int res = SWIG_AddCast(SWIG_AsVal_double(obj, &d));
-			if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
-				if (val)
-					*val = (unsigned long) (d);
-				return res;
-			}
-		}
-	}
+  {
+    int dispatch = 0;
+    unsigned long v = PyLong_AsUnsignedLong(obj);
+    if (!PyErr_Occurred()) {
+      if (val) *val = v;
+      return SWIG_AddCast(SWIG_OK);
+    } else {
+      PyErr_Clear();
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
+	if (val) *val = (unsigned long)(d);
+	return res;
+      }
+    }
+  }
 #endif
-	return SWIG_TypeError;
+  return SWIG_TypeError;
 }
 
 
-SWIGINTERN int SWIG_AsVal_unsigned_SS_int(PyObject * obj, unsigned int *val)
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
 {
-	unsigned long v;
-	int res = SWIG_AsVal_unsigned_SS_long(obj, &v);
-	if (SWIG_IsOK(res)) {
-		if ((v > UINT_MAX)) {
-			return SWIG_OverflowError;
-		} else {
-			if (val)
-				*val = static_cast < unsigned int >(v);
-		}
-	}
-	return res;
+  unsigned long v;
+  int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v > UINT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< unsigned int >(v);
+    }
+  }  
+  return res;
 }
 
 
-SWIGINTERNINLINE PyObject *SWIG_From_unsigned_SS_long(unsigned long value)
+SWIGINTERNINLINE PyObject* 
+SWIG_From_unsigned_SS_long  (unsigned long value)
 {
-	return (value > LONG_MAX) ? PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast < long >(value));
+  return (value > LONG_MAX) ?
+    PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast< long >(value)); 
 }
 
 
-SWIGINTERNINLINE PyObject *SWIG_From_unsigned_SS_int(unsigned int value)
-{
-	return SWIG_From_unsigned_SS_long(value);
+SWIGINTERNINLINE PyObject *
+SWIG_From_unsigned_SS_int  (unsigned int value)
+{    
+  return SWIG_From_unsigned_SS_long  (value);
 }
 
 
-SWIGINTERN int SWIG_AsVal_bool(PyObject * obj, bool * val)
+SWIGINTERN int
+SWIG_AsVal_bool (PyObject *obj, bool *val)
 {
-	int r = PyObject_IsTrue(obj);
-	if (r == -1)
-		return SWIG_ERROR;
-	if (val)
-		*val = r ? true : false;
-	return SWIG_OK;
+  int r = PyObject_IsTrue(obj);
+  if (r == -1)
+    return SWIG_ERROR;
+  if (val) *val = r ? true : false;
+  return SWIG_OK;
 }
 
 #ifdef __cplusplus
 extern "C" {
 #endif
-	SWIGINTERN PyObject *_wrap_consoleLog(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		char *arg1 = (char *) 0;
-		char *arg2 = (char *) 0;
-		int res1;
-		char *buf1 = 0;
-		int alloc1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if       (!PyArg_ParseTuple(args, (char *) "OO:consoleLog", &obj0, &obj1))
-			         SWIG_fail;
-		         res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-		if       (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1" " of type '" "char *" "'");
-		}
-		arg1 = reinterpret_cast < char *>(buf1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		consoleLog(arg1, arg2);
-		resultobj = SWIG_Py_Void();
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
-
+SWIGINTERN PyObject *_wrap_consoleLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:consoleLog",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1"" of type '" "char *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  consoleLog(arg1,arg2);
+  resultobj = SWIG_Py_Void();
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_consoleCleanLog(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		char *arg1 = (char *) 0;
-		int res1;
-		char *buf1 = 0;
-		int alloc1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:consoleCleanLog", &obj0))
-			SWIG_fail;
-		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1" " of type '" "char *" "'");
-		}
-		arg1 = reinterpret_cast < char *>(buf1);
-		consoleCleanLog(arg1);
-		resultobj = SWIG_Py_Void();
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		return resultobj;
-	  fail:
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_consoleCleanLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:consoleCleanLog",&obj0)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1"" of type '" "char *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  consoleCleanLog(arg1);
+  resultobj = SWIG_Py_Void();
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  int arg9 ;
+  int arg10 ;
+  int arg11 ;
+  int arg12 ;
+  int arg13 ;
+  IVRMenu *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  int res5 ;
+  char *buf5 = 0 ;
+  int alloc5 = 0 ;
+  int res6 ;
+  char *buf6 = 0 ;
+  int alloc6 = 0 ;
+  int res7 ;
+  char *buf7 = 0 ;
+  int alloc7 = 0 ;
+  int res8 ;
+  char *buf8 = 0 ;
+  int alloc8 = 0 ;
+  int val9 ;
+  int ecode9 = 0 ;
+  int val10 ;
+  int ecode10 = 0 ;
+  int val11 ;
+  int ecode11 = 0 ;
+  int val12 ;
+  int ecode12 = 0 ;
+  int val13 ;
+  int ecode13 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
+  PyObject * obj8 = 0 ;
+  PyObject * obj9 = 0 ;
+  PyObject * obj10 = 0 ;
+  PyObject * obj11 = 0 ;
+  PyObject * obj12 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:new_IVRMenu",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); 
+  }
+  arg1 = reinterpret_cast< IVRMenu * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4"" of type '" "char const *""'");
+  }
+  arg4 = reinterpret_cast< char * >(buf4);
+  res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
+  if (!SWIG_IsOK(res5)) {
+    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5"" of type '" "char const *""'");
+  }
+  arg5 = reinterpret_cast< char * >(buf5);
+  res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
+  if (!SWIG_IsOK(res6)) {
+    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6"" of type '" "char const *""'");
+  }
+  arg6 = reinterpret_cast< char * >(buf6);
+  res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
+  if (!SWIG_IsOK(res7)) {
+    SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7"" of type '" "char const *""'");
+  }
+  arg7 = reinterpret_cast< char * >(buf7);
+  res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
+  if (!SWIG_IsOK(res8)) {
+    SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8"" of type '" "char const *""'");
+  }
+  arg8 = reinterpret_cast< char * >(buf8);
+  ecode9 = SWIG_AsVal_int(obj8, &val9);
+  if (!SWIG_IsOK(ecode9)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "int""'");
+  } 
+  arg9 = static_cast< int >(val9);
+  ecode10 = SWIG_AsVal_int(obj9, &val10);
+  if (!SWIG_IsOK(ecode10)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "int""'");
+  } 
+  arg10 = static_cast< int >(val10);
+  ecode11 = SWIG_AsVal_int(obj10, &val11);
+  if (!SWIG_IsOK(ecode11)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'");
+  } 
+  arg11 = static_cast< int >(val11);
+  ecode12 = SWIG_AsVal_int(obj11, &val12);
+  if (!SWIG_IsOK(ecode12)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12"" of type '" "int""'");
+  } 
+  arg12 = static_cast< int >(val12);
+  ecode13 = SWIG_AsVal_int(obj12, &val13);
+  if (!SWIG_IsOK(ecode13)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13"" of type '" "int""'");
+  } 
+  arg13 = static_cast< int >(val13);
+  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_POINTER_NEW |  0 );
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+  if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+  if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+  if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+  if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_delete_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_IVRMenu",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'"); 
+  }
+  arg1 = reinterpret_cast< IVRMenu * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		IVRMenu *arg1 = (IVRMenu *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *arg4 = (char *) 0;
-		char *arg5 = (char *) 0;
-		char *arg6 = (char *) 0;
-		char *arg7 = (char *) 0;
-		char *arg8 = (char *) 0;
-		int arg9;
-		int arg10;
-		int arg11;
-		int arg12;
-		int arg13;
-		IVRMenu *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		int res4;
-		char *buf4 = 0;
-		int alloc4 = 0;
-		int res5;
-		char *buf5 = 0;
-		int alloc5 = 0;
-		int res6;
-		char *buf6 = 0;
-		int alloc6 = 0;
-		int res7;
-		char *buf7 = 0;
-		int alloc7 = 0;
-		int res8;
-		char *buf8 = 0;
-		int alloc8 = 0;
-		int val9;
-		int ecode9 = 0;
-		int val10;
-		int ecode10 = 0;
-		int val11;
-		int ecode11 = 0;
-		int val12;
-		int ecode12 = 0;
-		int val13;
-		int ecode13 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-		PyObject *obj4 = 0;
-		PyObject *obj5 = 0;
-		PyObject *obj6 = 0;
-		PyObject *obj7 = 0;
-		PyObject *obj8 = 0;
-		PyObject *obj9 = 0;
-		PyObject *obj10 = 0;
-		PyObject *obj11 = 0;
-		PyObject *obj12 = 0;
-
-		if (!PyArg_ParseTuple
-			(args, (char *) "OOOOOOOOOOOOO:new_IVRMenu", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5, &obj6, &obj7, &obj8, &obj9, &obj10, &obj11, &obj12))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
-		}
-		arg1 = reinterpret_cast < IVRMenu * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3" " of type '" "char const *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-		if (!SWIG_IsOK(res4)) {
-			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4" " of type '" "char const *" "'");
-		}
-		arg4 = reinterpret_cast < char *>(buf4);
-		res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
-		if (!SWIG_IsOK(res5)) {
-			SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5" " of type '" "char const *" "'");
-		}
-		arg5 = reinterpret_cast < char *>(buf5);
-		res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
-		if (!SWIG_IsOK(res6)) {
-			SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6" " of type '" "char const *" "'");
-		}
-		arg6 = reinterpret_cast < char *>(buf6);
-		res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
-		if (!SWIG_IsOK(res7)) {
-			SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7" " of type '" "char const *" "'");
-		}
-		arg7 = reinterpret_cast < char *>(buf7);
-		res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
-		if (!SWIG_IsOK(res8)) {
-			SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8" " of type '" "char const *" "'");
-		}
-		arg8 = reinterpret_cast < char *>(buf8);
-		ecode9 = SWIG_AsVal_int(obj8, &val9);
-		if (!SWIG_IsOK(ecode9)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9" " of type '" "int" "'");
-		}
-		arg9 = static_cast < int >(val9);
-		ecode10 = SWIG_AsVal_int(obj9, &val10);
-		if (!SWIG_IsOK(ecode10)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10" " of type '" "int" "'");
-		}
-		arg10 = static_cast < int >(val10);
-		ecode11 = SWIG_AsVal_int(obj10, &val11);
-		if (!SWIG_IsOK(ecode11)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11" " of type '" "int" "'");
-		}
-		arg11 = static_cast < int >(val11);
-		ecode12 = SWIG_AsVal_int(obj11, &val12);
-		if (!SWIG_IsOK(ecode12)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12" " of type '" "int" "'");
-		}
-		arg12 = static_cast < int >(val12);
-		ecode13 = SWIG_AsVal_int(obj12, &val13);
-		if (!SWIG_IsOK(ecode13)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13" " of type '" "int" "'");
-		}
-		arg13 = static_cast < int >(val13);
-		result =
-			(IVRMenu *) new IVRMenu(arg1, (char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5, (char const *) arg6,
-									(char const *) arg7, (char const *) arg8, arg9, arg10, arg11, arg12, arg13);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_POINTER_NEW | 0);
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		if (alloc5 == SWIG_NEWOBJ)
-			delete[]buf5;
-		if (alloc6 == SWIG_NEWOBJ)
-			delete[]buf6;
-		if (alloc7 == SWIG_NEWOBJ)
-			delete[]buf7;
-		if (alloc8 == SWIG_NEWOBJ)
-			delete[]buf8;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		if (alloc5 == SWIG_NEWOBJ)
-			delete[]buf5;
-		if (alloc6 == SWIG_NEWOBJ)
-			delete[]buf6;
-		if (alloc7 == SWIG_NEWOBJ)
-			delete[]buf7;
-		if (alloc8 == SWIG_NEWOBJ)
-			delete[]buf8;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_IVRMenu_bindAction(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:IVRMenu_bindAction",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1"" of type '" "IVRMenu *""'"); 
+  }
+  arg1 = reinterpret_cast< IVRMenu * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4"" of type '" "char const *""'");
+  }
+  arg4 = reinterpret_cast< char * >(buf4);
+  (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_delete_IVRMenu(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		IVRMenu *arg1 = (IVRMenu *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:delete_IVRMenu", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
-		}
-		arg1 = reinterpret_cast < IVRMenu * >(argp1);
-		delete arg1;
 
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_IVRMenu_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:IVRMenu_execute",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1"" of type '" "IVRMenu *""'"); 
+  }
+  arg1 = reinterpret_cast< IVRMenu * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2"" of type '" "CoreSession *""'"); 
+  }
+  arg2 = reinterpret_cast< CoreSession * >(argp2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  (arg1)->execute(arg2,(char const *)arg3);
+  resultobj = SWIG_Py_Void();
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_IVRMenu_bindAction(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		IVRMenu *arg1 = (IVRMenu *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *arg4 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		int res4;
-		char *buf4 = 0;
-		int alloc4 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOOO:IVRMenu_bindAction", &obj0, &obj1, &obj2, &obj3))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1" " of type '" "IVRMenu *" "'");
-		}
-		arg1 = reinterpret_cast < IVRMenu * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3" " of type '" "char const *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-		if (!SWIG_IsOK(res4)) {
-			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4" " of type '" "char const *" "'");
-		}
-		arg4 = reinterpret_cast < char *>(buf4);
-		(arg1)->bindAction(arg2, (char const *) arg3, (char const *) arg4);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		return NULL;
-	}
+SWIGINTERN PyObject *IVRMenu_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_IVRMenu, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject *_wrap_new_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  API *result = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)":new_API")) SWIG_fail;
+  result = (API *)new API();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_IVRMenu_execute(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		IVRMenu *arg1 = (IVRMenu *) 0;
-		CoreSession *arg2 = (CoreSession *) 0;
-		char *arg3 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2 = 0;
-		int res2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:IVRMenu_execute", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1" " of type '" "IVRMenu *" "'");
-		}
-		arg1 = reinterpret_cast < IVRMenu * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2" " of type '" "CoreSession *" "'");
-		}
-		arg2 = reinterpret_cast < CoreSession * >(argp2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3" " of type '" "char const *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		(arg1)->execute(arg2, (char const *) arg3);
-		resultobj = SWIG_Py_Void();
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_delete_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  API *arg1 = (API *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_API",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1"" of type '" "API *""'"); 
+  }
+  arg1 = reinterpret_cast< API * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *IVRMenu_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *obj;
-		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
-			return NULL;
-		SWIG_TypeNewClientData(SWIGTYPE_p_IVRMenu, SWIG_NewClientData(obj));
-		return SWIG_Py_Void();
-	}
+SWIGINTERN PyObject *_wrap_API_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  API *arg1 = (API *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:API_execute",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1"" of type '" "API *""'"); 
+  }
+  arg1 = reinterpret_cast< API * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_new_API(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		API *result = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) ":new_API"))
-			SWIG_fail;
-		result = (API *) new API();
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_POINTER_NEW | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_API_executeString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  API *arg1 = (API *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:API_executeString",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1"" of type '" "API *""'"); 
+  }
+  arg1 = reinterpret_cast< API * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (char *)(arg1)->executeString((char const *)arg2);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_delete_API(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		API *arg1 = (API *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:delete_API", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_API, SWIG_POINTER_DISOWN | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1" " of type '" "API *" "'");
-		}
-		arg1 = reinterpret_cast < API * >(argp1);
-		delete arg1;
 
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *API_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_API, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject *_wrap_input_callback_state_t_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_function_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+  }
+  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2"" of type '" "void *""'"); 
+  }
+  if (arg1) (arg1)->function = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_API_execute(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		API *arg1 = (API *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:API_execute", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_API, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1" " of type '" "API *" "'");
-		}
-		arg1 = reinterpret_cast < API * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3" " of type '" "char const *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		result = (char *) (arg1)->execute((char const *) arg2, (char const *) arg3);
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_input_callback_state_t_function_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_function_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+  }
+  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+  result = (void *) ((arg1)->function);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_API_executeString(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		API *arg1 = (API *) 0;
-		char *arg2 = (char *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:API_executeString", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_API, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1" " of type '" "API *" "'");
-		}
-		arg1 = reinterpret_cast < API * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (char *) (arg1)->executeString((char const *) arg2);
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_threadState_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+  }
+  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_threadState_set" "', argument " "2"" of type '" "void *""'"); 
+  }
+  if (arg1) (arg1)->threadState = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *API_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *obj;
-		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
-			return NULL;
-		SWIG_TypeNewClientData(SWIGTYPE_p_API, SWIG_NewClientData(obj));
-		return SWIG_Py_Void();
-	}
+SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_threadState_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+  }
+  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+  result = (void *) ((arg1)->threadState);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_input_callback_state_t_function_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *arg2 = (void *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_function_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1),
-								"in method '" "input_callback_state_t_function_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-		}
-		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2" " of type '" "void *" "'");
-		}
-		if (arg1)
-			(arg1)->function = arg2;
 
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_extra_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+  }
+  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2"" of type '" "void *""'"); 
+  }
+  if (arg1) (arg1)->extra = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_input_callback_state_t_function_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_function_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1),
-								"in method '" "input_callback_state_t_function_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-		}
-		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-		result = (void *) ((arg1)->function);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_extra_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+  }
+  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+  result = (void *) ((arg1)->extra);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *arg2 = (void *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_threadState_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1),
-								"in method '" "input_callback_state_t_threadState_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-		}
-		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_threadState_set" "', argument " "2" " of type '" "void *" "'");
-		}
-		if (arg1)
-			(arg1)->threadState = arg2;
+SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_funcargs_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_set" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+  }
+  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (arg1->funcargs) delete[] arg1->funcargs;
+  if (arg2) {
+    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+    arg1->funcargs = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+  } else {
+    arg1->funcargs = 0;
+  }
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_funcargs_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_get" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+  }
+  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+  result = (char *) ((arg1)->funcargs);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_threadState_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1),
-								"in method '" "input_callback_state_t_threadState_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-		}
-		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-		result = (void *) ((arg1)->threadState);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_new_input_callback_state_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  input_callback_state_t *result = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)":new_input_callback_state_t")) SWIG_fail;
+  result = (input_callback_state_t *)new input_callback_state_t();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *arg2 = (void *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_extra_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1),
-								"in method '" "input_callback_state_t_extra_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-		}
-		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2" " of type '" "void *" "'");
-		}
-		if (arg1)
-			(arg1)->extra = arg2;
 
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_delete_input_callback_state_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_input_callback_state_t",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_input_callback_state_t" "', argument " "1"" of type '" "input_callback_state_t *""'"); 
+  }
+  arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_extra_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1),
-								"in method '" "input_callback_state_t_extra_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-		}
-		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-		result = (void *) ((arg1)->extra);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *input_callback_state_t_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject *_wrap_DTMF_digit_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  DTMF *arg1 = (DTMF *) 0 ;
+  char arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  char val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:DTMF_digit_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_digit_set" "', argument " "1"" of type '" "DTMF *""'"); 
+  }
+  arg1 = reinterpret_cast< DTMF * >(argp1);
+  ecode2 = SWIG_AsVal_char(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DTMF_digit_set" "', argument " "2"" of type '" "char""'");
+  } 
+  arg2 = static_cast< char >(val2);
+  if (arg1) (arg1)->digit = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		char *arg2 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_funcargs_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1),
-								"in method '" "input_callback_state_t_funcargs_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-		}
-		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		if (arg1->funcargs)
-			delete[]arg1->funcargs;
-		if (arg2) {
-			size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
-			arg1->funcargs = (char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
-		} else {
-			arg1->funcargs = 0;
-		}
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_DTMF_digit_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  DTMF *arg1 = (DTMF *) 0 ;
+  char result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DTMF_digit_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_digit_get" "', argument " "1"" of type '" "DTMF *""'"); 
+  }
+  arg1 = reinterpret_cast< DTMF * >(argp1);
+  result = (char) ((arg1)->digit);
+  resultobj = SWIG_From_char(static_cast< char >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_funcargs_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1),
-								"in method '" "input_callback_state_t_funcargs_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-		}
-		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-		result = (char *) ((arg1)->funcargs);
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_DTMF_duration_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:DTMF_duration_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_duration_set" "', argument " "1"" of type '" "DTMF *""'"); 
+  }
+  arg1 = reinterpret_cast< DTMF * >(argp1);
+  {
+    res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_uint32_t,  0  | 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DTMF_duration_set" "', argument " "2"" of type '" "uint32_t""'"); 
+    }  
+    if (!argp2) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DTMF_duration_set" "', argument " "2"" of type '" "uint32_t""'");
+    } else {
+      uint32_t * temp = reinterpret_cast< uint32_t * >(argp2);
+      arg2 = *temp;
+      if (SWIG_IsNewObj(res2)) delete temp;
+    }
+  }
+  if (arg1) (arg1)->duration = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_new_input_callback_state_t(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		input_callback_state_t *result = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) ":new_input_callback_state_t"))
-			SWIG_fail;
-		result = (input_callback_state_t *) new input_callback_state_t();
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_POINTER_NEW | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_DTMF_duration_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DTMF_duration_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_duration_get" "', argument " "1"" of type '" "DTMF *""'"); 
+  }
+  arg1 = reinterpret_cast< DTMF * >(argp1);
+  result =  ((arg1)->duration);
+  resultobj = SWIG_NewPointerObj((new uint32_t(static_cast< const uint32_t& >(result))), SWIGTYPE_p_uint32_t, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_delete_input_callback_state_t(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		input_callback_state_t *arg1 = (input_callback_state_t *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:delete_input_callback_state_t", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1),
-								"in method '" "delete_input_callback_state_t" "', argument " "1" " of type '" "input_callback_state_t *" "'");
-		}
-		arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
-		delete arg1;
+SWIGINTERN PyObject *_wrap_new_DTMF__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char arg1 ;
+  uint32_t arg2 ;
+  DTMF *result = 0 ;
+  char val1 ;
+  int ecode1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:new_DTMF",&obj0,&obj1)) SWIG_fail;
+  ecode1 = SWIG_AsVal_char(obj0, &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DTMF" "', argument " "1"" of type '" "char""'");
+  } 
+  arg1 = static_cast< char >(val1);
+  {
+    res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_uint32_t,  0  | 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_DTMF" "', argument " "2"" of type '" "uint32_t""'"); 
+    }  
+    if (!argp2) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DTMF" "', argument " "2"" of type '" "uint32_t""'");
+    } else {
+      uint32_t * temp = reinterpret_cast< uint32_t * >(argp2);
+      arg2 = *temp;
+      if (SWIG_IsNewObj(res2)) delete temp;
+    }
+  }
+  result = (DTMF *)new DTMF(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_new_DTMF__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char arg1 ;
+  DTMF *result = 0 ;
+  char val1 ;
+  int ecode1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_DTMF",&obj0)) SWIG_fail;
+  ecode1 = SWIG_AsVal_char(obj0, &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DTMF" "', argument " "1"" of type '" "char""'");
+  } 
+  arg1 = static_cast< char >(val1);
+  result = (DTMF *)new DTMF(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *input_callback_state_t_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *obj;
-		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
-			return NULL;
-		SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj));
-		return SWIG_Py_Void();
-	}
 
-	SWIGINTERN PyObject *_wrap_new_Stream__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Stream *result = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) ":new_Stream"))
-			SWIG_fail;
-		result = (Stream *) new Stream();
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_new_DTMF(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    {
+      int res = SWIG_AsVal_char(argv[0], NULL);
+      _v = SWIG_CheckState(res);
+    }
+    if (_v) {
+      return _wrap_new_DTMF__SWIG_1(self, args);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      int res = SWIG_AsVal_char(argv[0], NULL);
+      _v = SWIG_CheckState(res);
+    }
+    if (_v) {
+      int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_uint32_t, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_new_DTMF__SWIG_0(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_DTMF'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    DTMF(char,uint32_t)\n"
+    "    DTMF(char)\n");
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_new_Stream__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0;
-		Stream *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:new_Stream", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_stream_handle_t, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1" " of type '" "switch_stream_handle_t *" "'");
-		}
-		arg1 = reinterpret_cast < switch_stream_handle_t *>(argp1);
-		result = (Stream *) new Stream(arg1);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_delete_DTMF(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  DTMF *arg1 = (DTMF *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_DTMF",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DTMF" "', argument " "1"" of type '" "DTMF *""'"); 
+  }
+  arg1 = reinterpret_cast< DTMF * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_new_Stream(PyObject * self, PyObject * args) {
-		int argc;
-		PyObject *argv[2];
-		int ii;
-
-		if (!PyTuple_Check(args))
-			SWIG_fail;
-		argc = (int) PyObject_Length(args);
-		for (ii = 0; (ii < argc) && (ii < 1); ii++) {
-			argv[ii] = PyTuple_GET_ITEM(args, ii);
-		}
-		if (argc == 0) {
-			return _wrap_new_Stream__SWIG_0(self, args);
-		}
-		if (argc == 1) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				return _wrap_new_Stream__SWIG_1(self, args);
-			}
-		}
+SWIGINTERN PyObject *DTMF_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_DTMF, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
 
-	  fail:
-		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'new_Stream'.\n"
-						 "  Possible C/C++ prototypes are:\n" "    Stream()\n" "    Stream(switch_stream_handle_t *)\n");
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_new_Stream__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Stream *result = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)":new_Stream")) SWIG_fail;
+  result = (Stream *)new Stream();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_delete_Stream(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Stream *arg1 = (Stream *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:delete_Stream", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1" " of type '" "Stream *" "'");
-		}
-		arg1 = reinterpret_cast < Stream * >(argp1);
-		delete arg1;
+SWIGINTERN PyObject *_wrap_new_Stream__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
+  Stream *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_Stream",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_stream_handle_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1"" of type '" "switch_stream_handle_t *""'"); 
+  }
+  arg1 = reinterpret_cast< switch_stream_handle_t * >(argp1);
+  result = (Stream *)new Stream(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_new_Stream(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[2];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 0) {
+    return _wrap_new_Stream__SWIG_0(self, args);
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_new_Stream__SWIG_1(self, args);
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Stream'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    Stream()\n"
+    "    Stream(switch_stream_handle_t *)\n");
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_Stream_write(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Stream *arg1 = (Stream *) 0;
-		char *arg2 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:Stream_write", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Stream, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1" " of type '" "Stream *" "'");
-		}
-		arg1 = reinterpret_cast < Stream * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		(arg1)->write((char const *) arg2);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_delete_Stream(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Stream *arg1 = (Stream *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_Stream",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1"" of type '" "Stream *""'"); 
+  }
+  arg1 = reinterpret_cast< Stream * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_Stream_get_data(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Stream *arg1 = (Stream *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:Stream_get_data", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Stream, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1" " of type '" "Stream *" "'");
-		}
-		arg1 = reinterpret_cast < Stream * >(argp1);
-		result = (char *) (arg1)->get_data();
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Stream_write(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Stream *arg1 = (Stream *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Stream_write",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1"" of type '" "Stream *""'"); 
+  }
+  arg1 = reinterpret_cast< Stream * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  (arg1)->write((char const *)arg2);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *Stream_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *obj;
-		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
-			return NULL;
-		SWIG_TypeNewClientData(SWIGTYPE_p_Stream, SWIG_NewClientData(obj));
-		return SWIG_Py_Void();
-	}
 
-	SWIGINTERN PyObject *_wrap_Event_event_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		switch_event_t *arg2 = (switch_event_t *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2 = 0;
-		int res2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:Event_event_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN | 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2" " of type '" "switch_event_t *" "'");
-		}
-		arg2 = reinterpret_cast < switch_event_t *>(argp2);
-		if (arg1)
-			(arg1)->event = arg2;
-
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Stream_get_data(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Stream *arg1 = (Stream *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Stream_get_data",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1"" of type '" "Stream *""'"); 
+  }
+  arg1 = reinterpret_cast< Stream * >(argp1);
+  result = (char *)(arg1)->get_data();
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_event_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		switch_event_t *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:Event_event_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		result = (switch_event_t *) ((arg1)->event);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *Stream_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_Stream, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject *_wrap_Event_event_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  switch_event_t *arg2 = (switch_event_t *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Event_event_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2"" of type '" "switch_event_t *""'"); 
+  }
+  arg2 = reinterpret_cast< switch_event_t * >(argp2);
+  if (arg1) (arg1)->event = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_serialized_string_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:Event_serialized_string_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		if (arg1->serialized_string)
-			delete[]arg1->serialized_string;
-		if (arg2) {
-			size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
-			arg1->serialized_string =
-				(char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
-		} else {
-			arg1->serialized_string = 0;
-		}
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_event_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  switch_event_t *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Event_event_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  result = (switch_event_t *) ((arg1)->event);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_serialized_string_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:Event_serialized_string_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		result = (char *) ((arg1)->serialized_string);
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_serialized_string_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Event_serialized_string_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (arg1->serialized_string) delete[] arg1->serialized_string;
+  if (arg2) {
+    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+    arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+  } else {
+    arg1->serialized_string = 0;
+  }
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_mine_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		int arg2;
-		void *argp1 = 0;
-		int res1 = 0;
-		int val2;
-		int ecode2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:Event_mine_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		ecode2 = SWIG_AsVal_int(obj1, &val2);
-		if (!SWIG_IsOK(ecode2)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2" " of type '" "int" "'");
-		}
-		arg2 = static_cast < int >(val2);
-		if (arg1)
-			(arg1)->mine = arg2;
-
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_serialized_string_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Event_serialized_string_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  result = (char *) ((arg1)->serialized_string);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_mine_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:Event_mine_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		result = (int) ((arg1)->mine);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_mine_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  int arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Event_mine_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  if (arg1) (arg1)->mine = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_new_Event__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		char *arg1 = (char *) 0;
-		char *arg2 = (char *) 0;
-		Event *result = 0;
-		int res1;
-		char *buf1 = 0;
-		int alloc1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:new_Event", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
-		}
-		arg1 = reinterpret_cast < char *>(buf1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (Event *) new Event((char const *) arg1, (char const *) arg2);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_mine_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Event_mine_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  result = (int) ((arg1)->mine);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_new_Event__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		char *arg1 = (char *) 0;
-		Event *result = 0;
-		int res1;
-		char *buf1 = 0;
-		int alloc1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:new_Event", &obj0))
-			SWIG_fail;
-		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
-		}
-		arg1 = reinterpret_cast < char *>(buf1);
-		result = (Event *) new Event((char const *) arg1);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		return resultobj;
-	  fail:
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_new_Event__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  Event *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:new_Event",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (Event *)new Event((char const *)arg1,(char const *)arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW |  0 );
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_new_Event__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		switch_event_t *arg1 = (switch_event_t *) 0;
-		int arg2;
-		Event *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int val2;
-		int ecode2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:new_Event", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
-		}
-		arg1 = reinterpret_cast < switch_event_t *>(argp1);
-		ecode2 = SWIG_AsVal_int(obj1, &val2);
-		if (!SWIG_IsOK(ecode2)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2" " of type '" "int" "'");
-		}
-		arg2 = static_cast < int >(val2);
-		result = (Event *) new Event(arg1, arg2);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_new_Event__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  Event *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_Event",&obj0)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  result = (Event *)new Event((char const *)arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW |  0 );
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_new_Event__SWIG_3(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		switch_event_t *arg1 = (switch_event_t *) 0;
-		Event *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:new_Event", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
-		}
-		arg1 = reinterpret_cast < switch_event_t *>(argp1);
-		result = (Event *) new Event(arg1);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_new_Event__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  int arg2 ;
+  Event *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:new_Event",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_event_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'"); 
+  }
+  arg1 = reinterpret_cast< switch_event_t * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  result = (Event *)new Event(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_new_Event(PyObject * self, PyObject * args) {
-		int argc;
-		PyObject *argv[3];
-		int ii;
-
-		if (!PyTuple_Check(args))
-			SWIG_fail;
-		argc = (int) PyObject_Length(args);
-		for (ii = 0; (ii < argc) && (ii < 2); ii++) {
-			argv[ii] = PyTuple_GET_ITEM(args, ii);
-		}
-		if (argc == 1) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				return _wrap_new_Event__SWIG_3(self, args);
-			}
-		}
-		if (argc == 1) {
-			int _v;
-			int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				return _wrap_new_Event__SWIG_1(self, args);
-			}
-		}
-		if (argc == 2) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				{
-					int res = SWIG_AsVal_int(argv[1], NULL);
-					_v = SWIG_CheckState(res);
-				}
-				if (_v) {
-					return _wrap_new_Event__SWIG_2(self, args);
-				}
-			}
-		}
-		if (argc == 2) {
-			int _v;
-			int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					return _wrap_new_Event__SWIG_0(self, args);
-				}
-			}
-		}
+SWIGINTERN PyObject *_wrap_new_Event__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  Event *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_Event",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_event_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'"); 
+  }
+  arg1 = reinterpret_cast< switch_event_t * >(argp1);
+  result = (Event *)new Event(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	  fail:
-		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'new_Event'.\n"
-						 "  Possible C/C++ prototypes are:\n"
-						 "    Event(char const *,char const *)\n"
-						 "    Event(char const *)\n" "    Event(switch_event_t *,int)\n" "    Event(switch_event_t *)\n");
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_new_Event(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_new_Event__SWIG_3(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_new_Event__SWIG_1(self, args);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_new_Event__SWIG_2(self, args);
+      }
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_new_Event__SWIG_0(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Event'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    Event(char const *,char const *)\n"
+    "    Event(char const *)\n"
+    "    Event(switch_event_t *,int)\n"
+    "    Event(switch_event_t *)\n");
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_delete_Event(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:delete_Event", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, SWIG_POINTER_DISOWN | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		delete arg1;
 
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_delete_Event(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_Event",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:Event_serialize", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (char *) (arg1)->serialize((char const *) arg2);
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Event_serialize",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (char *)(arg1)->serialize((char const *)arg2);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:Event_serialize", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		result = (char *) (arg1)->serialize();
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Event_serialize",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  result = (char *)(arg1)->serialize();
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_serialize(PyObject * self, PyObject * args) {
-		int argc;
-		PyObject *argv[3];
-		int ii;
-
-		if (!PyTuple_Check(args))
-			SWIG_fail;
-		argc = (int) PyObject_Length(args);
-		for (ii = 0; (ii < argc) && (ii < 2); ii++) {
-			argv[ii] = PyTuple_GET_ITEM(args, ii);
-		}
-		if (argc == 1) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				return _wrap_Event_serialize__SWIG_1(self, args);
-			}
-		}
-		if (argc == 2) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					return _wrap_Event_serialize__SWIG_0(self, args);
-				}
-			}
-		}
+SWIGINTERN PyObject *_wrap_Event_serialize(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_Event_serialize__SWIG_1(self, args);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_Event_serialize__SWIG_0(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_serialize'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    serialize(Event *,char const *)\n"
+    "    serialize(Event *)\n");
+  return NULL;
+}
 
-	  fail:
-		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'Event_serialize'.\n"
-						 "  Possible C/C++ prototypes are:\n" "    serialize(Event *,char const *)\n" "    serialize(Event *)\n");
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  switch_priority_t arg2 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Event_setPriority",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  {
+    res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_priority_t,  0  | 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'"); 
+    }  
+    if (!argp2) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'");
+    } else {
+      switch_priority_t * temp = reinterpret_cast< switch_priority_t * >(argp2);
+      arg2 = *temp;
+      if (SWIG_IsNewObj(res2)) delete temp;
+    }
+  }
+  result = (bool)(arg1)->setPriority(arg2);
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		switch_priority_t arg2;
-		bool result;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2;
-		int res2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:Event_setPriority", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		{
-			res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_priority_t, 0 | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t" "'");
-			}
-			if (!argp2) {
-				SWIG_exception_fail(SWIG_ValueError,
-									"invalid null reference " "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t" "'");
-			} else {
-				switch_priority_t *temp = reinterpret_cast < switch_priority_t *>(argp2);
-				arg2 = *temp;
-				if (SWIG_IsNewObj(res2))
-					delete temp;
-			}
-		}
-		result = (bool) (arg1)->setPriority(arg2);
-		resultobj = SWIG_From_bool(static_cast < bool > (result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Event_setPriority",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  result = (bool)(arg1)->setPriority();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		bool result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:Event_setPriority", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		result = (bool) (arg1)->setPriority();
-		resultobj = SWIG_From_bool(static_cast < bool > (result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Event_setPriority(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_Event_setPriority__SWIG_1(self, args);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_switch_priority_t, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_Event_setPriority__SWIG_0(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_setPriority'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    setPriority(Event *,switch_priority_t)\n"
+    "    setPriority(Event *)\n");
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_Event_setPriority(PyObject * self, PyObject * args) {
-		int argc;
-		PyObject *argv[3];
-		int ii;
-
-		if (!PyTuple_Check(args))
-			SWIG_fail;
-		argc = (int) PyObject_Length(args);
-		for (ii = 0; (ii < argc) && (ii < 2); ii++) {
-			argv[ii] = PyTuple_GET_ITEM(args, ii);
-		}
-		if (argc == 1) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				return _wrap_Event_setPriority__SWIG_1(self, args);
-			}
-		}
-		if (argc == 2) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_switch_priority_t, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					return _wrap_Event_setPriority__SWIG_0(self, args);
-				}
-			}
-		}
 
-	  fail:
-		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'Event_setPriority'.\n"
-						 "  Possible C/C++ prototypes are:\n" "    setPriority(Event *,switch_priority_t)\n" "    setPriority(Event *)\n");
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_getHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Event_getHeader",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (char *)(arg1)->getHeader(arg2);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_getHeader(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:Event_getHeader", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (char *) (arg1)->getHeader(arg2);
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_getBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Event_getBody",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  result = (char *)(arg1)->getBody();
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_getBody(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:Event_getBody", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		result = (char *) (arg1)->getBody();
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_getType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Event_getType",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  result = (char *)(arg1)->getType();
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_getType(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:Event_getType", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		result = (char *) (arg1)->getType();
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_addBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Event_addBody",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (bool)(arg1)->addBody((char const *)arg2);
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_addBody(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-		bool result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:Event_addBody", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (bool) (arg1)->addBody((char const *) arg2);
-		resultobj = SWIG_From_bool(static_cast < bool > (result));
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_addHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:Event_addHeader",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_addHeader(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		bool result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:Event_addHeader", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3" " of type '" "char const *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		result = (bool) (arg1)->addHeader((char const *) arg2, (char const *) arg3);
-		resultobj = SWIG_From_bool(static_cast < bool > (result));
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_delHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Event_delHeader",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (bool)(arg1)->delHeader((char const *)arg2);
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_delHeader(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		char *arg2 = (char *) 0;
-		bool result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:Event_delHeader", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (bool) (arg1)->delHeader((char const *) arg2);
-		resultobj = SWIG_From_bool(static_cast < bool > (result));
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Event_fire(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  Event *arg1 = (Event *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Event_fire",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1"" of type '" "Event *""'"); 
+  }
+  arg1 = reinterpret_cast< Event * >(argp1);
+  result = (bool)(arg1)->fire();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_Event_fire(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		Event *arg1 = (Event *) 0;
-		bool result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:Event_fire", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1" " of type '" "Event *" "'");
-		}
-		arg1 = reinterpret_cast < Event * >(argp1);
-		result = (bool) (arg1)->fire();
-		resultobj = SWIG_From_bool(static_cast < bool > (result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *Event_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_Event, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject *_wrap_EventConsumer_events_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_queue_t *arg2 = (switch_queue_t *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_events_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_events_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_queue_t, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_events_set" "', argument " "2"" of type '" "switch_queue_t *""'"); 
+  }
+  arg2 = reinterpret_cast< switch_queue_t * >(argp2);
+  if (arg1) (arg1)->events = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *Event_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *obj;
-		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
-			return NULL;
-		SWIG_TypeNewClientData(SWIGTYPE_p_Event, SWIG_NewClientData(obj));
-		return SWIG_Py_Void();
-	}
+SWIGINTERN PyObject *_wrap_EventConsumer_events_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_queue_t *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_events_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_events_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  result = (switch_queue_t *) ((arg1)->events);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_queue_t, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_delete_CoreSession(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:delete_CoreSession", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		delete arg1;
 
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_EventConsumer_e_event_id_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_types_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_e_event_id_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_event_id_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  {
+    res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_event_types_t,  0  | 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_event_id_set" "', argument " "2"" of type '" "switch_event_types_t""'"); 
+    }  
+    if (!argp2) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EventConsumer_e_event_id_set" "', argument " "2"" of type '" "switch_event_types_t""'");
+    } else {
+      switch_event_types_t * temp = reinterpret_cast< switch_event_types_t * >(argp2);
+      arg2 = *temp;
+      if (SWIG_IsNewObj(res2)) delete temp;
+    }
+  }
+  if (arg1) (arg1)->e_event_id = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_session_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_core_session_t *arg2 = (switch_core_session_t *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2 = 0;
-		int res2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_session_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN | 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2),
-								"in method '" "CoreSession_session_set" "', argument " "2" " of type '" "switch_core_session_t *" "'");
-		}
-		arg2 = reinterpret_cast < switch_core_session_t *>(argp2);
-		if (arg1)
-			(arg1)->session = arg2;
-
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_EventConsumer_e_event_id_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_types_t result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_event_id_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_event_id_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  result =  ((arg1)->e_event_id);
+  resultobj = SWIG_NewPointerObj((new switch_event_types_t(static_cast< const switch_event_types_t& >(result))), SWIGTYPE_p_switch_event_types_t, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_session_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_core_session_t *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_session_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (switch_core_session_t *) ((arg1)->session);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_EventConsumer_node_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_node_t *arg2 = (switch_event_node_t *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_node_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_node_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_event_node_t, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_node_set" "', argument " "2"" of type '" "switch_event_node_t *""'"); 
+  }
+  arg2 = reinterpret_cast< switch_event_node_t * >(argp2);
+  if (arg1) (arg1)->node = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_channel_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_channel_t *arg2 = (switch_channel_t *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2 = 0;
-		int res2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_channel_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN | 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2" " of type '" "switch_channel_t *" "'");
-		}
-		arg2 = reinterpret_cast < switch_channel_t *>(argp2);
-		if (arg1)
-			(arg1)->channel = arg2;
-
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_EventConsumer_node_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_node_t *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_node_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_node_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  result = (switch_event_node_t *) ((arg1)->node);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_node_t, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_channel_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_channel_t *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_channel_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (switch_channel_t *) ((arg1)->channel);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_EventConsumer_e_callback_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_e_callback_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_callback_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_callback_set" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (arg1->e_callback) delete[] arg1->e_callback;
+  if (arg2) {
+    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+    arg1->e_callback = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+  } else {
+    arg1->e_callback = 0;
+  }
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_flags_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		unsigned int arg2;
-		void *argp1 = 0;
-		int res1 = 0;
-		unsigned int val2;
-		int ecode2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_flags_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
-		if (!SWIG_IsOK(ecode2)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2" " of type '" "unsigned int" "'");
-		}
-		arg2 = static_cast < unsigned int >(val2);
-		if (arg1)
-			(arg1)->flags = arg2;
-
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_EventConsumer_e_callback_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_callback_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_callback_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  result = (char *) ((arg1)->e_callback);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_flags_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		unsigned int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_flags_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (unsigned int) ((arg1)->flags);
-		resultobj = SWIG_From_unsigned_SS_int(static_cast < unsigned int >(result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_EventConsumer_e_subclass_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_e_subclass_name_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_subclass_name_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_subclass_name_set" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (arg1->e_subclass_name) delete[] arg1->e_subclass_name;
+  if (arg2) {
+    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+    arg1->e_subclass_name = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+  } else {
+    arg1->e_subclass_name = 0;
+  }
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_allocated_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int arg2;
-		void *argp1 = 0;
-		int res1 = 0;
-		int val2;
-		int ecode2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_allocated_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		ecode2 = SWIG_AsVal_int(obj1, &val2);
-		if (!SWIG_IsOK(ecode2)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2" " of type '" "int" "'");
-		}
-		arg2 = static_cast < int >(val2);
-		if (arg1)
-			(arg1)->allocated = arg2;
-
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_EventConsumer_e_subclass_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_subclass_name_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_subclass_name_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  result = (char *) ((arg1)->e_subclass_name);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_allocated_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_allocated_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (int) ((arg1)->allocated);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_EventConsumer_e_cb_arg_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_e_cb_arg_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_cb_arg_set" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_cb_arg_set" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (arg1->e_cb_arg) delete[] arg1->e_cb_arg;
+  if (arg2) {
+    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+    arg1->e_cb_arg = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+  } else {
+    arg1->e_cb_arg = 0;
+  }
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_cb_state_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		input_callback_state *arg2 = (input_callback_state *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2 = 0;
-		int res2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_cb_state_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_input_callback_state, 0 | 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2),
-								"in method '" "CoreSession_cb_state_set" "', argument " "2" " of type '" "input_callback_state *" "'");
-		}
-		arg2 = reinterpret_cast < input_callback_state * >(argp2);
-		if (arg1)
-			(arg1)->cb_state = *arg2;
-
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_EventConsumer_e_cb_arg_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_cb_arg_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_cb_arg_get" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  result = (char *) ((arg1)->e_cb_arg);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_cb_state_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		input_callback_state *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_cb_state_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (input_callback_state *) & ((arg1)->cb_state);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_new_EventConsumer__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  EventConsumer *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:new_EventConsumer",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EventConsumer" "', argument " "1"" of type '" "char const *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_EventConsumer" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EventConsumer, SWIG_POINTER_NEW |  0 );
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_hook_state_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_channel_state_t arg2;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2;
-		int res2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_hook_state_set", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		{
-			res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_channel_state_t, 0 | 0);
-			if (!SWIG_IsOK(res2)) {
-				SWIG_exception_fail(SWIG_ArgError(res2),
-									"in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '" "switch_channel_state_t" "'");
-			}
-			if (!argp2) {
-				SWIG_exception_fail(SWIG_ValueError,
-									"invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '"
-									"switch_channel_state_t" "'");
-			} else {
-				switch_channel_state_t *temp = reinterpret_cast < switch_channel_state_t *>(argp2);
-				arg2 = *temp;
-				if (SWIG_IsNewObj(res2))
-					delete temp;
-			}
-		}
-		if (arg1)
-			(arg1)->hook_state = arg2;
+SWIGINTERN PyObject *_wrap_new_EventConsumer__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  EventConsumer *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_EventConsumer",&obj0)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EventConsumer" "', argument " "1"" of type '" "char const *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  result = (EventConsumer *)new EventConsumer((char const *)arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EventConsumer, SWIG_POINTER_NEW |  0 );
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return NULL;
+}
 
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_new_EventConsumer(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_new_EventConsumer__SWIG_1(self, args);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_new_EventConsumer__SWIG_0(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_EventConsumer'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    EventConsumer(char const *,char const *)\n"
+    "    EventConsumer(char const *)\n");
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_hook_state_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_channel_state_t result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_hook_state_get", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = ((arg1)->hook_state);
-		resultobj =
-			SWIG_NewPointerObj((new switch_channel_state_t (static_cast < const switch_channel_state_t &>(result))), SWIGTYPE_p_switch_channel_state_t,
-							   SWIG_POINTER_OWN | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_delete_EventConsumer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_EventConsumer",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EventConsumer" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_answer(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_answer", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (int) (arg1)->answer();
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_EventConsumer_pop__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  int arg2 ;
+  Event *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_pop",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EventConsumer_pop" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  result = (Event *)(arg1)->pop(arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_preAnswer(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_preAnswer", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (int) (arg1)->preAnswer();
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_EventConsumer_pop__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  Event *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_pop",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); 
+  }
+  arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  result = (Event *)(arg1)->pop();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_hangup", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		(arg1)->hangup(arg2);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_EventConsumer_pop(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EventConsumer, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_EventConsumer_pop__SWIG_1(self, args);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EventConsumer, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_EventConsumer_pop__SWIG_0(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EventConsumer_pop'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    pop(EventConsumer *,int)\n"
+    "    pop(EventConsumer *)\n");
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_hangup", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		(arg1)->hangup();
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *EventConsumer_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_EventConsumer, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject *_wrap_delete_CoreSession(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_CoreSession",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_hangup(PyObject * self, PyObject * args) {
-		int argc;
-		PyObject *argv[3];
-		int ii;
-
-		if (!PyTuple_Check(args))
-			SWIG_fail;
-		argc = (int) PyObject_Length(args);
-		for (ii = 0; (ii < argc) && (ii < 2); ii++) {
-			argv[ii] = PyTuple_GET_ITEM(args, ii);
-		}
-		if (argc == 1) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				return _wrap_CoreSession_hangup__SWIG_1(self, args);
-			}
-		}
-		if (argc == 2) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					return _wrap_CoreSession_hangup__SWIG_0(self, args);
-				}
-			}
-		}
 
-	  fail:
-		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_hangup'.\n"
-						 "  Possible C/C++ prototypes are:\n" "    hangup(CoreSession *,char *)\n" "    hangup(CoreSession *)\n");
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_session_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_session_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_session_set" "', argument " "2"" of type '" "switch_core_session_t *""'"); 
+  }
+  arg2 = reinterpret_cast< switch_core_session_t * >(argp2);
+  if (arg1) (arg1)->session = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_setVariable(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setVariable", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3" " of type '" "char *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		(arg1)->setVariable(arg2, arg3);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_session_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_core_session_t *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_session_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (switch_core_session_t *) ((arg1)->session);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_setPrivate(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		void *arg3 = (void *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setPrivate", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&arg3), 0, 0);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3" " of type '" "void *" "'");
-		}
-		(arg1)->setPrivate(arg2, arg3);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_channel_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_channel_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2"" of type '" "switch_channel_t *""'"); 
+  }
+  arg2 = reinterpret_cast< switch_channel_t * >(argp2);
+  if (arg1) (arg1)->channel = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_getPrivate(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		void *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_getPrivate", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (void *) (arg1)->getPrivate(arg2);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_channel_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_t *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_channel_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (switch_channel_t *) ((arg1)->channel);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_getVariable(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_getVariable", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (char *) (arg1)->getVariable(arg2);
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_flags_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  unsigned int arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  unsigned int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_flags_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2"" of type '" "unsigned int""'");
+  } 
+  arg2 = static_cast< unsigned int >(val2);
+  if (arg1) (arg1)->flags = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_process_callback_result(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		switch_status_t result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_process_callback_result", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1),
-								"in method '" "CoreSession_process_callback_result" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (arg1)->process_callback_result(arg2);
-		resultobj =
-			SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_flags_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  unsigned int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flags_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (unsigned int) ((arg1)->flags);
+  resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_say(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *arg4 = (char *) 0;
-		char *arg5 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		int res4;
-		char *buf4 = 0;
-		int alloc4 = 0;
-		int res5;
-		char *buf5 = 0;
-		int alloc5 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-		PyObject *obj4 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOOOO:CoreSession_say", &obj0, &obj1, &obj2, &obj3, &obj4))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3" " of type '" "char const *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-		if (!SWIG_IsOK(res4)) {
-			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4" " of type '" "char const *" "'");
-		}
-		arg4 = reinterpret_cast < char *>(buf4);
-		res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
-		if (!SWIG_IsOK(res5)) {
-			SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5" " of type '" "char const *" "'");
-		}
-		arg5 = reinterpret_cast < char *>(buf5);
-		(arg1)->say((char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		if (alloc5 == SWIG_NEWOBJ)
-			delete[]buf5;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		if (alloc5 == SWIG_NEWOBJ)
-			delete[]buf5;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_allocated_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_allocated_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  if (arg1) (arg1)->allocated = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *arg4 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		int res4;
-		char *buf4 = 0;
-		int alloc4 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_sayPhrase", &obj0, &obj1, &obj2, &obj3))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-		if (!SWIG_IsOK(res4)) {
-			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4" " of type '" "char const *" "'");
-		}
-		arg4 = reinterpret_cast < char *>(buf4);
-		(arg1)->sayPhrase((char const *) arg2, (char const *) arg3, (char const *) arg4);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_allocated_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_allocated_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (int) ((arg1)->allocated);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_sayPhrase", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		(arg1)->sayPhrase((char const *) arg2, (char const *) arg3);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_cb_state_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  input_callback_state *arg2 = (input_callback_state *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_cb_state_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_input_callback_state, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_cb_state_set" "', argument " "2"" of type '" "input_callback_state *""'"); 
+  }
+  arg2 = reinterpret_cast< input_callback_state * >(argp2);
+  if (arg1) (arg1)->cb_state = *arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_sayPhrase", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		(arg1)->sayPhrase((char const *) arg2);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_cb_state_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  input_callback_state *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_cb_state_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (input_callback_state *)& ((arg1)->cb_state);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase(PyObject * self, PyObject * args) {
-		int argc;
-		PyObject *argv[5];
-		int ii;
-
-		if (!PyTuple_Check(args))
-			SWIG_fail;
-		argc = (int) PyObject_Length(args);
-		for (ii = 0; (ii < argc) && (ii < 4); ii++) {
-			argv[ii] = PyTuple_GET_ITEM(args, ii);
-		}
-		if (argc == 2) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					return _wrap_CoreSession_sayPhrase__SWIG_2(self, args);
-				}
-			}
-		}
-		if (argc == 3) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-					if (_v) {
-						return _wrap_CoreSession_sayPhrase__SWIG_1(self, args);
-					}
-				}
-			}
-		}
-		if (argc == 4) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-					if (_v) {
-						int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
-						_v = SWIG_CheckState(res);
-						if (_v) {
-							return _wrap_CoreSession_sayPhrase__SWIG_0(self, args);
-						}
-					}
-				}
-			}
-		}
+SWIGINTERN PyObject *_wrap_CoreSession_hook_state_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_state_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_hook_state_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  {
+    res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_channel_state_t,  0  | 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'"); 
+    }  
+    if (!argp2) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'");
+    } else {
+      switch_channel_state_t * temp = reinterpret_cast< switch_channel_state_t * >(argp2);
+      arg2 = *temp;
+      if (SWIG_IsNewObj(res2)) delete temp;
+    }
+  }
+  if (arg1) (arg1)->hook_state = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	  fail:
-		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_sayPhrase'.\n"
-						 "  Possible C/C++ prototypes are:\n"
-						 "    sayPhrase(CoreSession *,char const *,char const *,char const *)\n"
-						 "    sayPhrase(CoreSession *,char const *,char const *)\n" "    sayPhrase(CoreSession *,char const *)\n");
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_hook_state_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_state_t result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_hook_state_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result =  ((arg1)->hook_state);
+  resultobj = SWIG_NewPointerObj((new switch_channel_state_t(static_cast< const switch_channel_state_t& >(result))), SWIGTYPE_p_switch_channel_state_t, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int arg3;
-		int arg4;
-		int arg5;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int val3;
-		int ecode3 = 0;
-		int val4;
-		int ecode4 = 0;
-		int val5;
-		int ecode5 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-		PyObject *obj4 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOOOO:CoreSession_recordFile", &obj0, &obj1, &obj2, &obj3, &obj4))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		ecode3 = SWIG_AsVal_int(obj2, &val3);
-		if (!SWIG_IsOK(ecode3)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
-		}
-		arg3 = static_cast < int >(val3);
-		ecode4 = SWIG_AsVal_int(obj3, &val4);
-		if (!SWIG_IsOK(ecode4)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
-		}
-		arg4 = static_cast < int >(val4);
-		ecode5 = SWIG_AsVal_int(obj4, &val5);
-		if (!SWIG_IsOK(ecode5)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5" " of type '" "int" "'");
-		}
-		arg5 = static_cast < int >(val5);
-		result = (int) (arg1)->recordFile(arg2, arg3, arg4, arg5);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_uuid_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_uuid_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_uuid_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_uuid_set" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (arg1->uuid) delete[] arg1->uuid;
+  if (arg2) {
+    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+    arg1->uuid = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+  } else {
+    arg1->uuid = 0;
+  }
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int arg3;
-		int arg4;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int val3;
-		int ecode3 = 0;
-		int val4;
-		int ecode4 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_recordFile", &obj0, &obj1, &obj2, &obj3))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		ecode3 = SWIG_AsVal_int(obj2, &val3);
-		if (!SWIG_IsOK(ecode3)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
-		}
-		arg3 = static_cast < int >(val3);
-		ecode4 = SWIG_AsVal_int(obj3, &val4);
-		if (!SWIG_IsOK(ecode4)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
-		}
-		arg4 = static_cast < int >(val4);
-		result = (int) (arg1)->recordFile(arg2, arg3, arg4);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_uuid_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_uuid_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_uuid_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (char *) ((arg1)->uuid);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int arg3;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int val3;
-		int ecode3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_recordFile", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		ecode3 = SWIG_AsVal_int(obj2, &val3);
-		if (!SWIG_IsOK(ecode3)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
-		}
-		arg3 = static_cast < int >(val3);
-		result = (int) (arg1)->recordFile(arg2, arg3);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_tts_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_tts_name_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_tts_name_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_tts_name_set" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (arg1->tts_name) delete[] arg1->tts_name;
+  if (arg2) {
+    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+    arg1->tts_name = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+  } else {
+    arg1->tts_name = 0;
+  }
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_3(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_recordFile", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (int) (arg1)->recordFile(arg2);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_tts_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_tts_name_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_tts_name_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (char *) ((arg1)->tts_name);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_recordFile(PyObject * self, PyObject * args) {
-		int argc;
-		PyObject *argv[6];
-		int ii;
-
-		if (!PyTuple_Check(args))
-			SWIG_fail;
-		argc = (int) PyObject_Length(args);
-		for (ii = 0; (ii < argc) && (ii < 5); ii++) {
-			argv[ii] = PyTuple_GET_ITEM(args, ii);
-		}
-		if (argc == 2) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					return _wrap_CoreSession_recordFile__SWIG_3(self, args);
-				}
-			}
-		}
-		if (argc == 3) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					{
-						int res = SWIG_AsVal_int(argv[2], NULL);
-						_v = SWIG_CheckState(res);
-					}
-					if (_v) {
-						return _wrap_CoreSession_recordFile__SWIG_2(self, args);
-					}
-				}
-			}
-		}
-		if (argc == 4) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					{
-						int res = SWIG_AsVal_int(argv[2], NULL);
-						_v = SWIG_CheckState(res);
-					}
-					if (_v) {
-						{
-							int res = SWIG_AsVal_int(argv[3], NULL);
-							_v = SWIG_CheckState(res);
-						}
-						if (_v) {
-							return _wrap_CoreSession_recordFile__SWIG_1(self, args);
-						}
-					}
-				}
-			}
-		}
-		if (argc == 5) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					{
-						int res = SWIG_AsVal_int(argv[2], NULL);
-						_v = SWIG_CheckState(res);
-					}
-					if (_v) {
-						{
-							int res = SWIG_AsVal_int(argv[3], NULL);
-							_v = SWIG_CheckState(res);
-						}
-						if (_v) {
-							{
-								int res = SWIG_AsVal_int(argv[4], NULL);
-								_v = SWIG_CheckState(res);
-							}
-							if (_v) {
-								return _wrap_CoreSession_recordFile__SWIG_0(self, args);
-							}
-						}
-					}
-				}
-			}
-		}
 
-	  fail:
-		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_recordFile'.\n"
-						 "  Possible C/C++ prototypes are:\n"
-						 "    recordFile(CoreSession *,char *,int,int,int)\n"
-						 "    recordFile(CoreSession *,char *,int,int)\n"
-						 "    recordFile(CoreSession *,char *,int)\n" "    recordFile(CoreSession *,char *)\n");
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_voice_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_voice_name_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_voice_name_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_voice_name_set" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (arg1->voice_name) delete[] arg1->voice_name;
+  if (arg2) {
+    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+    arg1->voice_name = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+  } else {
+    arg1->voice_name = 0;
+  }
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_setCallerData(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setCallerData", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3" " of type '" "char *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		(arg1)->setCallerData(arg2, arg3);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_voice_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_voice_name_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_voice_name_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (char *) ((arg1)->voice_name);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		CoreSession *arg2 = (CoreSession *) 0;
-		char *arg3 = (char *) 0;
-		int arg4;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2 = 0;
-		int res2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		int val4;
-		int ecode4 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_originate", &obj0, &obj1, &obj2, &obj3))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
-		}
-		arg2 = reinterpret_cast < CoreSession * >(argp2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		ecode4 = SWIG_AsVal_int(obj3, &val4);
-		if (!SWIG_IsOK(ecode4)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4" " of type '" "int" "'");
-		}
-		arg4 = static_cast < int >(val4);
-		result = (int) (arg1)->originate(arg2, arg3, arg4);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_answer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_answer",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (int)(arg1)->answer();
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		CoreSession *arg2 = (CoreSession *) 0;
-		char *arg3 = (char *) 0;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2 = 0;
-		int res2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_originate", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
-		}
-		arg2 = reinterpret_cast < CoreSession * >(argp2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		result = (int) (arg1)->originate(arg2, arg3);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_preAnswer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_preAnswer",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (int)(arg1)->preAnswer();
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_originate(PyObject * self, PyObject * args) {
-		int argc;
-		PyObject *argv[5];
-		int ii;
-
-		if (!PyTuple_Check(args))
-			SWIG_fail;
-		argc = (int) PyObject_Length(args);
-		for (ii = 0; (ii < argc) && (ii < 4); ii++) {
-			argv[ii] = PyTuple_GET_ITEM(args, ii);
-		}
-		if (argc == 3) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				void *vptr = 0;
-				int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-					if (_v) {
-						return _wrap_CoreSession_originate__SWIG_1(self, args);
-					}
-				}
-			}
-		}
-		if (argc == 4) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				void *vptr = 0;
-				int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-					if (_v) {
-						{
-							int res = SWIG_AsVal_int(argv[3], NULL);
-							_v = SWIG_CheckState(res);
-						}
-						if (_v) {
-							return _wrap_CoreSession_originate__SWIG_0(self, args);
-						}
-					}
-				}
-			}
-		}
+SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_hangup",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  (arg1)->hangup(arg2);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	  fail:
-		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_originate'.\n"
-						 "  Possible C/C++ prototypes are:\n"
-						 "    originate(CoreSession *,CoreSession *,char *,int)\n" "    originate(CoreSession *,CoreSession *,char *)\n");
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_hangup",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  (arg1)->hangup();
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_setDTMFCallback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		void *arg2 = (void *) 0;
-		char *arg3 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setDTMFCallback", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2" " of type '" "void *" "'");
-		}
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3" " of type '" "char *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		(arg1)->setDTMFCallback(arg2, arg3);
-		resultobj = SWIG_Py_Void();
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_hangup(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_CoreSession_hangup__SWIG_1(self, args);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_CoreSession_hangup__SWIG_0(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_hangup'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    hangup(CoreSession *,char *)\n"
+    "    hangup(CoreSession *)\n");
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_speak(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_speak", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (int) (arg1)->speak(arg2);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_setVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setVariable",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3"" of type '" "char *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  (arg1)->setVariable(arg2,arg3);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_set_tts_parms(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_set_tts_parms", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3" " of type '" "char *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		(arg1)->set_tts_parms(arg2, arg3);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_setPrivate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = (void *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setPrivate",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3"" of type '" "void *""'"); 
+  }
+  (arg1)->setPrivate(arg2,arg3);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_collectDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int arg2;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int val2;
-		int ecode2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_collectDigits", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		ecode2 = SWIG_AsVal_int(obj1, &val2);
-		if (!SWIG_IsOK(ecode2)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2" " of type '" "int" "'");
-		}
-		arg2 = static_cast < int >(val2);
-		result = (int) (arg1)->collectDigits(arg2);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_getPrivate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_getPrivate",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (void *)(arg1)->getPrivate(arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 |  0 );
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int arg2;
-		char *arg3 = (char *) 0;
-		int arg4;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int val2;
-		int ecode2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		int val4;
-		int ecode4 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_getDigits", &obj0, &obj1, &obj2, &obj3))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		ecode2 = SWIG_AsVal_int(obj1, &val2);
-		if (!SWIG_IsOK(ecode2)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2" " of type '" "int" "'");
-		}
-		arg2 = static_cast < int >(val2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3" " of type '" "char *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		ecode4 = SWIG_AsVal_int(obj3, &val4);
-		if (!SWIG_IsOK(ecode4)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4" " of type '" "int" "'");
-		}
-		arg4 = static_cast < int >(val4);
-		result = (char *) (arg1)->getDigits(arg2, arg3, arg4);
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_getVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_getVariable",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (char *)(arg1)->getVariable(arg2);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_transfer(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		char *arg4 = (char *) 0;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		int res4;
-		char *buf4 = 0;
-		int alloc4 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_transfer", &obj0, &obj1, &obj2, &obj3))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3" " of type '" "char *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-		if (!SWIG_IsOK(res4)) {
-			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4" " of type '" "char *" "'");
-		}
-		arg4 = reinterpret_cast < char *>(buf4);
-		result = (int) (arg1)->transfer(arg2, arg3, arg4);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_process_callback_result(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_process_callback_result",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_process_callback_result" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (arg1)->process_callback_result(arg2);
+  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_read(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int arg2;
-		int arg3;
-		char *arg4 = (char *) 0;
-		int arg5;
-		char *arg6 = (char *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int val2;
-		int ecode2 = 0;
-		int val3;
-		int ecode3 = 0;
-		int res4;
-		char *buf4 = 0;
-		int alloc4 = 0;
-		int val5;
-		int ecode5 = 0;
-		int res6;
-		char *buf6 = 0;
-		int alloc6 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-		PyObject *obj4 = 0;
-		PyObject *obj5 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOOOOO:CoreSession_read", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		ecode2 = SWIG_AsVal_int(obj1, &val2);
-		if (!SWIG_IsOK(ecode2)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2" " of type '" "int" "'");
-		}
-		arg2 = static_cast < int >(val2);
-		ecode3 = SWIG_AsVal_int(obj2, &val3);
-		if (!SWIG_IsOK(ecode3)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3" " of type '" "int" "'");
-		}
-		arg3 = static_cast < int >(val3);
-		res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
-		if (!SWIG_IsOK(res4)) {
-			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4" " of type '" "char const *" "'");
-		}
-		arg4 = reinterpret_cast < char *>(buf4);
-		ecode5 = SWIG_AsVal_int(obj4, &val5);
-		if (!SWIG_IsOK(ecode5)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5" " of type '" "int" "'");
-		}
-		arg5 = static_cast < int >(val5);
-		res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
-		if (!SWIG_IsOK(res6)) {
-			SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6" " of type '" "char const *" "'");
-		}
-		arg6 = reinterpret_cast < char *>(buf6);
-		result = (char *) (arg1)->read(arg2, arg3, (char const *) arg4, arg5, (char const *) arg6);
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		if (alloc6 == SWIG_NEWOBJ)
-			delete[]buf6;
-		return resultobj;
-	  fail:
-		if (alloc4 == SWIG_NEWOBJ)
-			delete[]buf4;
-		if (alloc6 == SWIG_NEWOBJ)
-			delete[]buf6;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_say(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  int res5 ;
+  char *buf5 = 0 ;
+  int alloc5 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  PyObject * obj4 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOOO:CoreSession_say",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4"" of type '" "char const *""'");
+  }
+  arg4 = reinterpret_cast< char * >(buf4);
+  res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
+  if (!SWIG_IsOK(res5)) {
+    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5"" of type '" "char const *""'");
+  }
+  arg5 = reinterpret_cast< char * >(buf5);
+  (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int arg2;
-		int arg3;
-		int arg4;
-		int arg5;
-		char *arg6 = (char *) 0;
-		char *arg7 = (char *) 0;
-		char *arg8 = (char *) 0;
-		char *arg9 = (char *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int val2;
-		int ecode2 = 0;
-		int val3;
-		int ecode3 = 0;
-		int val4;
-		int ecode4 = 0;
-		int val5;
-		int ecode5 = 0;
-		int res6;
-		char *buf6 = 0;
-		int alloc6 = 0;
-		int res7;
-		char *buf7 = 0;
-		int alloc7 = 0;
-		int res8;
-		char *buf8 = 0;
-		int alloc8 = 0;
-		int res9;
-		char *buf9 = 0;
-		int alloc9 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-		PyObject *obj4 = 0;
-		PyObject *obj5 = 0;
-		PyObject *obj6 = 0;
-		PyObject *obj7 = 0;
-		PyObject *obj8 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOOOOOOOO:CoreSession_playAndGetDigits", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5, &obj6, &obj7, &obj8))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		ecode2 = SWIG_AsVal_int(obj1, &val2);
-		if (!SWIG_IsOK(ecode2)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2" " of type '" "int" "'");
-		}
-		arg2 = static_cast < int >(val2);
-		ecode3 = SWIG_AsVal_int(obj2, &val3);
-		if (!SWIG_IsOK(ecode3)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3" " of type '" "int" "'");
-		}
-		arg3 = static_cast < int >(val3);
-		ecode4 = SWIG_AsVal_int(obj3, &val4);
-		if (!SWIG_IsOK(ecode4)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4" " of type '" "int" "'");
-		}
-		arg4 = static_cast < int >(val4);
-		ecode5 = SWIG_AsVal_int(obj4, &val5);
-		if (!SWIG_IsOK(ecode5)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5" " of type '" "int" "'");
-		}
-		arg5 = static_cast < int >(val5);
-		res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
-		if (!SWIG_IsOK(res6)) {
-			SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6" " of type '" "char *" "'");
-		}
-		arg6 = reinterpret_cast < char *>(buf6);
-		res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
-		if (!SWIG_IsOK(res7)) {
-			SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7" " of type '" "char *" "'");
-		}
-		arg7 = reinterpret_cast < char *>(buf7);
-		res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
-		if (!SWIG_IsOK(res8)) {
-			SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8" " of type '" "char *" "'");
-		}
-		arg8 = reinterpret_cast < char *>(buf8);
-		res9 = SWIG_AsCharPtrAndSize(obj8, &buf9, NULL, &alloc9);
-		if (!SWIG_IsOK(res9)) {
-			SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9" " of type '" "char *" "'");
-		}
-		arg9 = reinterpret_cast < char *>(buf9);
-		result = (char *) (arg1)->playAndGetDigits(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		if (alloc6 == SWIG_NEWOBJ)
-			delete[]buf6;
-		if (alloc7 == SWIG_NEWOBJ)
-			delete[]buf7;
-		if (alloc8 == SWIG_NEWOBJ)
-			delete[]buf8;
-		if (alloc9 == SWIG_NEWOBJ)
-			delete[]buf9;
-		return resultobj;
-	  fail:
-		if (alloc6 == SWIG_NEWOBJ)
-			delete[]buf6;
-		if (alloc7 == SWIG_NEWOBJ)
-			delete[]buf7;
-		if (alloc8 == SWIG_NEWOBJ)
-			delete[]buf8;
-		if (alloc9 == SWIG_NEWOBJ)
-			delete[]buf9;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_sayPhrase",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4"" of type '" "char const *""'");
+  }
+  arg4 = reinterpret_cast< char * >(buf4);
+  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int arg3;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int val3;
-		int ecode3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_streamFile", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		ecode3 = SWIG_AsVal_int(obj2, &val3);
-		if (!SWIG_IsOK(ecode3)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3" " of type '" "int" "'");
-		}
-		arg3 = static_cast < int >(val3);
-		result = (int) (arg1)->streamFile(arg2, arg3);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_sayPhrase",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_streamFile", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		result = (int) (arg1)->streamFile(arg2);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_sayPhrase",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  (arg1)->sayPhrase((char const *)arg2);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_streamFile(PyObject * self, PyObject * args) {
-		int argc;
-		PyObject *argv[4];
-		int ii;
-
-		if (!PyTuple_Check(args))
-			SWIG_fail;
-		argc = (int) PyObject_Length(args);
-		for (ii = 0; (ii < argc) && (ii < 3); ii++) {
-			argv[ii] = PyTuple_GET_ITEM(args, ii);
-		}
-		if (argc == 2) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					return _wrap_CoreSession_streamFile__SWIG_1(self, args);
-				}
-			}
-		}
-		if (argc == 3) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					{
-						int res = SWIG_AsVal_int(argv[2], NULL);
-						_v = SWIG_CheckState(res);
-					}
-					if (_v) {
-						return _wrap_CoreSession_streamFile__SWIG_0(self, args);
-					}
-				}
-			}
-		}
 
-	  fail:
-		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_streamFile'.\n"
-						 "  Possible C/C++ prototypes are:\n" "    streamFile(CoreSession *,char *,int)\n" "    streamFile(CoreSession *,char *)\n");
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[5];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_CoreSession_sayPhrase__SWIG_2(self, args);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          return _wrap_CoreSession_sayPhrase__SWIG_1(self, args);
+        }
+      }
+    }
+  }
+  if (argc == 4) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
+          _v = SWIG_CheckState(res);
+          if (_v) {
+            return _wrap_CoreSession_sayPhrase__SWIG_0(self, args);
+          }
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_sayPhrase'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    sayPhrase(CoreSession *,char const *,char const *,char const *)\n"
+    "    sayPhrase(CoreSession *,char const *,char const *)\n"
+    "    sayPhrase(CoreSession *,char const *)\n");
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_flushEvents(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_flushEvents", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (int) (arg1)->flushEvents();
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int arg4 ;
+  int arg5 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  int val4 ;
+  int ecode4 = 0 ;
+  int val5 ;
+  int ecode5 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  PyObject * obj4 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOOO:CoreSession_recordFile",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = static_cast< int >(val3);
+  ecode4 = SWIG_AsVal_int(obj3, &val4);
+  if (!SWIG_IsOK(ecode4)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
+  } 
+  arg4 = static_cast< int >(val4);
+  ecode5 = SWIG_AsVal_int(obj4, &val5);
+  if (!SWIG_IsOK(ecode5)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5"" of type '" "int""'");
+  } 
+  arg5 = static_cast< int >(val5);
+  result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_flushDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_flushDigits", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (int) (arg1)->flushDigits();
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int arg4 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  int val4 ;
+  int ecode4 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_recordFile",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = static_cast< int >(val3);
+  ecode4 = SWIG_AsVal_int(obj3, &val4);
+  if (!SWIG_IsOK(ecode4)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
+  } 
+  arg4 = static_cast< int >(val4);
+  result = (int)(arg1)->recordFile(arg2,arg3,arg4);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_setAutoHangup(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		bool arg2;
-		int result;
-		void *argp1 = 0;
-		int res1 = 0;
-		bool val2;
-		int ecode2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_setAutoHangup", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		ecode2 = SWIG_AsVal_bool(obj1, &val2);
-		if (!SWIG_IsOK(ecode2)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2" " of type '" "bool" "'");
-		}
-		arg2 = static_cast < bool > (val2);
-		result = (int) (arg1)->setAutoHangup(arg2);
-		resultobj = SWIG_From_int(static_cast < int >(result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_recordFile",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = static_cast< int >(val3);
+  result = (int)(arg1)->recordFile(arg2,arg3);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_setHangupHook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		void *arg2 = (void *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_setHangupHook", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2" " of type '" "void *" "'");
-		}
-		(arg1)->setHangupHook(arg2);
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_recordFile",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->recordFile(arg2);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_ready(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		bool result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_ready", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (bool) (arg1)->ready();
-		resultobj = SWIG_From_bool(static_cast < bool > (result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_recordFile(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[6];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 5); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_CoreSession_recordFile__SWIG_3(self, args);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        {
+          int res = SWIG_AsVal_int(argv[2], NULL);
+          _v = SWIG_CheckState(res);
+        }
+        if (_v) {
+          return _wrap_CoreSession_recordFile__SWIG_2(self, args);
+        }
+      }
+    }
+  }
+  if (argc == 4) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        {
+          int res = SWIG_AsVal_int(argv[2], NULL);
+          _v = SWIG_CheckState(res);
+        }
+        if (_v) {
+          {
+            int res = SWIG_AsVal_int(argv[3], NULL);
+            _v = SWIG_CheckState(res);
+          }
+          if (_v) {
+            return _wrap_CoreSession_recordFile__SWIG_1(self, args);
+          }
+        }
+      }
+    }
+  }
+  if (argc == 5) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        {
+          int res = SWIG_AsVal_int(argv[2], NULL);
+          _v = SWIG_CheckState(res);
+        }
+        if (_v) {
+          {
+            int res = SWIG_AsVal_int(argv[3], NULL);
+            _v = SWIG_CheckState(res);
+          }
+          if (_v) {
+            {
+              int res = SWIG_AsVal_int(argv[4], NULL);
+              _v = SWIG_CheckState(res);
+            }
+            if (_v) {
+              return _wrap_CoreSession_recordFile__SWIG_0(self, args);
+            }
+          }
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_recordFile'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    recordFile(CoreSession *,char *,int,int,int)\n"
+    "    recordFile(CoreSession *,char *,int,int)\n"
+    "    recordFile(CoreSession *,char *,int)\n"
+    "    recordFile(CoreSession *,char *)\n");
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		char *arg3 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_execute", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3" " of type '" "char *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		(arg1)->execute(arg2, arg3);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_setCallerData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setCallerData",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3"" of type '" "char *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  (arg1)->setCallerData(arg2,arg3);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *arg2 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_execute", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		(arg1)->execute(arg2);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int val4 ;
+  int ecode4 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_originate",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'"); 
+  }
+  arg2 = reinterpret_cast< CoreSession * >(argp2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  ecode4 = SWIG_AsVal_int(obj3, &val4);
+  if (!SWIG_IsOK(ecode4)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4"" of type '" "int""'");
+  } 
+  arg4 = static_cast< int >(val4);
+  result = (int)(arg1)->originate(arg2,arg3,arg4);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject * self, PyObject * args) {
-		int argc;
-		PyObject *argv[4];
-		int ii;
-
-		if (!PyTuple_Check(args))
-			SWIG_fail;
-		argc = (int) PyObject_Length(args);
-		for (ii = 0; (ii < argc) && (ii < 3); ii++) {
-			argv[ii] = PyTuple_GET_ITEM(args, ii);
-		}
-		if (argc == 2) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					return _wrap_CoreSession_execute__SWIG_1(self, args);
-				}
-			}
-		}
-		if (argc == 3) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
-				_v = SWIG_CheckState(res);
-				if (_v) {
-					int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
-					_v = SWIG_CheckState(res);
-					if (_v) {
-						return _wrap_CoreSession_execute__SWIG_0(self, args);
-					}
-				}
-			}
-		}
+SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_originate",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'"); 
+  }
+  arg2 = reinterpret_cast< CoreSession * >(argp2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (int)(arg1)->originate(arg2,arg3);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
-	  fail:
-		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_execute'.\n"
-						 "  Possible C/C++ prototypes are:\n" "    execute(CoreSession *,char *,char *)\n" "    execute(CoreSession *,char *)\n");
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_originate(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[5];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 3) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      void *vptr = 0;
+      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          return _wrap_CoreSession_originate__SWIG_1(self, args);
+        }
+      }
+    }
+  }
+  if (argc == 4) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      void *vptr = 0;
+      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          {
+            int res = SWIG_AsVal_int(argv[3], NULL);
+            _v = SWIG_CheckState(res);
+          }
+          if (_v) {
+            return _wrap_CoreSession_originate__SWIG_0(self, args);
+          }
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_originate'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    originate(CoreSession *,CoreSession *,char *,int)\n"
+    "    originate(CoreSession *,CoreSession *,char *)\n");
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_sendEvent(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		Event *arg2 = (Event *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2 = 0;
-		int res2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_sendEvent", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2" " of type '" "Event *" "'");
-		}
-		arg2 = reinterpret_cast < Event * >(argp2);
-		(arg1)->sendEvent(arg2);
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  void *arg2 = (void *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setDTMFCallback",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2"" of type '" "void *""'"); 
+  }
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3"" of type '" "char *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  (arg1)->setDTMFCallback(arg2,arg3);
+  resultobj = SWIG_Py_Void();
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_setEventData(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		Event *arg2 = (Event *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2 = 0;
-		int res2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_setEventData", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Event, 0 | 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2" " of type '" "Event *" "'");
-		}
-		arg2 = reinterpret_cast < Event * >(argp2);
-		(arg1)->setEventData(arg2);
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_speak(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_speak",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->speak(arg2);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_getXMLCDR(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_getXMLCDR", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (char *) (arg1)->getXMLCDR();
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_set_tts_parms(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_set_tts_parms",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3"" of type '" "char *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  (arg1)->set_tts_parms(arg2,arg3);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_begin_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		bool result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_begin_allow_threads", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (bool) (arg1)->begin_allow_threads();
-		resultobj = SWIG_From_bool(static_cast < bool > (result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_CoreSession_collectDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_collectDigits",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  result = (int)(arg1)->collectDigits(arg2);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_CoreSession_end_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		bool result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_end_allow_threads", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (bool) (arg1)->end_allow_threads();
-		resultobj = SWIG_From_bool(static_cast < bool > (result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+
+SWIGINTERN PyObject *_wrap_CoreSession_getDigits__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int val4 ;
+  int ecode4 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_getDigits",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  ecode4 = SWIG_AsVal_int(obj3, &val4);
+  if (!SWIG_IsOK(ecode4)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'");
+  } 
+  arg4 = static_cast< int >(val4);
+  result = (char *)(arg1)->getDigits(arg2,arg3,arg4);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_get_uuid(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		char *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_get_uuid", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1" " of type '" "CoreSession const *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		result = (char *) ((CoreSession const *) arg1)->get_uuid();
-		resultobj = SWIG_FromCharPtr((const char *) result);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_getDigits__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  int arg5 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int val4 ;
+  int ecode4 = 0 ;
+  int val5 ;
+  int ecode5 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  PyObject * obj4 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOOO:CoreSession_getDigits",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  ecode4 = SWIG_AsVal_int(obj3, &val4);
+  if (!SWIG_IsOK(ecode4)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'");
+  } 
+  arg4 = static_cast< int >(val4);
+  ecode5 = SWIG_AsVal_int(obj4, &val5);
+  if (!SWIG_IsOK(ecode5)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_getDigits" "', argument " "5"" of type '" "int""'");
+  } 
+  arg5 = static_cast< int >(val5);
+  result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_get_cb_args(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		switch_input_args_t *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_get_cb_args", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_cb_args" "', argument " "1" " of type '" "CoreSession const *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		{
-			switch_input_args_t const &_result_ref = ((CoreSession const *) arg1)->get_cb_args();
-			result = (switch_input_args_t *) &_result_ref;
-		}
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[6];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 5); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 4) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          {
+            int res = SWIG_AsVal_int(argv[3], NULL);
+            _v = SWIG_CheckState(res);
+          }
+          if (_v) {
+            return _wrap_CoreSession_getDigits__SWIG_0(self, args);
+          }
+        }
+      }
+    }
+  }
+  if (argc == 5) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      {
+        int res = SWIG_AsVal_int(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          {
+            int res = SWIG_AsVal_int(argv[3], NULL);
+            _v = SWIG_CheckState(res);
+          }
+          if (_v) {
+            {
+              int res = SWIG_AsVal_int(argv[4], NULL);
+              _v = SWIG_CheckState(res);
+            }
+            if (_v) {
+              return _wrap_CoreSession_getDigits__SWIG_1(self, args);
+            }
+          }
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_getDigits'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    getDigits(CoreSession *,int,char *,int)\n"
+    "    getDigits(CoreSession *,int,char *,int,int)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_transfer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_transfer",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3"" of type '" "char *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4"" of type '" "char *""'");
+  }
+  arg4 = reinterpret_cast< char * >(buf4);
+  result = (int)(arg1)->transfer(arg2,arg3,arg4);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_read(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int arg3 ;
+  char *arg4 = (char *) 0 ;
+  int arg5 ;
+  char *arg6 = (char *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  int val5 ;
+  int ecode5 = 0 ;
+  int res6 ;
+  char *buf6 = 0 ;
+  int alloc6 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOO:CoreSession_read",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = static_cast< int >(val3);
+  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4"" of type '" "char const *""'");
+  }
+  arg4 = reinterpret_cast< char * >(buf4);
+  ecode5 = SWIG_AsVal_int(obj4, &val5);
+  if (!SWIG_IsOK(ecode5)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5"" of type '" "int""'");
+  } 
+  arg5 = static_cast< int >(val5);
+  res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
+  if (!SWIG_IsOK(res6)) {
+    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6"" of type '" "char const *""'");
+  }
+  arg6 = reinterpret_cast< char * >(buf6);
+  result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+  return resultobj;
+fail:
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int arg3 ;
+  int arg4 ;
+  int arg5 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  char *arg9 = (char *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  int val4 ;
+  int ecode4 = 0 ;
+  int val5 ;
+  int ecode5 = 0 ;
+  int res6 ;
+  char *buf6 = 0 ;
+  int alloc6 = 0 ;
+  int res7 ;
+  char *buf7 = 0 ;
+  int alloc7 = 0 ;
+  int res8 ;
+  char *buf8 = 0 ;
+  int alloc8 = 0 ;
+  int res9 ;
+  char *buf9 = 0 ;
+  int alloc9 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  PyObject * obj4 = 0 ;
+  PyObject * obj5 = 0 ;
+  PyObject * obj6 = 0 ;
+  PyObject * obj7 = 0 ;
+  PyObject * obj8 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:CoreSession_playAndGetDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = static_cast< int >(val3);
+  ecode4 = SWIG_AsVal_int(obj3, &val4);
+  if (!SWIG_IsOK(ecode4)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4"" of type '" "int""'");
+  } 
+  arg4 = static_cast< int >(val4);
+  ecode5 = SWIG_AsVal_int(obj4, &val5);
+  if (!SWIG_IsOK(ecode5)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5"" of type '" "int""'");
+  } 
+  arg5 = static_cast< int >(val5);
+  res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
+  if (!SWIG_IsOK(res6)) {
+    SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6"" of type '" "char *""'");
+  }
+  arg6 = reinterpret_cast< char * >(buf6);
+  res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
+  if (!SWIG_IsOK(res7)) {
+    SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7"" of type '" "char *""'");
+  }
+  arg7 = reinterpret_cast< char * >(buf7);
+  res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
+  if (!SWIG_IsOK(res8)) {
+    SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8"" of type '" "char *""'");
+  }
+  arg8 = reinterpret_cast< char * >(buf8);
+  res9 = SWIG_AsCharPtrAndSize(obj8, &buf9, NULL, &alloc9);
+  if (!SWIG_IsOK(res9)) {
+    SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *""'");
+  }
+  arg9 = reinterpret_cast< char * >(buf9);
+  result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+  if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+  if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+  if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
+  return resultobj;
+fail:
+  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+  if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+  if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+  if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_streamFile",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = static_cast< int >(val3);
+  result = (int)(arg1)->streamFile(arg2,arg3);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_streamFile",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->streamFile(arg2);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_streamFile(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[4];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_CoreSession_streamFile__SWIG_1(self, args);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        {
+          int res = SWIG_AsVal_int(argv[2], NULL);
+          _v = SWIG_CheckState(res);
+        }
+        if (_v) {
+          return _wrap_CoreSession_streamFile__SWIG_0(self, args);
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_streamFile'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    streamFile(CoreSession *,char *,int)\n"
+    "    streamFile(CoreSession *,char *)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_sleep(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_sleep",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sleep" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  ecode2 = SWIG_AsVal_int(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_sleep" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  result = (int)(arg1)->sleep(arg2);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_flushEvents(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flushEvents",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (int)(arg1)->flushEvents();
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_flushDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flushDigits",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (int)(arg1)->flushDigits();
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_setAutoHangup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool arg2 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  bool val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setAutoHangup",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  ecode2 = SWIG_AsVal_bool(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2"" of type '" "bool""'");
+  } 
+  arg2 = static_cast< bool >(val2);
+  result = (int)(arg1)->setAutoHangup(arg2);
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_setHangupHook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  void *arg2 = (void *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setHangupHook",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2"" of type '" "void *""'"); 
+  }
+  (arg1)->setHangupHook(arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_ready(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_ready",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (bool)(arg1)->ready();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_answered(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_answered",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answered" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (bool)(arg1)->answered();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_mediaReady(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_mediaReady",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_mediaReady" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (bool)(arg1)->mediaReady();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_waitForAnswer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_waitForAnswer",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_waitForAnswer" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_waitForAnswer" "', argument " "2"" of type '" "CoreSession *""'"); 
+  }
+  arg2 = reinterpret_cast< CoreSession * >(argp2);
+  (arg1)->waitForAnswer(arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_execute",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  (arg1)->execute(arg2,arg3);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_execute",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  (arg1)->execute(arg2);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[4];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_CoreSession_execute__SWIG_1(self, args);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          return _wrap_CoreSession_execute__SWIG_0(self, args);
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_execute'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    execute(CoreSession *,char *,char *)\n"
+    "    execute(CoreSession *,char *)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_sendEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  Event *arg2 = (Event *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_sendEvent",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2"" of type '" "Event *""'"); 
+  }
+  arg2 = reinterpret_cast< Event * >(argp2);
+  (arg1)->sendEvent(arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_setEventData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  Event *arg2 = (Event *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setEventData",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Event, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2"" of type '" "Event *""'"); 
+  }
+  arg2 = reinterpret_cast< Event * >(argp2);
+  (arg1)->setEventData(arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_getXMLCDR(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_getXMLCDR",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (char *)(arg1)->getXMLCDR();
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_begin_allow_threads",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (bool)(arg1)->begin_allow_threads();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_end_allow_threads",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (bool)(arg1)->end_allow_threads();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_get_uuid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_get_uuid",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1"" of type '" "CoreSession const *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  result = (char *)((CoreSession const *)arg1)->get_uuid();
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_get_cb_args(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_input_args_t *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_get_cb_args",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_cb_args" "', argument " "1"" of type '" "CoreSession const *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  {
+    switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
+    result = (switch_input_args_t *) &_result_ref;
+  }
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_check_hangup_hook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_check_hangup_hook",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_check_hangup_hook" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  (arg1)->check_hangup_hook();
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_input_type_t arg3 ;
+  switch_status_t result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  void *argp3 ;
+  int res3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_run_dtmf_callback",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_run_dtmf_callback" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
+  }
+  {
+    res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t,  0  | 0);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
+    }  
+    if (!argp3) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
+    } else {
+      switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
+      arg3 = *temp;
+      if (SWIG_IsNewObj(res3)) delete temp;
+    }
+  }
+  result = (arg1)->run_dtmf_callback(arg2,arg3);
+  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *CoreSession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_CoreSession, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject *_wrap_console_log(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:console_log",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1"" of type '" "char *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  console_log(arg1,arg2);
+  resultobj = SWIG_Py_Void();
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_console_clean_log(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:console_clean_log",&obj0)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1"" of type '" "char *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  console_clean_log(arg1);
+  resultobj = SWIG_Py_Void();
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_bridge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = 0 ;
+  CoreSession *arg2 = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:bridge",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession,  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'"); 
+  }
+  if (!argp1) {
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession,  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'"); 
+  }
+  if (!argp2) {
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'"); 
+  }
+  arg2 = reinterpret_cast< CoreSession * >(argp2);
+  bridge(*arg1,*arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_hanguphook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:hanguphook",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
+  }
+  arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
+  result = hanguphook(arg1);
+  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_input_type_t arg3 ;
+  void *arg4 = (void *) 0 ;
+  unsigned int arg5 ;
+  switch_status_t result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  void *argp3 ;
+  int res3 = 0 ;
+  int res4 ;
+  unsigned int val5 ;
+  int ecode5 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  PyObject * obj4 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOOO:dtmf_callback",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
+  }
+  arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
+  }
+  {
+    res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t,  0  | 0);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
+    }  
+    if (!argp3) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
+    } else {
+      switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
+      arg3 = *temp;
+      if (SWIG_IsNewObj(res3)) delete temp;
+    }
+  }
+  res4 = SWIG_ConvertPtr(obj3,SWIG_as_voidptrptr(&arg4), 0, 0);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4"" of type '" "void *""'"); 
+  }
+  ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
+  if (!SWIG_IsOK(ecode5)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5"" of type '" "unsigned int""'");
+  } 
+  arg5 = static_cast< unsigned int >(val5);
+  result = dtmf_callback(arg1,arg2,arg3,arg4,arg5);
+  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_Session__SWIG_0(PyObject *self, PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *result = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)":new_Session")) SWIG_fail;
+  result = (PYTHON::Session *)new PYTHON::Session();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW |  0 ); result->setPython(self);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_Session__SWIG_1(PyObject *self, PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  PYTHON::Session *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:new_Session",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Session" "', argument " "2"" of type '" "CoreSession *""'"); 
+  }
+  arg2 = reinterpret_cast< CoreSession * >(argp2);
+  result = (PYTHON::Session *)new PYTHON::Session(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW |  0 ); result->setPython(self);
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_Session__SWIG_2(PyObject *self, PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  PYTHON::Session *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_Session",&obj0)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  result = (PYTHON::Session *)new PYTHON::Session(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW |  0 ); result->setPython(self);
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_Session__SWIG_3(PyObject *self, PyObject *args) {
+  PyObject *resultobj = 0;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  PYTHON::Session *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_Session",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
+  }
+  arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
+  result = (PYTHON::Session *)new PYTHON::Session(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW |  0 ); result->setPython(self);
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_Session(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 0) {
+    return _wrap_new_Session__SWIG_0(self, args);
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_new_Session__SWIG_3(self, args);
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_new_Session__SWIG_2(self, args);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      void *vptr = 0;
+      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_new_Session__SWIG_1(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Session'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    PYTHON::Session()\n"
+    "    PYTHON::Session(char *,CoreSession *)\n"
+    "    PYTHON::Session(char *)\n"
+    "    PYTHON::Session(switch_core_session_t *)\n");
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_check_hangup_hook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_check_hangup_hook", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_check_hangup_hook" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		(arg1)->check_hangup_hook();
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_delete_Session(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_Session",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Session" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_CoreSession_run_dtmf_callback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = (CoreSession *) 0;
-		void *arg2 = (void *) 0;
-		switch_input_type_t arg3;
-		switch_status_t result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		void *argp3;
-		int res3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_run_dtmf_callback", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_run_dtmf_callback" "', argument " "1" " of type '" "CoreSession *" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
-		}
-		{
-			res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3),
-									"in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
-			}
-			if (!argp3) {
-				SWIG_exception_fail(SWIG_ValueError,
-									"invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '"
-									"switch_input_type_t" "'");
-			} else {
-				switch_input_type_t *temp = reinterpret_cast < switch_input_type_t *>(argp3);
-				arg3 = *temp;
-				if (SWIG_IsNewObj(res3))
-					delete temp;
-			}
-		}
-		result = (arg1)->run_dtmf_callback(arg2, arg3);
-		resultobj =
-			SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Session_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_begin_allow_threads",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_begin_allow_threads" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (bool)(arg1)->begin_allow_threads();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *CoreSession_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *obj;
-		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
-			return NULL;
-		SWIG_TypeNewClientData(SWIGTYPE_p_CoreSession, SWIG_NewClientData(obj));
-		return SWIG_Py_Void();
-	}
+SWIGINTERN PyObject *_wrap_Session_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_end_allow_threads",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_end_allow_threads" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (bool)(arg1)->end_allow_threads();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_console_log(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		char *arg1 = (char *) 0;
-		char *arg2 = (char *) 0;
-		int res1;
-		char *buf1 = 0;
-		int alloc1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:console_log", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1" " of type '" "char *" "'");
-		}
-		arg1 = reinterpret_cast < char *>(buf1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		console_log(arg1, arg2);
-		resultobj = SWIG_Py_Void();
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_check_hangup_hook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_check_hangup_hook",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_check_hangup_hook" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  (arg1)->check_hangup_hook();
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_console_clean_log(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		char *arg1 = (char *) 0;
-		int res1;
-		char *buf1 = 0;
-		int alloc1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:console_clean_log", &obj0))
-			SWIG_fail;
-		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1" " of type '" "char *" "'");
-		}
-		arg1 = reinterpret_cast < char *>(buf1);
-		console_clean_log(arg1);
-		resultobj = SWIG_Py_Void();
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		return resultobj;
-	  fail:
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_input_type_t arg3 ;
+  switch_status_t result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  void *argp3 ;
+  int res3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:Session_run_dtmf_callback",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_run_dtmf_callback" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
+  }
+  {
+    res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t,  0  | 0);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
+    }  
+    if (!argp3) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
+    } else {
+      switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
+      arg3 = *temp;
+      if (SWIG_IsNewObj(res3)) delete temp;
+    }
+  }
+  result = (arg1)->run_dtmf_callback(arg2,arg3);
+  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_bridge(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		CoreSession *arg1 = 0;
-		CoreSession *arg2 = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		void *argp2 = 0;
-		int res2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:bridge", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
-		}
-		if (!argp1) {
-			SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
-		}
-		arg1 = reinterpret_cast < CoreSession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
-		}
-		if (!argp2) {
-			SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
-		}
-		arg2 = reinterpret_cast < CoreSession * >(argp2);
-		bridge(*arg1, *arg2);
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_setInputCallback__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  PyObject *arg3 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:Session_setInputCallback",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  arg3 = obj2;
+  (arg1)->setInputCallback(arg2,arg3);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_hanguphook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
-		switch_status_t result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:hanguphook", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1" " of type '" "switch_core_session_t *" "'");
-		}
-		arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
-		result = hanguphook(arg1);
-		resultobj =
-			SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_setInputCallback__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_setInputCallback",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  (arg1)->setInputCallback(arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_dtmf_callback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
-		void *arg2 = (void *) 0;
-		switch_input_type_t arg3;
-		void *arg4 = (void *) 0;
-		unsigned int arg5;
-		switch_status_t result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		void *argp3;
-		int res3 = 0;
-		int res4;
-		unsigned int val5;
-		int ecode5 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-		PyObject *obj3 = 0;
-		PyObject *obj4 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOOOO:dtmf_callback", &obj0, &obj1, &obj2, &obj3, &obj4))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1" " of type '" "switch_core_session_t *" "'");
-		}
-		arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
-		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2" " of type '" "void *" "'");
-		}
-		{
-			res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
-			}
-			if (!argp3) {
-				SWIG_exception_fail(SWIG_ValueError,
-									"invalid null reference " "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
-			} else {
-				switch_input_type_t *temp = reinterpret_cast < switch_input_type_t *>(argp3);
-				arg3 = *temp;
-				if (SWIG_IsNewObj(res3))
-					delete temp;
-			}
-		}
-		res4 = SWIG_ConvertPtr(obj3, SWIG_as_voidptrptr(&arg4), 0, 0);
-		if (!SWIG_IsOK(res4)) {
-			SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4" " of type '" "void *" "'");
-		}
-		ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
-		if (!SWIG_IsOK(ecode5)) {
-			SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5" " of type '" "unsigned int" "'");
-		}
-		arg5 = static_cast < unsigned int >(val5);
-		result = dtmf_callback(arg1, arg2, arg3, arg4, arg5);
-		resultobj =
-			SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_setInputCallback(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[4];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      _v = (argv[1] != 0);
+      if (_v) {
+        return _wrap_Session_setInputCallback__SWIG_1(self, args);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      _v = (argv[1] != 0);
+      if (_v) {
+        _v = (argv[2] != 0);
+        if (_v) {
+          return _wrap_Session_setInputCallback__SWIG_0(self, args);
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Session_setInputCallback'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    setInputCallback(PYTHON::Session *,PyObject *,PyObject *)\n"
+    "    setInputCallback(PYTHON::Session *,PyObject *)\n");
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_new_PySession__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		PySession *result = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) ":new_PySession"))
-			SWIG_fail;
-		result = (PySession *) new PySession();
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_setHangupHook__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  PyObject *arg3 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:Session_setHangupHook",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  arg3 = obj2;
+  (arg1)->setHangupHook(arg2,arg3);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_new_PySession__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		char *arg1 = (char *) 0;
-		PySession *result = 0;
-		int res1;
-		char *buf1 = 0;
-		int alloc1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:new_PySession", &obj0))
-			SWIG_fail;
-		res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1" " of type '" "char *" "'");
-		}
-		arg1 = reinterpret_cast < char *>(buf1);
-		result = (PySession *) new PySession(arg1);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0);
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		return resultobj;
-	  fail:
-		if (alloc1 == SWIG_NEWOBJ)
-			delete[]buf1;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_setHangupHook__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_setHangupHook",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  (arg1)->setHangupHook(arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_new_PySession__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		switch_core_session_t *arg1 = (switch_core_session_t *) 0;
-		PySession *result = 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:new_PySession", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1" " of type '" "switch_core_session_t *" "'");
-		}
-		arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
-		result = (PySession *) new PySession(arg1);
-		resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_setHangupHook(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[4];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      _v = (argv[1] != 0);
+      if (_v) {
+        return _wrap_Session_setHangupHook__SWIG_1(self, args);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      _v = (argv[1] != 0);
+      if (_v) {
+        _v = (argv[2] != 0);
+        if (_v) {
+          return _wrap_Session_setHangupHook__SWIG_0(self, args);
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Session_setHangupHook'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    setHangupHook(PYTHON::Session *,PyObject *,PyObject *)\n"
+    "    setHangupHook(PYTHON::Session *,PyObject *)\n");
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_new_PySession(PyObject * self, PyObject * args) {
-		int argc;
-		PyObject *argv[2];
-		int ii;
-
-		if (!PyTuple_Check(args))
-			SWIG_fail;
-		argc = (int) PyObject_Length(args);
-		for (ii = 0; (ii < argc) && (ii < 1); ii++) {
-			argv[ii] = PyTuple_GET_ITEM(args, ii);
-		}
-		if (argc == 0) {
-			return _wrap_new_PySession__SWIG_0(self, args);
-		}
-		if (argc == 1) {
-			int _v;
-			void *vptr = 0;
-			int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				return _wrap_new_PySession__SWIG_2(self, args);
-			}
-		}
-		if (argc == 1) {
-			int _v;
-			int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
-			_v = SWIG_CheckState(res);
-			if (_v) {
-				return _wrap_new_PySession__SWIG_1(self, args);
-			}
-		}
 
-	  fail:
-		SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'new_PySession'.\n"
-						 "  Possible C/C++ prototypes are:\n" "    PySession()\n" "    PySession(char *)\n" "    PySession(switch_core_session_t *)\n");
-		return NULL;
-	}
+SWIGINTERN PyObject *_wrap_Session_ready(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_ready",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_ready" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (bool)(arg1)->ready();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
 
 
-	SWIGINTERN PyObject *_wrap_delete_PySession(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		PySession *arg1 = (PySession *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:delete_PySession", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, SWIG_POINTER_DISOWN | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PySession" "', argument " "1" " of type '" "PySession *" "'");
-		}
-		arg1 = reinterpret_cast < PySession * >(argp1);
-		delete arg1;
+SWIGINTERN PyObject *_wrap_Session_cb_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_cb_function_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  if (arg1) (arg1)->cb_function = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_cb_function_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_cb_function_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (PyObject *) ((arg1)->cb_function);
+  resultobj = result;
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_PySession_setDTMFCallback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		PySession *arg1 = (PySession *) 0;
-		PyObject *arg2 = (PyObject *) 0;
-		char *arg3 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res3;
-		char *buf3 = 0;
-		int alloc3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:PySession_setDTMFCallback", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_setDTMFCallback" "', argument " "1" " of type '" "PySession *" "'");
-		}
-		arg1 = reinterpret_cast < PySession * >(argp1);
-		arg2 = obj1;
-		res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-		if (!SWIG_IsOK(res3)) {
-			SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySession_setDTMFCallback" "', argument " "3" " of type '" "char *" "'");
-		}
-		arg3 = reinterpret_cast < char *>(buf3);
-		(arg1)->setDTMFCallback(arg2, arg3);
-		resultobj = SWIG_Py_Void();
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return resultobj;
-	  fail:
-		if (alloc3 == SWIG_NEWOBJ)
-			delete[]buf3;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_cb_arg_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_cb_arg_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  if (arg1) (arg1)->cb_arg = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_PySession_setHangupHook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		PySession *arg1 = (PySession *) 0;
-		PyObject *arg2 = (PyObject *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:PySession_setHangupHook", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_setHangupHook" "', argument " "1" " of type '" "PySession *" "'");
-		}
-		arg1 = reinterpret_cast < PySession * >(argp1);
-		arg2 = obj1;
-		(arg1)->setHangupHook(arg2);
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_cb_arg_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_cb_arg_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (PyObject *) ((arg1)->cb_arg);
+  resultobj = result;
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_PySession_check_hangup_hook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		PySession *arg1 = (PySession *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:PySession_check_hangup_hook", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_check_hangup_hook" "', argument " "1" " of type '" "PySession *" "'");
-		}
-		arg1 = reinterpret_cast < PySession * >(argp1);
-		(arg1)->check_hangup_hook();
-		resultobj = SWIG_Py_Void();
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_hangup_func_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_hangup_func_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  if (arg1) (arg1)->hangup_func = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_PySession_hangup(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		PySession *arg1 = (PySession *) 0;
-		char *arg2 = (char *) 0;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		char *buf2 = 0;
-		int alloc2 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OO:PySession_hangup", &obj0, &obj1))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_hangup" "', argument " "1" " of type '" "PySession *" "'");
-		}
-		arg1 = reinterpret_cast < PySession * >(argp1);
-		res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_hangup" "', argument " "2" " of type '" "char *" "'");
-		}
-		arg2 = reinterpret_cast < char *>(buf2);
-		(arg1)->hangup(arg2);
-		resultobj = SWIG_Py_Void();
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return resultobj;
-	  fail:
-		if (alloc2 == SWIG_NEWOBJ)
-			delete[]buf2;
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_hangup_func_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_hangup_func_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (PyObject *) ((arg1)->hangup_func);
+  resultobj = result;
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_PySession_begin_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		PySession *arg1 = (PySession *) 0;
-		bool result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:PySession_begin_allow_threads", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_begin_allow_threads" "', argument " "1" " of type '" "PySession *" "'");
-		}
-		arg1 = reinterpret_cast < PySession * >(argp1);
-		result = (bool) (arg1)->begin_allow_threads();
-		resultobj = SWIG_From_bool(static_cast < bool > (result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_hangup_func_arg_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_hangup_func_arg_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_arg_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  if (arg1) (arg1)->hangup_func_arg = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_PySession_end_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		PySession *arg1 = (PySession *) 0;
-		bool result;
-		void *argp1 = 0;
-		int res1 = 0;
-		PyObject *obj0 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "O:PySession_end_allow_threads", &obj0))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_end_allow_threads" "', argument " "1" " of type '" "PySession *" "'");
-		}
-		arg1 = reinterpret_cast < PySession * >(argp1);
-		result = (bool) (arg1)->end_allow_threads();
-		resultobj = SWIG_From_bool(static_cast < bool > (result));
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_hangup_func_arg_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_hangup_func_arg_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_arg_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (PyObject *) ((arg1)->hangup_func_arg);
+  resultobj = result;
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *_wrap_PySession_run_dtmf_callback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *resultobj = 0;
-		PySession *arg1 = (PySession *) 0;
-		void *arg2 = (void *) 0;
-		switch_input_type_t arg3;
-		switch_status_t result;
-		void *argp1 = 0;
-		int res1 = 0;
-		int res2;
-		void *argp3;
-		int res3 = 0;
-		PyObject *obj0 = 0;
-		PyObject *obj1 = 0;
-		PyObject *obj2 = 0;
-
-		if (!PyArg_ParseTuple(args, (char *) "OOO:PySession_run_dtmf_callback", &obj0, &obj1, &obj2))
-			SWIG_fail;
-		res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
-		if (!SWIG_IsOK(res1)) {
-			SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_run_dtmf_callback" "', argument " "1" " of type '" "PySession *" "'");
-		}
-		arg1 = reinterpret_cast < PySession * >(argp1);
-		res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
-		if (!SWIG_IsOK(res2)) {
-			SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
-		}
-		{
-			res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
-			if (!SWIG_IsOK(res3)) {
-				SWIG_exception_fail(SWIG_ArgError(res3),
-									"in method '" "PySession_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
-			}
-			if (!argp3) {
-				SWIG_exception_fail(SWIG_ValueError,
-									"invalid null reference " "in method '" "PySession_run_dtmf_callback" "', argument " "3" " of type '"
-									"switch_input_type_t" "'");
-			} else {
-				switch_input_type_t *temp = reinterpret_cast < switch_input_type_t *>(argp3);
-				arg3 = *temp;
-				if (SWIG_IsNewObj(res3))
-					delete temp;
-			}
-		}
-		result = (arg1)->run_dtmf_callback(arg2, arg3);
-		resultobj =
-			SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
-		return resultobj;
-	  fail:
-		return NULL;
-	}
 
+SWIGINTERN PyObject *_wrap_Session_setPython(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_setPython",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setPython" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  (arg1)->setPython(arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
 
-	SWIGINTERN PyObject *PySession_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
-		PyObject *obj;
-		if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
-			return NULL;
-		SWIG_TypeNewClientData(SWIGTYPE_p_PySession, SWIG_NewClientData(obj));
-		return SWIG_Py_Void();
-	}
 
-	static PyMethodDef SwigMethods[] = {
-		{(char *) "consoleLog", _wrap_consoleLog, METH_VARARGS, NULL},
-		{(char *) "consoleCleanLog", _wrap_consoleCleanLog, METH_VARARGS, NULL},
-		{(char *) "new_IVRMenu", _wrap_new_IVRMenu, METH_VARARGS, NULL},
-		{(char *) "delete_IVRMenu", _wrap_delete_IVRMenu, METH_VARARGS, NULL},
-		{(char *) "IVRMenu_bindAction", _wrap_IVRMenu_bindAction, METH_VARARGS, NULL},
-		{(char *) "IVRMenu_execute", _wrap_IVRMenu_execute, METH_VARARGS, NULL},
-		{(char *) "IVRMenu_swigregister", IVRMenu_swigregister, METH_VARARGS, NULL},
-		{(char *) "new_API", _wrap_new_API, METH_VARARGS, NULL},
-		{(char *) "delete_API", _wrap_delete_API, METH_VARARGS, NULL},
-		{(char *) "API_execute", _wrap_API_execute, METH_VARARGS, NULL},
-		{(char *) "API_executeString", _wrap_API_executeString, METH_VARARGS, NULL},
-		{(char *) "API_swigregister", API_swigregister, METH_VARARGS, NULL},
-		{(char *) "input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set, METH_VARARGS, NULL},
-		{(char *) "input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get, METH_VARARGS, NULL},
-		{(char *) "input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set, METH_VARARGS, NULL},
-		{(char *) "input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get, METH_VARARGS, NULL},
-		{(char *) "input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set, METH_VARARGS, NULL},
-		{(char *) "input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get, METH_VARARGS, NULL},
-		{(char *) "input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set, METH_VARARGS, NULL},
-		{(char *) "input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get, METH_VARARGS, NULL},
-		{(char *) "new_input_callback_state_t", _wrap_new_input_callback_state_t, METH_VARARGS, NULL},
-		{(char *) "delete_input_callback_state_t", _wrap_delete_input_callback_state_t, METH_VARARGS, NULL},
-		{(char *) "input_callback_state_t_swigregister", input_callback_state_t_swigregister, METH_VARARGS, NULL},
-		{(char *) "new_Stream", _wrap_new_Stream, METH_VARARGS, NULL},
-		{(char *) "delete_Stream", _wrap_delete_Stream, METH_VARARGS, NULL},
-		{(char *) "Stream_write", _wrap_Stream_write, METH_VARARGS, NULL},
-		{(char *) "Stream_get_data", _wrap_Stream_get_data, METH_VARARGS, NULL},
-		{(char *) "Stream_swigregister", Stream_swigregister, METH_VARARGS, NULL},
-		{(char *) "Event_event_set", _wrap_Event_event_set, METH_VARARGS, NULL},
-		{(char *) "Event_event_get", _wrap_Event_event_get, METH_VARARGS, NULL},
-		{(char *) "Event_serialized_string_set", _wrap_Event_serialized_string_set, METH_VARARGS, NULL},
-		{(char *) "Event_serialized_string_get", _wrap_Event_serialized_string_get, METH_VARARGS, NULL},
-		{(char *) "Event_mine_set", _wrap_Event_mine_set, METH_VARARGS, NULL},
-		{(char *) "Event_mine_get", _wrap_Event_mine_get, METH_VARARGS, NULL},
-		{(char *) "new_Event", _wrap_new_Event, METH_VARARGS, NULL},
-		{(char *) "delete_Event", _wrap_delete_Event, METH_VARARGS, NULL},
-		{(char *) "Event_serialize", _wrap_Event_serialize, METH_VARARGS, NULL},
-		{(char *) "Event_setPriority", _wrap_Event_setPriority, METH_VARARGS, NULL},
-		{(char *) "Event_getHeader", _wrap_Event_getHeader, METH_VARARGS, NULL},
-		{(char *) "Event_getBody", _wrap_Event_getBody, METH_VARARGS, NULL},
-		{(char *) "Event_getType", _wrap_Event_getType, METH_VARARGS, NULL},
-		{(char *) "Event_addBody", _wrap_Event_addBody, METH_VARARGS, NULL},
-		{(char *) "Event_addHeader", _wrap_Event_addHeader, METH_VARARGS, NULL},
-		{(char *) "Event_delHeader", _wrap_Event_delHeader, METH_VARARGS, NULL},
-		{(char *) "Event_fire", _wrap_Event_fire, METH_VARARGS, NULL},
-		{(char *) "Event_swigregister", Event_swigregister, METH_VARARGS, NULL},
-		{(char *) "delete_CoreSession", _wrap_delete_CoreSession, METH_VARARGS, NULL},
-		{(char *) "CoreSession_session_set", _wrap_CoreSession_session_set, METH_VARARGS, NULL},
-		{(char *) "CoreSession_session_get", _wrap_CoreSession_session_get, METH_VARARGS, NULL},
-		{(char *) "CoreSession_channel_set", _wrap_CoreSession_channel_set, METH_VARARGS, NULL},
-		{(char *) "CoreSession_channel_get", _wrap_CoreSession_channel_get, METH_VARARGS, NULL},
-		{(char *) "CoreSession_flags_set", _wrap_CoreSession_flags_set, METH_VARARGS, NULL},
-		{(char *) "CoreSession_flags_get", _wrap_CoreSession_flags_get, METH_VARARGS, NULL},
-		{(char *) "CoreSession_allocated_set", _wrap_CoreSession_allocated_set, METH_VARARGS, NULL},
-		{(char *) "CoreSession_allocated_get", _wrap_CoreSession_allocated_get, METH_VARARGS, NULL},
-		{(char *) "CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set, METH_VARARGS, NULL},
-		{(char *) "CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get, METH_VARARGS, NULL},
-		{(char *) "CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set, METH_VARARGS, NULL},
-		{(char *) "CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get, METH_VARARGS, NULL},
-		{(char *) "CoreSession_answer", _wrap_CoreSession_answer, METH_VARARGS, NULL},
-		{(char *) "CoreSession_preAnswer", _wrap_CoreSession_preAnswer, METH_VARARGS, NULL},
-		{(char *) "CoreSession_hangup", _wrap_CoreSession_hangup, METH_VARARGS, NULL},
-		{(char *) "CoreSession_setVariable", _wrap_CoreSession_setVariable, METH_VARARGS, NULL},
-		{(char *) "CoreSession_setPrivate", _wrap_CoreSession_setPrivate, METH_VARARGS, NULL},
-		{(char *) "CoreSession_getPrivate", _wrap_CoreSession_getPrivate, METH_VARARGS, NULL},
-		{(char *) "CoreSession_getVariable", _wrap_CoreSession_getVariable, METH_VARARGS, NULL},
-		{(char *) "CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result, METH_VARARGS, NULL},
-		{(char *) "CoreSession_say", _wrap_CoreSession_say, METH_VARARGS, NULL},
-		{(char *) "CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase, METH_VARARGS, NULL},
-		{(char *) "CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL},
-		{(char *) "CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
-		{(char *) "CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},
-		{(char *) "CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL},
-		{(char *) "CoreSession_speak", _wrap_CoreSession_speak, METH_VARARGS, NULL},
-		{(char *) "CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms, METH_VARARGS, NULL},
-		{(char *) "CoreSession_collectDigits", _wrap_CoreSession_collectDigits, METH_VARARGS, NULL},
-		{(char *) "CoreSession_getDigits", _wrap_CoreSession_getDigits, METH_VARARGS, NULL},
-		{(char *) "CoreSession_transfer", _wrap_CoreSession_transfer, METH_VARARGS, NULL},
-		{(char *) "CoreSession_read", _wrap_CoreSession_read, METH_VARARGS, NULL},
-		{(char *) "CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits, METH_VARARGS, NULL},
-		{(char *) "CoreSession_streamFile", _wrap_CoreSession_streamFile, METH_VARARGS, NULL},
-		{(char *) "CoreSession_flushEvents", _wrap_CoreSession_flushEvents, METH_VARARGS, NULL},
-		{(char *) "CoreSession_flushDigits", _wrap_CoreSession_flushDigits, METH_VARARGS, NULL},
-		{(char *) "CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup, METH_VARARGS, NULL},
-		{(char *) "CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook, METH_VARARGS, NULL},
-		{(char *) "CoreSession_ready", _wrap_CoreSession_ready, METH_VARARGS, NULL},
-		{(char *) "CoreSession_execute", _wrap_CoreSession_execute, METH_VARARGS, NULL},
-		{(char *) "CoreSession_sendEvent", _wrap_CoreSession_sendEvent, METH_VARARGS, NULL},
-		{(char *) "CoreSession_setEventData", _wrap_CoreSession_setEventData, METH_VARARGS, NULL},
-		{(char *) "CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR, METH_VARARGS, NULL},
-		{(char *) "CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads, METH_VARARGS, NULL},
-		{(char *) "CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads, METH_VARARGS, NULL},
-		{(char *) "CoreSession_get_uuid", _wrap_CoreSession_get_uuid, METH_VARARGS, NULL},
-		{(char *) "CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args, METH_VARARGS, NULL},
-		{(char *) "CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook, METH_VARARGS, NULL},
-		{(char *) "CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback, METH_VARARGS, NULL},
-		{(char *) "CoreSession_swigregister", CoreSession_swigregister, METH_VARARGS, NULL},
-		{(char *) "console_log", _wrap_console_log, METH_VARARGS, NULL},
-		{(char *) "console_clean_log", _wrap_console_clean_log, METH_VARARGS, NULL},
-		{(char *) "bridge", _wrap_bridge, METH_VARARGS, NULL},
-		{(char *) "hanguphook", _wrap_hanguphook, METH_VARARGS, NULL},
-		{(char *) "dtmf_callback", _wrap_dtmf_callback, METH_VARARGS, NULL},
-		{(char *) "new_PySession", _wrap_new_PySession, METH_VARARGS, NULL},
-		{(char *) "delete_PySession", _wrap_delete_PySession, METH_VARARGS, NULL},
-		{(char *) "PySession_setDTMFCallback", _wrap_PySession_setDTMFCallback, METH_VARARGS, NULL},
-		{(char *) "PySession_setHangupHook", _wrap_PySession_setHangupHook, METH_VARARGS, NULL},
-		{(char *) "PySession_check_hangup_hook", _wrap_PySession_check_hangup_hook, METH_VARARGS, NULL},
-		{(char *) "PySession_hangup", _wrap_PySession_hangup, METH_VARARGS, NULL},
-		{(char *) "PySession_begin_allow_threads", _wrap_PySession_begin_allow_threads, METH_VARARGS, NULL},
-		{(char *) "PySession_end_allow_threads", _wrap_PySession_end_allow_threads, METH_VARARGS, NULL},
-		{(char *) "PySession_run_dtmf_callback", _wrap_PySession_run_dtmf_callback, METH_VARARGS, NULL},
-		{(char *) "PySession_swigregister", PySession_swigregister, METH_VARARGS, NULL},
-		{NULL, NULL, 0, NULL}
-	};
+SWIGINTERN PyObject *_wrap_Session_setSelf(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_setSelf",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setSelf" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  (arg1)->setSelf(arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *Session_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_PYTHON__Session, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
+static PyMethodDef SwigMethods[] = {
+	 { (char *)"consoleLog", _wrap_consoleLog, METH_VARARGS, NULL},
+	 { (char *)"consoleCleanLog", _wrap_consoleCleanLog, METH_VARARGS, NULL},
+	 { (char *)"new_IVRMenu", _wrap_new_IVRMenu, METH_VARARGS, NULL},
+	 { (char *)"delete_IVRMenu", _wrap_delete_IVRMenu, METH_VARARGS, NULL},
+	 { (char *)"IVRMenu_bindAction", _wrap_IVRMenu_bindAction, METH_VARARGS, NULL},
+	 { (char *)"IVRMenu_execute", _wrap_IVRMenu_execute, METH_VARARGS, NULL},
+	 { (char *)"IVRMenu_swigregister", IVRMenu_swigregister, METH_VARARGS, NULL},
+	 { (char *)"new_API", _wrap_new_API, METH_VARARGS, NULL},
+	 { (char *)"delete_API", _wrap_delete_API, METH_VARARGS, NULL},
+	 { (char *)"API_execute", _wrap_API_execute, METH_VARARGS, NULL},
+	 { (char *)"API_executeString", _wrap_API_executeString, METH_VARARGS, NULL},
+	 { (char *)"API_swigregister", API_swigregister, METH_VARARGS, NULL},
+	 { (char *)"input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set, METH_VARARGS, NULL},
+	 { (char *)"input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get, METH_VARARGS, NULL},
+	 { (char *)"input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set, METH_VARARGS, NULL},
+	 { (char *)"input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get, METH_VARARGS, NULL},
+	 { (char *)"input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set, METH_VARARGS, NULL},
+	 { (char *)"input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get, METH_VARARGS, NULL},
+	 { (char *)"input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set, METH_VARARGS, NULL},
+	 { (char *)"input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get, METH_VARARGS, NULL},
+	 { (char *)"new_input_callback_state_t", _wrap_new_input_callback_state_t, METH_VARARGS, NULL},
+	 { (char *)"delete_input_callback_state_t", _wrap_delete_input_callback_state_t, METH_VARARGS, NULL},
+	 { (char *)"input_callback_state_t_swigregister", input_callback_state_t_swigregister, METH_VARARGS, NULL},
+	 { (char *)"DTMF_digit_set", _wrap_DTMF_digit_set, METH_VARARGS, NULL},
+	 { (char *)"DTMF_digit_get", _wrap_DTMF_digit_get, METH_VARARGS, NULL},
+	 { (char *)"DTMF_duration_set", _wrap_DTMF_duration_set, METH_VARARGS, NULL},
+	 { (char *)"DTMF_duration_get", _wrap_DTMF_duration_get, METH_VARARGS, NULL},
+	 { (char *)"new_DTMF", _wrap_new_DTMF, METH_VARARGS, NULL},
+	 { (char *)"delete_DTMF", _wrap_delete_DTMF, METH_VARARGS, NULL},
+	 { (char *)"DTMF_swigregister", DTMF_swigregister, METH_VARARGS, NULL},
+	 { (char *)"new_Stream", _wrap_new_Stream, METH_VARARGS, NULL},
+	 { (char *)"delete_Stream", _wrap_delete_Stream, METH_VARARGS, NULL},
+	 { (char *)"Stream_write", _wrap_Stream_write, METH_VARARGS, NULL},
+	 { (char *)"Stream_get_data", _wrap_Stream_get_data, METH_VARARGS, NULL},
+	 { (char *)"Stream_swigregister", Stream_swigregister, METH_VARARGS, NULL},
+	 { (char *)"Event_event_set", _wrap_Event_event_set, METH_VARARGS, NULL},
+	 { (char *)"Event_event_get", _wrap_Event_event_get, METH_VARARGS, NULL},
+	 { (char *)"Event_serialized_string_set", _wrap_Event_serialized_string_set, METH_VARARGS, NULL},
+	 { (char *)"Event_serialized_string_get", _wrap_Event_serialized_string_get, METH_VARARGS, NULL},
+	 { (char *)"Event_mine_set", _wrap_Event_mine_set, METH_VARARGS, NULL},
+	 { (char *)"Event_mine_get", _wrap_Event_mine_get, METH_VARARGS, NULL},
+	 { (char *)"new_Event", _wrap_new_Event, METH_VARARGS, NULL},
+	 { (char *)"delete_Event", _wrap_delete_Event, METH_VARARGS, NULL},
+	 { (char *)"Event_serialize", _wrap_Event_serialize, METH_VARARGS, NULL},
+	 { (char *)"Event_setPriority", _wrap_Event_setPriority, METH_VARARGS, NULL},
+	 { (char *)"Event_getHeader", _wrap_Event_getHeader, METH_VARARGS, NULL},
+	 { (char *)"Event_getBody", _wrap_Event_getBody, METH_VARARGS, NULL},
+	 { (char *)"Event_getType", _wrap_Event_getType, METH_VARARGS, NULL},
+	 { (char *)"Event_addBody", _wrap_Event_addBody, METH_VARARGS, NULL},
+	 { (char *)"Event_addHeader", _wrap_Event_addHeader, METH_VARARGS, NULL},
+	 { (char *)"Event_delHeader", _wrap_Event_delHeader, METH_VARARGS, NULL},
+	 { (char *)"Event_fire", _wrap_Event_fire, METH_VARARGS, NULL},
+	 { (char *)"Event_swigregister", Event_swigregister, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_events_set", _wrap_EventConsumer_events_set, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_events_get", _wrap_EventConsumer_events_get, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_e_event_id_set", _wrap_EventConsumer_e_event_id_set, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_e_event_id_get", _wrap_EventConsumer_e_event_id_get, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_node_set", _wrap_EventConsumer_node_set, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_node_get", _wrap_EventConsumer_node_get, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_e_callback_set", _wrap_EventConsumer_e_callback_set, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_e_callback_get", _wrap_EventConsumer_e_callback_get, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_e_subclass_name_set", _wrap_EventConsumer_e_subclass_name_set, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_e_subclass_name_get", _wrap_EventConsumer_e_subclass_name_get, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_e_cb_arg_set", _wrap_EventConsumer_e_cb_arg_set, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_e_cb_arg_get", _wrap_EventConsumer_e_cb_arg_get, METH_VARARGS, NULL},
+	 { (char *)"new_EventConsumer", _wrap_new_EventConsumer, METH_VARARGS, NULL},
+	 { (char *)"delete_EventConsumer", _wrap_delete_EventConsumer, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_pop", _wrap_EventConsumer_pop, METH_VARARGS, NULL},
+	 { (char *)"EventConsumer_swigregister", EventConsumer_swigregister, METH_VARARGS, NULL},
+	 { (char *)"delete_CoreSession", _wrap_delete_CoreSession, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_session_set", _wrap_CoreSession_session_set, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_session_get", _wrap_CoreSession_session_get, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_channel_set", _wrap_CoreSession_channel_set, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_channel_get", _wrap_CoreSession_channel_get, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_flags_set", _wrap_CoreSession_flags_set, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_flags_get", _wrap_CoreSession_flags_get, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_allocated_set", _wrap_CoreSession_allocated_set, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_allocated_get", _wrap_CoreSession_allocated_get, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_uuid_set", _wrap_CoreSession_uuid_set, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_uuid_get", _wrap_CoreSession_uuid_get, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_tts_name_set", _wrap_CoreSession_tts_name_set, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_tts_name_get", _wrap_CoreSession_tts_name_get, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_voice_name_set", _wrap_CoreSession_voice_name_set, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_voice_name_get", _wrap_CoreSession_voice_name_get, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_answer", _wrap_CoreSession_answer, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_preAnswer", _wrap_CoreSession_preAnswer, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_hangup", _wrap_CoreSession_hangup, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_setVariable", _wrap_CoreSession_setVariable, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_setPrivate", _wrap_CoreSession_setPrivate, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_getPrivate", _wrap_CoreSession_getPrivate, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_getVariable", _wrap_CoreSession_getVariable, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_say", _wrap_CoreSession_say, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_speak", _wrap_CoreSession_speak, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_collectDigits", _wrap_CoreSession_collectDigits, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_getDigits", _wrap_CoreSession_getDigits, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_transfer", _wrap_CoreSession_transfer, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_read", _wrap_CoreSession_read, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_streamFile", _wrap_CoreSession_streamFile, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_sleep", _wrap_CoreSession_sleep, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_flushEvents", _wrap_CoreSession_flushEvents, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_flushDigits", _wrap_CoreSession_flushDigits, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_ready", _wrap_CoreSession_ready, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_answered", _wrap_CoreSession_answered, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_mediaReady", _wrap_CoreSession_mediaReady, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_waitForAnswer", _wrap_CoreSession_waitForAnswer, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_execute", _wrap_CoreSession_execute, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_sendEvent", _wrap_CoreSession_sendEvent, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_setEventData", _wrap_CoreSession_setEventData, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_get_uuid", _wrap_CoreSession_get_uuid, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_swigregister", CoreSession_swigregister, METH_VARARGS, NULL},
+	 { (char *)"console_log", _wrap_console_log, METH_VARARGS, NULL},
+	 { (char *)"console_clean_log", _wrap_console_clean_log, METH_VARARGS, NULL},
+	 { (char *)"bridge", _wrap_bridge, METH_VARARGS, NULL},
+	 { (char *)"hanguphook", _wrap_hanguphook, METH_VARARGS, NULL},
+	 { (char *)"dtmf_callback", _wrap_dtmf_callback, METH_VARARGS, NULL},
+	 { (char *)"new_Session", _wrap_new_Session, METH_VARARGS, NULL},
+	 { (char *)"delete_Session", _wrap_delete_Session, METH_VARARGS, NULL},
+	 { (char *)"Session_begin_allow_threads", _wrap_Session_begin_allow_threads, METH_VARARGS, NULL},
+	 { (char *)"Session_end_allow_threads", _wrap_Session_end_allow_threads, METH_VARARGS, NULL},
+	 { (char *)"Session_check_hangup_hook", _wrap_Session_check_hangup_hook, METH_VARARGS, NULL},
+	 { (char *)"Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback, METH_VARARGS, NULL},
+	 { (char *)"Session_setInputCallback", _wrap_Session_setInputCallback, METH_VARARGS, NULL},
+	 { (char *)"Session_setHangupHook", _wrap_Session_setHangupHook, METH_VARARGS, NULL},
+	 { (char *)"Session_ready", _wrap_Session_ready, METH_VARARGS, NULL},
+	 { (char *)"Session_cb_function_set", _wrap_Session_cb_function_set, METH_VARARGS, NULL},
+	 { (char *)"Session_cb_function_get", _wrap_Session_cb_function_get, METH_VARARGS, NULL},
+	 { (char *)"Session_cb_arg_set", _wrap_Session_cb_arg_set, METH_VARARGS, NULL},
+	 { (char *)"Session_cb_arg_get", _wrap_Session_cb_arg_get, METH_VARARGS, NULL},
+	 { (char *)"Session_hangup_func_set", _wrap_Session_hangup_func_set, METH_VARARGS, NULL},
+	 { (char *)"Session_hangup_func_get", _wrap_Session_hangup_func_get, METH_VARARGS, NULL},
+	 { (char *)"Session_hangup_func_arg_set", _wrap_Session_hangup_func_arg_set, METH_VARARGS, NULL},
+	 { (char *)"Session_hangup_func_arg_get", _wrap_Session_hangup_func_arg_get, METH_VARARGS, NULL},
+	 { (char *)"Session_setPython", _wrap_Session_setPython, METH_VARARGS, NULL},
+	 { (char *)"Session_setSelf", _wrap_Session_setSelf, METH_VARARGS, NULL},
+	 { (char *)"Session_swigregister", Session_swigregister, METH_VARARGS, NULL},
+	 { NULL, NULL, 0, NULL }
+};
 
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
-	static void *_p_PySessionTo_p_CoreSession(void *x, int *newmemory) {
-		return (void *) ((CoreSession *) ((PySession *) x));
-	}
-	static swig_type_info _swigt__p_API = { "_p_API", "API *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_CoreSession = { "_p_CoreSession", "CoreSession *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_Event = { "_p_Event", "Event *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_IVRMenu = { "_p_IVRMenu", "IVRMenu *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_PySession = { "_p_PySession", "PySession *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_Stream = { "_p_Stream", "Stream *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_char = { "_p_char", "char *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_input_callback_state =
-		{ "_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_session_flag_t = { "_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_swap_state_t = { "_p_swap_state_t", "enum swap_state_t *|swap_state_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_channel_state_t = { "_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_channel_t = { "_p_switch_channel_t", "switch_channel_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_core_session_t = { "_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_event_t = { "_p_switch_event_t", "switch_event_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_input_args_t = { "_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_input_type_t = { "_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_priority_t = { "_p_switch_priority_t", "switch_priority_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_status_t = { "_p_switch_status_t", "switch_status_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_switch_stream_handle_t = { "_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void *) 0, 0 };
-	static swig_type_info _swigt__p_void = { "_p_void", "void *", 0, 0, (void *) 0, 0 };
-
-	static swig_type_info *swig_type_initial[] = {
-		&_swigt__p_API,
-		&_swigt__p_CoreSession,
-		&_swigt__p_Event,
-		&_swigt__p_IVRMenu,
-		&_swigt__p_PySession,
-		&_swigt__p_Stream,
-		&_swigt__p_char,
-		&_swigt__p_input_callback_state,
-		&_swigt__p_session_flag_t,
-		&_swigt__p_swap_state_t,
-		&_swigt__p_switch_channel_state_t,
-		&_swigt__p_switch_channel_t,
-		&_swigt__p_switch_core_session_t,
-		&_swigt__p_switch_event_t,
-		&_swigt__p_switch_input_args_t,
-		&_swigt__p_switch_input_type_t,
-		&_swigt__p_switch_priority_t,
-		&_swigt__p_switch_status_t,
-		&_swigt__p_switch_stream_handle_t,
-		&_swigt__p_void,
-	};
-
-	static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_CoreSession[] =
-		{ {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_PySession, _p_PySessionTo_p_CoreSession, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_PySession[] = { {&_swigt__p_PySession, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_swap_state_t[] = { {&_swigt__p_swap_state_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0}, {0, 0, 0, 0} };
-	static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0}, {0, 0, 0, 0} };
-
-	static swig_cast_info *swig_cast_initial[] = {
-		_swigc__p_API,
-		_swigc__p_CoreSession,
-		_swigc__p_Event,
-		_swigc__p_IVRMenu,
-		_swigc__p_PySession,
-		_swigc__p_Stream,
-		_swigc__p_char,
-		_swigc__p_input_callback_state,
-		_swigc__p_session_flag_t,
-		_swigc__p_swap_state_t,
-		_swigc__p_switch_channel_state_t,
-		_swigc__p_switch_channel_t,
-		_swigc__p_switch_core_session_t,
-		_swigc__p_switch_event_t,
-		_swigc__p_switch_input_args_t,
-		_swigc__p_switch_input_type_t,
-		_swigc__p_switch_priority_t,
-		_swigc__p_switch_status_t,
-		_swigc__p_switch_stream_handle_t,
-		_swigc__p_void,
-	};
+static void *_p_PYTHON__SessionTo_p_CoreSession(void *x, int *newmemory) {
+    return (void *)((CoreSession *)  ((PYTHON::Session *) x));
+}
+static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_DTMF = {"_p_DTMF", "DTMF *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_EventConsumer = {"_p_EventConsumer", "EventConsumer *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_PYTHON__Session = {"_p_PYTHON__Session", "PYTHON::Session *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_event_node_t = {"_p_switch_event_node_t", "switch_event_node_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_event_types_t = {"_p_switch_event_types_t", "switch_event_types_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_queue_t = {"_p_switch_queue_t", "switch_queue_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_API,
+  &_swigt__p_CoreSession,
+  &_swigt__p_DTMF,
+  &_swigt__p_Event,
+  &_swigt__p_EventConsumer,
+  &_swigt__p_IVRMenu,
+  &_swigt__p_PYTHON__Session,
+  &_swigt__p_Stream,
+  &_swigt__p_char,
+  &_swigt__p_input_callback_state,
+  &_swigt__p_session_flag_t,
+  &_swigt__p_switch_channel_state_t,
+  &_swigt__p_switch_channel_t,
+  &_swigt__p_switch_core_session_t,
+  &_swigt__p_switch_event_node_t,
+  &_swigt__p_switch_event_t,
+  &_swigt__p_switch_event_types_t,
+  &_swigt__p_switch_input_args_t,
+  &_swigt__p_switch_input_type_t,
+  &_swigt__p_switch_priority_t,
+  &_swigt__p_switch_queue_t,
+  &_swigt__p_switch_status_t,
+  &_swigt__p_switch_stream_handle_t,
+  &_swigt__p_uint32_t,
+  &_swigt__p_void,
+};
+
+static swig_cast_info _swigc__p_API[] = {  {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_CoreSession[] = {  {&_swigt__p_CoreSession, 0, 0, 0},  {&_swigt__p_PYTHON__Session, _p_PYTHON__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_DTMF[] = {  {&_swigt__p_DTMF, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_Event[] = {  {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_EventConsumer[] = {  {&_swigt__p_EventConsumer, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_IVRMenu[] = {  {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_PYTHON__Session[] = {  {&_swigt__p_PYTHON__Session, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_Stream[] = {  {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_input_callback_state[] = {  {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_session_flag_t[] = {  {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_channel_state_t[] = {  {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_channel_t[] = {  {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_core_session_t[] = {  {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_event_node_t[] = {  {&_swigt__p_switch_event_node_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_event_t[] = {  {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_event_types_t[] = {  {&_swigt__p_switch_event_types_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_input_args_t[] = {  {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_input_type_t[] = {  {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_priority_t[] = {  {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_queue_t[] = {  {&_swigt__p_switch_queue_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_status_t[] = {  {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_stream_handle_t[] = {  {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint32_t[] = {  {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_API,
+  _swigc__p_CoreSession,
+  _swigc__p_DTMF,
+  _swigc__p_Event,
+  _swigc__p_EventConsumer,
+  _swigc__p_IVRMenu,
+  _swigc__p_PYTHON__Session,
+  _swigc__p_Stream,
+  _swigc__p_char,
+  _swigc__p_input_callback_state,
+  _swigc__p_session_flag_t,
+  _swigc__p_switch_channel_state_t,
+  _swigc__p_switch_channel_t,
+  _swigc__p_switch_core_session_t,
+  _swigc__p_switch_event_node_t,
+  _swigc__p_switch_event_t,
+  _swigc__p_switch_event_types_t,
+  _swigc__p_switch_input_args_t,
+  _swigc__p_switch_input_type_t,
+  _swigc__p_switch_priority_t,
+  _swigc__p_switch_queue_t,
+  _swigc__p_switch_status_t,
+  _swigc__p_switch_stream_handle_t,
+  _swigc__p_uint32_t,
+  _swigc__p_void,
+};
 
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
 
-	static swig_const_info swig_const_table[] = {
-		{0, 0, 0, 0.0, 0, 0}
-	};
+static swig_const_info swig_const_table[] = {
+{0, 0, 0, 0.0, 0, 0}};
 
 #ifdef __cplusplus
 }
@@ -8198,162 +9690,160 @@
 #ifdef __cplusplus
 extern "C" {
 #if 0
-}								/* c-mode */
+} /* c-mode */
 #endif
 #endif
+
 #if 0
 #define SWIGRUNTIME_DEBUG
 #endif
-SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
-{
-	size_t i;
-	swig_module_info *module_head, *iter;
-	int found, init;
-
-	clientdata = clientdata;
-
-	/* check to see if the circular list has been setup, if not, set it up */
-	if (swig_module.next == 0) {
-		/* Initialize the swig_module */
-		swig_module.type_initial = swig_type_initial;
-		swig_module.cast_initial = swig_cast_initial;
-		swig_module.next = &swig_module;
-		init = 1;
-	} else {
-		init = 0;
-	}
 
-	/* Try and load any already created modules */
-	module_head = SWIG_GetModule(clientdata);
-	if (!module_head) {
-		/* This is the first module loaded for this interpreter */
-		/* so set the swig module into the interpreter */
-		SWIG_SetModule(clientdata, &swig_module);
-		module_head = &swig_module;
-	} else {
-		/* the interpreter has loaded a SWIG module, but has it loaded this one? */
-		found = 0;
-		iter = module_head;
-		do {
-			if (iter == &swig_module) {
-				found = 1;
-				break;
-			}
-			iter = iter->next;
-		} while (iter != module_head);
-
-		/* if the is found in the list, then all is done and we may leave */
-		if (found)
-			return;
-		/* otherwise we must add out module into the list */
-		swig_module.next = module_head->next;
-		module_head->next = &swig_module;
-	}
 
-	/* When multiple interpeters are used, a module could have already been initialized in
-	   a different interpreter, but not yet have a pointer in this interpreter.
-	   In this case, we do not want to continue adding types... everything should be
-	   set up already */
-	if (init == 0)
-		return;
-
-	/* Now work on filling in swig_module.types */
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  clientdata = clientdata;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
-	printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
 #endif
-	for (i = 0; i < swig_module.size; ++i) {
-		swig_type_info *type = 0;
-		swig_type_info *ret;
-		swig_cast_info *cast;
-
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
 #ifdef SWIGRUNTIME_DEBUG
-		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
 #endif
-
-		/* if there is another module already loaded */
-		if (swig_module.next != &swig_module) {
-			type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
-		}
-		if (type) {
-			/* Overwrite clientdata field */
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
 #ifdef SWIGRUNTIME_DEBUG
-			printf("SWIG_InitializeModule: found type %s\n", type->name);
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
 #endif
-			if (swig_module.type_initial[i]->clientdata) {
-				type->clientdata = swig_module.type_initial[i]->clientdata;
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
 #ifdef SWIGRUNTIME_DEBUG
-				printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
 #endif
-			}
-		} else {
-			type = swig_module.type_initial[i];
-		}
-
-		/* Insert casting types */
-		cast = swig_module.cast_initial[i];
-		while (cast->type) {
-			/* Don't need to add information already in the list */
-			ret = 0;
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
 #ifdef SWIGRUNTIME_DEBUG
-			printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
 #endif
-			if (swig_module.next != &swig_module) {
-				ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
 #ifdef SWIGRUNTIME_DEBUG
-				if (ret)
-					printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
 #endif
-			}
-			if (ret) {
-				if (type == swig_module.type_initial[i]) {
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
 #ifdef SWIGRUNTIME_DEBUG
-					printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
 #endif
-					cast->type = ret;
-					ret = 0;
-				} else {
-					/* Check for casting already in the list */
-					swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
 #ifdef SWIGRUNTIME_DEBUG
-					if (ocast)
-						printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
 #endif
-					if (!ocast)
-						ret = 0;
-				}
-			}
-
-			if (!ret) {
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
 #ifdef SWIGRUNTIME_DEBUG
-				printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
 #endif
-				if (type->cast) {
-					type->cast->prev = cast;
-					cast->next = type->cast;
-				}
-				type->cast = cast;
-			}
-			cast++;
-		}
-		/* Set entry in modules->types array equal to the type */
-		swig_module.types[i] = type;
-	}
-	swig_module.types[i] = 0;
-
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
 #ifdef SWIGRUNTIME_DEBUG
-	printf("**** SWIG_InitializeModule: Cast List ******\n");
-	for (i = 0; i < swig_module.size; ++i) {
-		int j = 0;
-		swig_cast_info *cast = swig_module.cast_initial[i];
-		printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-		while (cast->type) {
-			printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
-			cast++;
-			++j;
-		}
-		printf("---- Total casts: %d\n", j);
-	}
-	printf("**** SWIG_InitializeModule: Cast List ******\n");
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
 #endif
 }
 
@@ -8362,34 +9852,33 @@
 * of equivalent types.  It is like calling
 * SWIG_TypeClientData(type, clientdata) a second time.
 */
-SWIGRUNTIME void SWIG_PropagateClientData(void)
-{
-	size_t i;
-	swig_cast_info *equiv;
-	static int init_run = 0;
-
-	if (init_run)
-		return;
-	init_run = 1;
-
-	for (i = 0; i < swig_module.size; i++) {
-		if (swig_module.types[i]->clientdata) {
-			equiv = swig_module.types[i]->cast;
-			while (equiv) {
-				if (!equiv->converter) {
-					if (equiv->type && !equiv->type->clientdata)
-						SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
-				}
-				equiv = equiv->next;
-			}
-		}
-	}
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
 }
 
 #ifdef __cplusplus
 #if 0
 {
-	/* c-mode */
+  /* c-mode */
 #endif
 }
 #endif
@@ -8399,240 +9888,258 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-
-	/* Python-specific SWIG API */
+  
+  /* Python-specific SWIG API */
 #define SWIG_newvarlink()                             SWIG_Python_newvarlink()
 #define SWIG_addvarlink(p, name, get_attr, set_attr)  SWIG_Python_addvarlink(p, name, get_attr, set_attr)
 #define SWIG_InstallConstants(d, constants)           SWIG_Python_InstallConstants(d, constants)
-
-	/* -----------------------------------------------------------------------------
-	 * global variable support code.
-	 * ----------------------------------------------------------------------------- */
-
-	typedef struct swig_globalvar {
-		char *name;				/* Name of global variable */
-		PyObject *(*get_attr) (void);	/* Return the current value */
-		int (*set_attr) (PyObject *);	/* Set the value */
-		struct swig_globalvar *next;
-	} swig_globalvar;
-
-	typedef struct swig_varlinkobject {
-		PyObject_HEAD swig_globalvar * vars;
-	} swig_varlinkobject;
-
-	SWIGINTERN PyObject *swig_varlink_repr(swig_varlinkobject * SWIGUNUSEDPARM(v)) {
-		return PyString_FromString("<Swig global variables>");
-	} SWIGINTERN PyObject *swig_varlink_str(swig_varlinkobject * v) {
-		PyObject *str = PyString_FromString("(");
-		swig_globalvar *var;
-		for (var = v->vars; var; var = var->next) {
-			PyString_ConcatAndDel(&str, PyString_FromString(var->name));
-			if (var->next)
-				PyString_ConcatAndDel(&str, PyString_FromString(", "));
-		}
-		PyString_ConcatAndDel(&str, PyString_FromString(")"));
-		return str;
-	}
-
-	SWIGINTERN int swig_varlink_print(swig_varlinkobject * v, FILE * fp, int SWIGUNUSEDPARM(flags)) {
-		PyObject *str = swig_varlink_str(v);
-		fprintf(fp, "Swig global variables ");
-		fprintf(fp, "%s\n", PyString_AsString(str));
-		Py_DECREF(str);
-		return 0;
-	}
-
-	SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject * v) {
-		swig_globalvar *var = v->vars;
-		while (var) {
-			swig_globalvar *n = var->next;
-			free(var->name);
-			free(var);
-			var = n;
-		}
-	}
-
-	SWIGINTERN PyObject *swig_varlink_getattr(swig_varlinkobject * v, char *n) {
-		PyObject *res = NULL;
-		swig_globalvar *var = v->vars;
-		while (var) {
-			if (strcmp(var->name, n) == 0) {
-				res = (*var->get_attr) ();
-				break;
-			}
-			var = var->next;
-		}
-		if (res == NULL && !PyErr_Occurred()) {
-			PyErr_SetString(PyExc_NameError, "Unknown C global variable");
-		}
-		return res;
-	}
-
-	SWIGINTERN int swig_varlink_setattr(swig_varlinkobject * v, char *n, PyObject * p) {
-		int res = 1;
-		swig_globalvar *var = v->vars;
-		while (var) {
-			if (strcmp(var->name, n) == 0) {
-				res = (*var->set_attr) (p);
-				break;
-			}
-			var = var->next;
-		}
-		if (res == 1 && !PyErr_Occurred()) {
-			PyErr_SetString(PyExc_NameError, "Unknown C global variable");
-		}
-		return res;
-	}
-
-	SWIGINTERN PyTypeObject *swig_varlink_type(void) {
-		static char varlink__doc__[] = "Swig var link object";
-		static PyTypeObject varlink_type;
-		static int type_init = 0;
-		if (!type_init) {
-			const PyTypeObject tmp = {
-				PyObject_HEAD_INIT(NULL)
-					0,			/* Number of items in variable part (ob_size) */
-				(char *) "swigvarlink",	/* Type name (tp_name) */
-				sizeof(swig_varlinkobject),	/* Basic size (tp_basicsize) */
-				0,				/* Itemsize (tp_itemsize) */
-				(destructor) swig_varlink_dealloc,	/* Deallocator (tp_dealloc) */
-				(printfunc) swig_varlink_print,	/* Print (tp_print) */
-				(getattrfunc) swig_varlink_getattr,	/* get attr (tp_getattr) */
-				(setattrfunc) swig_varlink_setattr,	/* Set attr (tp_setattr) */
-				0,				/* tp_compare */
-				(reprfunc) swig_varlink_repr,	/* tp_repr */
-				0,				/* tp_as_number */
-				0,				/* tp_as_sequence */
-				0,				/* tp_as_mapping */
-				0,				/* tp_hash */
-				0,				/* tp_call */
-				(reprfunc) swig_varlink_str,	/* tp_str */
-				0,				/* tp_getattro */
-				0,				/* tp_setattro */
-				0,				/* tp_as_buffer */
-				0,				/* tp_flags */
-				varlink__doc__,	/* tp_doc */
-				0,				/* tp_traverse */
-				0,				/* tp_clear */
-				0,				/* tp_richcompare */
-				0,				/* tp_weaklistoffset */
+  
+  /* -----------------------------------------------------------------------------
+   * global variable support code.
+   * ----------------------------------------------------------------------------- */
+  
+  typedef struct swig_globalvar {
+    char       *name;                  /* Name of global variable */
+    PyObject *(*get_attr)(void);       /* Return the current value */
+    int       (*set_attr)(PyObject *); /* Set the value */
+    struct swig_globalvar *next;
+  } swig_globalvar;
+  
+  typedef struct swig_varlinkobject {
+    PyObject_HEAD
+    swig_globalvar *vars;
+  } swig_varlinkobject;
+  
+  SWIGINTERN PyObject *
+  swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
+    return PyString_FromString("<Swig global variables>");
+  }
+  
+  SWIGINTERN PyObject *
+  swig_varlink_str(swig_varlinkobject *v) {
+    PyObject *str = PyString_FromString("(");
+    swig_globalvar  *var;
+    for (var = v->vars; var; var=var->next) {
+      PyString_ConcatAndDel(&str,PyString_FromString(var->name));
+      if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
+    }
+    PyString_ConcatAndDel(&str,PyString_FromString(")"));
+    return str;
+  }
+  
+  SWIGINTERN int
+  swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
+    PyObject *str = swig_varlink_str(v);
+    fprintf(fp,"Swig global variables ");
+    fprintf(fp,"%s\n", PyString_AsString(str));
+    Py_DECREF(str);
+    return 0;
+  }
+  
+  SWIGINTERN void
+  swig_varlink_dealloc(swig_varlinkobject *v) {
+    swig_globalvar *var = v->vars;
+    while (var) {
+      swig_globalvar *n = var->next;
+      free(var->name);
+      free(var);
+      var = n;
+    }
+  }
+  
+  SWIGINTERN PyObject *
+  swig_varlink_getattr(swig_varlinkobject *v, char *n) {
+    PyObject *res = NULL;
+    swig_globalvar *var = v->vars;
+    while (var) {
+      if (strcmp(var->name,n) == 0) {
+        res = (*var->get_attr)();
+        break;
+      }
+      var = var->next;
+    }
+    if (res == NULL && !PyErr_Occurred()) {
+      PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+    }
+    return res;
+  }
+  
+  SWIGINTERN int
+  swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
+    int res = 1;
+    swig_globalvar *var = v->vars;
+    while (var) {
+      if (strcmp(var->name,n) == 0) {
+        res = (*var->set_attr)(p);
+        break;
+      }
+      var = var->next;
+    }
+    if (res == 1 && !PyErr_Occurred()) {
+      PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+    }
+    return res;
+  }
+  
+  SWIGINTERN PyTypeObject*
+  swig_varlink_type(void) {
+    static char varlink__doc__[] = "Swig var link object";
+    static PyTypeObject varlink_type;
+    static int type_init = 0;  
+    if (!type_init) {
+      const PyTypeObject tmp
+      = {
+        PyObject_HEAD_INIT(NULL)
+        0,                                  /* Number of items in variable part (ob_size) */
+        (char *)"swigvarlink",              /* Type name (tp_name) */
+        sizeof(swig_varlinkobject),         /* Basic size (tp_basicsize) */
+        0,                                  /* Itemsize (tp_itemsize) */
+        (destructor) swig_varlink_dealloc,   /* Deallocator (tp_dealloc) */ 
+        (printfunc) swig_varlink_print,     /* Print (tp_print) */
+        (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
+        (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
+        0,                                  /* tp_compare */
+        (reprfunc) swig_varlink_repr,       /* tp_repr */
+        0,                                  /* tp_as_number */
+        0,                                  /* tp_as_sequence */
+        0,                                  /* tp_as_mapping */
+        0,                                  /* tp_hash */
+        0,                                  /* tp_call */
+        (reprfunc)swig_varlink_str,        /* tp_str */
+        0,                                  /* tp_getattro */
+        0,                                  /* tp_setattro */
+        0,                                  /* tp_as_buffer */
+        0,                                  /* tp_flags */
+        varlink__doc__,                     /* tp_doc */
+        0,                                  /* tp_traverse */
+        0,                                  /* tp_clear */
+        0,                                  /* tp_richcompare */
+        0,                                  /* tp_weaklistoffset */
 #if PY_VERSION_HEX >= 0x02020000
-				0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* tp_iter -> tp_weaklist */
+        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
 #endif
 #if PY_VERSION_HEX >= 0x02030000
-				0,				/* tp_del */
+        0,                                  /* tp_del */
 #endif
 #ifdef COUNT_ALLOCS
-				0, 0, 0, 0		/* tp_alloc -> tp_next */
+        0,0,0,0                             /* tp_alloc -> tp_next */
 #endif
-			};
-			varlink_type = tmp;
-			varlink_type.ob_type = &PyType_Type;
-			type_init = 1;
-		}
-		return &varlink_type;
-	}
-
-	/* Create a variable linking object for use later */
-	SWIGINTERN PyObject *SWIG_Python_newvarlink(void) {
-		swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
-		if (result) {
-			result->vars = 0;
-		}
-		return ((PyObject *) result);
-	}
-
-	SWIGINTERN void SWIG_Python_addvarlink(PyObject * p, char *name, PyObject * (*get_attr) (void), int (*set_attr) (PyObject * p)) {
-		swig_varlinkobject *v = (swig_varlinkobject *) p;
-		swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
-		if (gv) {
-			size_t size = strlen(name) + 1;
-			gv->name = (char *) malloc(size);
-			if (gv->name) {
-				strncpy(gv->name, name, size);
-				gv->get_attr = get_attr;
-				gv->set_attr = set_attr;
-				gv->next = v->vars;
-			}
-		}
-		v->vars = gv;
-	}
-
-	SWIGINTERN PyObject *SWIG_globals(void) {
-		static PyObject *_SWIG_globals = 0;
-		if (!_SWIG_globals)
-			_SWIG_globals = SWIG_newvarlink();
-		return _SWIG_globals;
-	}
-
-	/* -----------------------------------------------------------------------------
-	 * constants/methods manipulation
-	 * ----------------------------------------------------------------------------- */
-
-	/* Install Constants */
-	SWIGINTERN void SWIG_Python_InstallConstants(PyObject * d, swig_const_info constants[]) {
-		PyObject *obj = 0;
-		size_t i;
-		for (i = 0; constants[i].type; ++i) {
-			switch (constants[i].type) {
-			case SWIG_PY_POINTER:
-				obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype, 0);
-				break;
-			case SWIG_PY_BINARY:
-				obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
-				break;
-			default:
-				obj = 0;
-				break;
-			}
-			if (obj) {
-				PyDict_SetItemString(d, constants[i].name, obj);
-				Py_DECREF(obj);
-			}
-		}
-	}
-
-	/* ----------------------------------------------------------------------------- */
-	/* Fix SwigMethods to carry the callback ptrs when needed */
-	/* ----------------------------------------------------------------------------- */
-
-	SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef * methods, swig_const_info * const_table, swig_type_info ** types, swig_type_info ** types_initial) {
-		size_t i;
-		for (i = 0; methods[i].ml_name; ++i) {
-			const char *c = methods[i].ml_doc;
-			if (c && (c = strstr(c, "swig_ptr: "))) {
-				int j;
-				swig_const_info *ci = 0;
-				const char *name = c + 10;
-				for (j = 0; const_table[j].type; ++j) {
-					if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) {
-						ci = &(const_table[j]);
-						break;
-					}
-				}
-				if (ci) {
-					size_t shift = (ci->ptype) - types;
-					swig_type_info *ty = types_initial[shift];
-					size_t ldoc = (c - methods[i].ml_doc);
-					size_t lptr = strlen(ty->name) + 2 * sizeof(void *) + 2;
-					char *ndoc = (char *) malloc(ldoc + lptr + 10);
-					if (ndoc) {
-						char *buff = ndoc;
-						void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
-						if (ptr) {
-							strncpy(buff, methods[i].ml_doc, ldoc);
-							buff += ldoc;
-							strncpy(buff, "swig_ptr: ", 10);
-							buff += 10;
-							SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
-							methods[i].ml_doc = ndoc;
-						}
-					}
-				}
-			}
-		}
-	}
-
+      };
+      varlink_type = tmp;
+      varlink_type.ob_type = &PyType_Type;
+      type_init = 1;
+    }
+    return &varlink_type;
+  }
+  
+  /* Create a variable linking object for use later */
+  SWIGINTERN PyObject *
+  SWIG_Python_newvarlink(void) {
+    swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
+    if (result) {
+      result->vars = 0;
+    }
+    return ((PyObject*) result);
+  }
+  
+  SWIGINTERN void 
+  SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
+    swig_varlinkobject *v = (swig_varlinkobject *) p;
+    swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
+    if (gv) {
+      size_t size = strlen(name)+1;
+      gv->name = (char *)malloc(size);
+      if (gv->name) {
+        strncpy(gv->name,name,size);
+        gv->get_attr = get_attr;
+        gv->set_attr = set_attr;
+        gv->next = v->vars;
+      }
+    }
+    v->vars = gv;
+  }
+  
+  SWIGINTERN PyObject *
+  SWIG_globals(void) {
+    static PyObject *_SWIG_globals = 0; 
+    if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();  
+    return _SWIG_globals;
+  }
+  
+  /* -----------------------------------------------------------------------------
+   * constants/methods manipulation
+   * ----------------------------------------------------------------------------- */
+  
+  /* Install Constants */
+  SWIGINTERN void
+  SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
+    PyObject *obj = 0;
+    size_t i;
+    for (i = 0; constants[i].type; ++i) {
+      switch(constants[i].type) {
+      case SWIG_PY_POINTER:
+        obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
+        break;
+      case SWIG_PY_BINARY:
+        obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
+        break;
+      default:
+        obj = 0;
+        break;
+      }
+      if (obj) {
+        PyDict_SetItemString(d, constants[i].name, obj);
+        Py_DECREF(obj);
+      }
+    }
+  }
+  
+  /* -----------------------------------------------------------------------------*/
+  /* Fix SwigMethods to carry the callback ptrs when needed */
+  /* -----------------------------------------------------------------------------*/
+  
+  SWIGINTERN void
+  SWIG_Python_FixMethods(PyMethodDef *methods,
+    swig_const_info *const_table,
+    swig_type_info **types,
+    swig_type_info **types_initial) {
+    size_t i;
+    for (i = 0; methods[i].ml_name; ++i) {
+      const char *c = methods[i].ml_doc;
+      if (c && (c = strstr(c, "swig_ptr: "))) {
+        int j;
+        swig_const_info *ci = 0;
+        const char *name = c + 10;
+        for (j = 0; const_table[j].type; ++j) {
+          if (strncmp(const_table[j].name, name, 
+              strlen(const_table[j].name)) == 0) {
+            ci = &(const_table[j]);
+            break;
+          }
+        }
+        if (ci) {
+          size_t shift = (ci->ptype) - types;
+          swig_type_info *ty = types_initial[shift];
+          size_t ldoc = (c - methods[i].ml_doc);
+          size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
+          char *ndoc = (char*)malloc(ldoc + lptr + 10);
+          if (ndoc) {
+            char *buff = ndoc;
+            void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
+            if (ptr) {
+              strncpy(buff, methods[i].ml_doc, ldoc);
+              buff += ldoc;
+              strncpy(buff, "swig_ptr: ", 10);
+              buff += 10;
+              SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
+              methods[i].ml_doc = ndoc;
+            }
+          }
+        }
+      }
+    }
+  } 
+  
 #ifdef __cplusplus
 }
 #endif
@@ -8644,23 +10151,22 @@
 #ifdef __cplusplus
 extern "C"
 #endif
-       SWIGEXPORT void SWIG_init(void)
-{
-	PyObject *m, *d;
-
-	/* Fix SwigMethods to carry the callback ptrs when needed */
-	SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
-
-	m = Py_InitModule((char *) SWIG_name, SwigMethods);
-	d = PyModule_GetDict(m);
-
-	SWIG_InitializeModule(0);
-	SWIG_InstallConstants(d, swig_const_table);
-
-
-	SWIG_Python_SetConstant(d, "S_HUP", SWIG_From_int(static_cast < int >(S_HUP)));
-	SWIG_Python_SetConstant(d, "S_FREE", SWIG_From_int(static_cast < int >(S_FREE)));
-	SWIG_Python_SetConstant(d, "S_RDLOCK", SWIG_From_int(static_cast < int >(S_RDLOCK)));
-	SWIG_Python_SetConstant(d, "S_SWAPPED_IN", SWIG_From_int(static_cast < int >(S_SWAPPED_IN)));
-	SWIG_Python_SetConstant(d, "S_SWAPPED_OUT", SWIG_From_int(static_cast < int >(S_SWAPPED_OUT)));
+SWIGEXPORT void SWIG_init(void) {
+  PyObject *m, *d;
+  
+  /* Fix SwigMethods to carry the callback ptrs when needed */
+  SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
+  
+  m = Py_InitModule((char *) SWIG_name, SwigMethods);
+  d = PyModule_GetDict(m);
+  
+  SWIG_InitializeModule(0);
+  SWIG_InstallConstants(d,swig_const_table);
+  
+  
+  SWIG_Python_SetConstant(d, "S_HUP",SWIG_From_int(static_cast< int >(S_HUP)));
+  SWIG_Python_SetConstant(d, "S_FREE",SWIG_From_int(static_cast< int >(S_FREE)));
+  SWIG_Python_SetConstant(d, "S_RDLOCK",SWIG_From_int(static_cast< int >(S_RDLOCK)));
 }
+
+#include "mod_python_extra.c"

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Mon Aug  4 21:29:58 2008
@@ -38,18 +38,17 @@
 #include <curl/curl.h>
 #endif
 static int foo = 0;
+static jsval check_hangup_hook(struct js_session *jss, jsval *rp);
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_spidermonkey_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spidermonkey_shutdown);
 SWITCH_MODULE_DEFINITION(mod_spidermonkey, mod_spidermonkey_load, mod_spidermonkey_shutdown, NULL);
 
-#define METHOD_SANITY_CHECK() do {										\
-if (!jss || !jss->session) {											\
-	eval_some_js("~throw new Error(\"You must call the session.originate method before calling this method!\");", cx, obj, rval); \
-	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);									\
-	return JS_FALSE;													\
- }																		\
-	} while(foo == 1)
+#define METHOD_SANITY_CHECK()  if (!jss || !jss->session) {				\
+		eval_some_js("~throw new Error(\"You must call the session.originate method before calling this method!\");", cx, obj, rval); \
+		*rval = BOOLEAN_TO_JSVAL(JS_FALSE);								\
+		return JS_FALSE;												\
+	} else check_hangup_hook(jss, NULL)
 
 #define CHANNEL_SANITY_CHECK() do {										\
 		if (!switch_channel_ready(channel)) {							\
@@ -96,9 +95,9 @@
 	FILE *gOutFile;
 	int stackDummy;
 	JSRuntime *rt;
+	switch_event_node_t *node;
 } globals;
 
-
 static JSClass global_class = {
 	"Global", JSCLASS_HAS_PRIVATE,
 	JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
@@ -1149,11 +1148,13 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	JS_ResumeRequest(cb_state->cx, cb_state->saveDepth);
-	JS_CallFunction(cb_state->cx, cb_state->obj, cb_state->function, argc, argv, &cb_state->ret);
-	cb_state->saveDepth = JS_SuspendRequest(cb_state->cx);
+	if (check_hangup_hook(jss, NULL) == JS_TRUE) {
+		JS_ResumeRequest(cb_state->cx, cb_state->saveDepth);
+		JS_CallFunction(cb_state->cx, cb_state->obj, cb_state->function, argc, argv, &cb_state->ret);
+		cb_state->saveDepth = JS_SuspendRequest(cb_state->cx);
+		jss->stack_depth--;
+	}
 
-	jss->stack_depth--;
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1368,6 +1369,7 @@
 	JSFunction *function;
 	int32 limit = 0;
 	switch_input_args_t args = { 0 };
+	jsval ret = JS_TRUE;
 
 	METHOD_SANITY_CHECK();
 	channel = switch_core_session_get_channel(jss->session);
@@ -1420,11 +1422,16 @@
 	args.input_callback = dtmf_func;
 	args.buf = bp;
 	args.buflen = len;
+	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
+		return JS_FALSE;
+
+	}
 	switch_ivr_record_file(jss->session, &fh, file_name, &args, limit);
+	check_hangup_hook(jss, &ret);
 	JS_ResumeRequest(cx, cb_state.saveDepth);
 	*rval = cb_state.ret;
 
-	return JS_TRUE;
+	return ret;
 }
 
 static JSBool session_collect_input(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
@@ -1438,6 +1445,8 @@
 	struct input_callback_state cb_state = { 0 };
 	JSFunction *function;
 	switch_input_args_t args = { 0 };
+	jsval ret = JS_TRUE;
+
 
 	METHOD_SANITY_CHECK();
 	channel = switch_core_session_get_channel(jss->session);
@@ -1470,12 +1479,18 @@
 	args.input_callback = dtmf_func;
 	args.buf = bp;
 	args.buflen = len;
+
+	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
+		return JS_FALSE;
+
+	}
+
 	switch_ivr_collect_digits_callback(jss->session, &args, to);
+	check_hangup_hook(jss, &ret);
 	JS_ResumeRequest(cx, cb_state.saveDepth);
-
 	*rval = cb_state.ret;
 
-	return JS_TRUE;
+	return ret;
 }
 
 /* session.sayphrase(phrase_name, phrase_data, language, dtmf_callback, dtmf_callback_args)*/
@@ -1495,6 +1510,7 @@
 	struct input_callback_state cb_state = { 0 };
 	JSFunction *function;
 	switch_input_args_t args = { 0 };
+	jsval ret = JS_TRUE;
 
 	METHOD_SANITY_CHECK();
 	channel = switch_core_session_get_channel(jss->session);
@@ -1544,22 +1560,26 @@
 	args.input_callback = dtmf_func;
 	args.buf = bp;
 	args.buflen = len;
-
+	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
+		return JS_FALSE;
+	}
 	switch_ivr_phrase_macro(jss->session, phrase_name, phrase_data, phrase_lang, &args);
-
+	check_hangup_hook(jss, &ret);
 	JS_ResumeRequest(cx, cb_state.saveDepth);
 	*rval = cb_state.ret;
 
-	return JS_TRUE;
+	return ret;
 }
 
-static void check_hangup_hook(struct js_session *jss)
+static jsval check_hangup_hook(struct js_session *jss, jsval *rp)
 {
 	jsval argv[3] = { 0 };
 	int argc = 0;
-	jsval ret;
+	jsval ret = JS_TRUE;
+	char *resp;
 
-	if (jss->on_hangup && (jss->hook_state == CS_HANGUP || jss->hook_state == CS_ROUTING)) {
+	if (!jss->check_state && jss->on_hangup && (jss->hook_state == CS_HANGUP || jss->hook_state == CS_ROUTING)) {
+		jss->check_state++;
 		argv[argc++] = OBJECT_TO_JSVAL(jss->obj);
 		if (jss->hook_state == CS_HANGUP) {
 			argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(jss->cx, "hangup"));
@@ -1567,7 +1587,17 @@
 			argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(jss->cx, "transfer"));
 		}
 		JS_CallFunction(jss->cx, jss->obj, jss->on_hangup, argc, argv, &ret);
+		resp = JS_GetStringBytes(JS_ValueToString(jss->cx, ret));
+		if (!switch_strlen_zero(resp)) {
+			ret = !strcasecmp(resp, "exit") ? JS_FALSE : JS_TRUE;
+		}
 	}
+
+	if (rp) {
+		*rp = ret;
+	}
+
+	return ret;
 }
 
 static switch_status_t hanguphook(switch_core_session_t *session)
@@ -1579,7 +1609,7 @@
 		switch_channel_state_t state = switch_channel_get_state(channel);
 		if (jss->hook_state != state) {
 			jss->hook_state = state;
-			check_hangup_hook(jss);
+			jss->check_state = 0;
 		}
 	}
 
@@ -1623,6 +1653,7 @@
 	switch_input_args_t args = { 0 };
 	const char *prebuf;
 	char posbuf[35] = "";
+	jsval ret = JS_TRUE;
 
 	METHOD_SANITY_CHECK();
 	channel = switch_core_session_get_channel(jss->session);
@@ -1673,14 +1704,81 @@
 	args.input_callback = dtmf_func;
 	args.buf = bp;
 	args.buflen = len;
+	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
+		return JS_FALSE;
+	}
 	switch_ivr_play_file(jss->session, &fh, file_name, &args);
+	check_hangup_hook(jss, &ret);
+
 	JS_ResumeRequest(cx, cb_state.saveDepth);
 	*rval = cb_state.ret;
 
 	switch_snprintf(posbuf, sizeof(posbuf), "%u", fh.offset_pos);
 	switch_channel_set_variable(channel, "last_file_position", posbuf);
 
-	return JS_TRUE;
+	return ret;
+}
+
+
+
+static JSBool session_sleep(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct js_session *jss = JS_GetPrivate(cx, obj);
+	switch_channel_t *channel;
+	void *bp = NULL;
+	int len = 0;
+	switch_input_callback_function_t dtmf_func = NULL;
+	struct input_callback_state cb_state = { 0 };
+	JSFunction *function;
+	switch_input_args_t args = { 0 };
+	int32 ms = 0;
+	jsval ret = JS_TRUE;
+
+	METHOD_SANITY_CHECK();
+	channel = switch_core_session_get_channel(jss->session);
+	CHANNEL_SANITY_CHECK();
+	CHANNEL_MEDIA_SANITY_CHECK();
+
+	if (argc > 0) {
+		JS_ValueToInt32(cx, argv[0], &ms);
+	}
+
+	if (ms <= 0) {
+		return JS_FALSE;
+	}
+
+	if (argc > 1) {
+		if ((function = JS_ValueToFunction(cx, argv[1]))) {
+			memset(&cb_state, 0, sizeof(cb_state));
+			cb_state.function = function;
+
+			if (argc > 2) {
+				cb_state.arg = argv[2];
+			}
+
+			cb_state.session_state = jss;
+			cb_state.cx = cx;
+			cb_state.obj = obj;
+			dtmf_func = js_stream_input_callback;
+			bp = &cb_state;
+			len = sizeof(cb_state);
+		}
+	}
+
+	cb_state.ret = BOOLEAN_TO_JSVAL(JS_FALSE);
+	cb_state.saveDepth = JS_SuspendRequest(cx);
+	args.input_callback = dtmf_func;
+	args.buf = bp;
+	args.buflen = len;
+	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
+		return JS_FALSE;
+	}
+	switch_ivr_sleep(jss->session, ms, &args);
+	check_hangup_hook(jss, &ret);
+	JS_ResumeRequest(cx, cb_state.saveDepth);
+	*rval = cb_state.ret;
+
+	return ret;
 }
 
 static JSBool session_set_variable(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
@@ -1794,6 +1892,7 @@
 	switch_input_callback_function_t dtmf_func = NULL;
 	JSFunction *function;
 	switch_input_args_t args = { 0 };
+	jsval ret = JS_TRUE;
 
 	METHOD_SANITY_CHECK();
 
@@ -1862,11 +1961,15 @@
 	args.buflen = len;
 
 	switch_core_speech_flush_tts(&jss->speech->sh);
+	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
+		return JS_FALSE;
+	}
 	switch_ivr_speak_text_handle(jss->session, &jss->speech->sh, &jss->speech->codec, NULL, text, &args);
+	check_hangup_hook(jss, &ret);
 	JS_ResumeRequest(cx, cb_state.saveDepth);
 	*rval = cb_state.ret;
 
-	return JS_TRUE;
+	return ret;
 }
 
 static JSBool session_get_digits(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
@@ -1992,6 +2095,25 @@
 	return JS_TRUE;
 }
 
+static JSBool session_media_ready(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct js_session *jss = JS_GetPrivate(cx, obj);
+
+	*rval = BOOLEAN_TO_JSVAL((jss && jss->session && switch_channel_media_ready(switch_core_session_get_channel(jss->session))) ? JS_TRUE : JS_FALSE);
+
+	return JS_TRUE;
+}
+
+
+static JSBool session_answered(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct js_session *jss = JS_GetPrivate(cx, obj);
+
+	*rval = BOOLEAN_TO_JSVAL((jss && jss->session && switch_channel_test_flag(switch_core_session_get_channel(jss->session), CF_ANSWERED)) ? JS_TRUE : JS_FALSE);
+
+	return JS_TRUE;
+}
+
 static JSBool session_wait_for_media(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -2000,6 +2122,7 @@
 	unsigned int elapsed;
 	int32 timeout = 60;
 	jsrefcount saveDepth;
+	jsval ret = JS_TRUE;
 
 	METHOD_SANITY_CHECK();
 
@@ -2011,7 +2134,9 @@
 	if (argc > 0) {
 		JS_ValueToInt32(cx, argv[0], &timeout);
 	}
-
+	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
+		return JS_FALSE;
+	}
 	saveDepth = JS_SuspendRequest(cx);
 	for (;;) {
 		if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
@@ -2029,8 +2154,9 @@
 		switch_yield(1000);
 	}
 	JS_ResumeRequest(cx, saveDepth);
+	check_hangup_hook(jss, &ret);
 
-	return JS_TRUE;
+	return ret;
 }
 
 static JSBool session_wait_for_answer(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
@@ -2041,7 +2167,8 @@
 	unsigned int elapsed;
 	int32 timeout = 60;
 	jsrefcount saveDepth;
-
+	jsval ret = JS_TRUE;
+	
 	METHOD_SANITY_CHECK();
 	channel = switch_core_session_get_channel(jss->session);
 
@@ -2051,6 +2178,10 @@
 		JS_ValueToInt32(cx, argv[0], &timeout);
 	}
 
+	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
+        return JS_FALSE;
+    }
+
 	saveDepth = JS_SuspendRequest(cx);
 	for (;;) {
 		if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
@@ -2067,8 +2198,8 @@
 		switch_yield(1000);
 	}
 	JS_ResumeRequest(cx, saveDepth);
-
-	return JS_TRUE;
+	check_hangup_hook(jss, &ret);
+	return ret;
 }
 
 static JSBool session_execute(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
@@ -2076,6 +2207,7 @@
 	JSBool retval = JS_FALSE;
 	switch_channel_t *channel;
 	struct js_session *jss = JS_GetPrivate(cx, obj);
+	jsval ret = JS_TRUE;
 
 	METHOD_SANITY_CHECK();
 
@@ -2096,8 +2228,13 @@
 
 		if ((application_interface = switch_loadable_module_get_application_interface(app_name))) {
 			if (application_interface->application_function) {
+				if (check_hangup_hook(jss, NULL) != JS_TRUE) {
+					return JS_FALSE;
+				}
+				
 				saveDepth = JS_SuspendRequest(cx);
 				switch_core_session_exec(jss->session, application_interface, app_arg);
+				check_hangup_hook(jss, &ret);
 				JS_ResumeRequest(cx, saveDepth);
 				retval = JS_TRUE;
 			}
@@ -2105,7 +2242,7 @@
 	}
 
 	*rval = BOOLEAN_TO_JSVAL(retval);
-	return JS_TRUE;
+	return ret;
 }
 
 static JSBool session_get_event(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
@@ -2451,12 +2588,15 @@
 	{"preAnswer", session_pre_answer, 0},
 	{"generateXmlCdr", session_cdr, 0},
 	{"ready", session_ready, 0},
+	{"answered", session_answered, 0},
+	{"mediaReady", session_media_ready, 0},
 	{"waitForAnswer", session_wait_for_answer, 0},
 	{"waitForMedia", session_wait_for_media, 0},
 	{"getEvent", session_get_event, 0},
 	{"sendEvent", session_send_event, 0},
 	{"hangup", session_hangup, 0},
 	{"execute", session_execute, 0},
+	{"sleep", session_sleep, 1},
 	{0}
 };
 
@@ -2619,7 +2759,8 @@
 static JSBool session_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	struct js_session *jss = NULL;
-
+	JSObject *session_obj = NULL;
+	
 	jss = malloc(sizeof(*jss));
 	switch_assert(jss);
 	memset(jss, 0, sizeof(*jss));
@@ -2627,10 +2768,31 @@
 	jss->obj = obj;
 	JS_SetPrivate(cx, obj, jss);
 
+	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+	
 	if (argc > 0) {
 		char *uuid = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
-		if (uuid) {
+
+		if (!strchr(uuid, '/')) {
 			jss->session = switch_core_session_locate(uuid);
+			switch_set_flag(jss, S_HUP);
+			*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+		} else {
+			struct js_session *old_jss = NULL;
+
+			if (argc > 1) {
+				if (JS_ValueToObject(cx, argv[1], &session_obj) && session_obj) {
+					old_jss = JS_GetPrivate(cx, session_obj);
+				}
+			}
+			if (switch_ivr_originate(old_jss ? old_jss->session : NULL, 
+									 &jss->session, &jss->cause, uuid, 60, NULL, NULL, NULL, NULL, SOF_NONE) == SWITCH_STATUS_SUCCESS) {
+				switch_set_flag(jss, S_HUP);
+				switch_channel_set_state(switch_core_session_get_channel(jss->session), CS_SOFT_EXECUTE);
+				*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+			} else {
+				*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_cause2str(jss->cause)));
+			}
 		}
 	}
 
@@ -3035,7 +3197,6 @@
 		switch_snprintf(code_buf, sizeof(code_buf), "~throw new Error(\"%s\");", supplied_error);
 		eval_some_js(code_buf, cx, obj, rval);
 	}
-
 	return JS_FALSE;
 }
 
@@ -3120,6 +3281,24 @@
 	return JS_FALSE;
 }
 
+static JSBool js_api_sleep(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	int32 msec = 0;
+
+	if (argc > 0) {
+		JS_ValueToInt32(cx, argv[0], &msec);
+	} 
+
+	if (msec) {
+		switch_yield(msec * 1000);
+	} else {
+		eval_some_js("~throw new Error(\"No Time specified\");", cx, obj, rval);
+	}
+
+	return JS_TRUE;
+
+}
+
 static JSBool js_api_use(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
 {
 	char *mod_name = NULL;
@@ -3290,6 +3469,7 @@
 	{"bridge", js_bridge, 2},
 	{"apiExecute", js_api_execute, 2},
 	{"use", js_api_use, 1},
+	{"msleep", js_api_sleep, 1},
 	{"fileDelete", js_file_unlink, 1},
 	{"system", js_system, 1},
 #ifdef HAVE_CURL
@@ -3492,7 +3672,7 @@
 		return status;
 	}
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL)
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL, &globals.node)
 		!= SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
@@ -3514,6 +3694,7 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spidermonkey_shutdown)
 {
 	curl_global_cleanup();
+	switch_event_unbind(&globals.node);
 	switch_core_hash_destroy(&module_manager.mod_hash);
 	switch_core_hash_destroy(&module_manager.load_hash);
 	return SWITCH_STATUS_SUCCESS;
@@ -3527,5 +3708,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h	Mon Aug  4 21:29:58 2008
@@ -146,6 +146,7 @@
 	char *rdnis;
 	char *context;
 	char *username;
+	int check_state;
 	struct js_session_speech *speech;
 };
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c	Mon Aug  4 21:29:58 2008
@@ -346,5 +346,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c	Mon Aug  4 21:29:58 2008
@@ -112,6 +112,7 @@
 	char *url_p = NULL, *data = NULL, *durl = NULL;
 	long httpRes = 0;
 	struct curl_slist *headers = NULL;
+	int32 timeout = 0;
 
 	if (argc < 2 || !co) {
 		return JS_FALSE;
@@ -148,6 +149,14 @@
 		}
 	}
 
+	if (argc > 6) {
+		JS_ValueToInt32(cx, argv[6], &timeout);
+		if (timeout > 0) {
+			curl_easy_setopt(co->curl_handle, CURLOPT_TIMEOUT, timeout);
+		}
+	}
+
+
 
 	curl_easy_setopt(co->curl_handle, CURLOPT_HTTPHEADER, headers);
 
@@ -240,5 +249,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c	Mon Aug  4 21:29:58 2008
@@ -359,46 +359,45 @@
 	}
 
 	if (odbc_obj->stmt) {
-		SQLSMALLINT c = 0, x = 0;
-		SQLLEN m = 0;
+		SQLSMALLINT nColumns = 0, x = 0;
 
 		eval_some_js("~var _oDbC_dB_RoW_DaTa_ = {}", cx, obj, rval);
 		if (*rval == JS_FALSE) {
 			return JS_TRUE;
 		}
 
-		SQLNumResultCols(odbc_obj->stmt, &c);
-		SQLRowCount(odbc_obj->stmt, &m);
-		if (m > 0) {
-			for (x = 1; x <= c; x++) {
-				SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
-				SQLULEN ColumnSize;
-				SQLCHAR name[1024] = "";
-				SQLCHAR *data = odbc_obj->colbuf;
-				SQLCHAR *esc = NULL;
-
-				SQLDescribeCol(odbc_obj->stmt, x, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
-				SQLGetData(odbc_obj->stmt, x, SQL_C_CHAR, odbc_obj->colbuf, odbc_obj->cblen, NULL);
-
-				if (strchr((char *) odbc_obj->colbuf, '"')) {	/* please don't */
-					esc = (SQLCHAR *) escape_data((char *) odbc_obj->colbuf, '\\');
-					data = esc;
-				}
-
-				switch_snprintf((char *) odbc_obj->code, odbc_obj->codelen, "~_oDbC_dB_RoW_DaTa_[\"%s\"] = \"%s\"", name, data);
-				switch_safe_free(esc);
-
-				eval_some_js((char *) odbc_obj->code, cx, obj, rval);
-
-				if (*rval == JS_FALSE) {
-					return JS_TRUE;
-				}
+		if ( SQLNumResultCols( odbc_obj->stmt, &nColumns ) != SQL_SUCCESS )
+			return JS_FALSE;
+
+		for (x = 1; x <= nColumns; x++) {
+			SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
+			SQLULEN ColumnSize;
+			SQLCHAR name[1024] = "";
+			SQLCHAR *data = odbc_obj->colbuf;
+			SQLCHAR *esc = NULL;
+
+			SQLDescribeCol(odbc_obj->stmt, x, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
+			SQLGetData(odbc_obj->stmt, x, SQL_C_CHAR, odbc_obj->colbuf, odbc_obj->cblen, NULL);
+
+			if (strchr((char *) odbc_obj->colbuf, '"')) {	/* please don't */
+				esc = (SQLCHAR *) escape_data((char *) odbc_obj->colbuf, '\\');
+				data = esc;
 			}
 
-			JS_GetProperty(cx, obj, "_oDbC_dB_RoW_DaTa_", rval);
-			return JS_TRUE;
+			switch_snprintf((char *) odbc_obj->code, odbc_obj->codelen, "~_oDbC_dB_RoW_DaTa_[\"%s\"] = \"%s\"", name, data);
+			switch_safe_free(esc);
+
+			eval_some_js((char *) odbc_obj->code, cx, obj, rval);
+
+			if (*rval == JS_FALSE) {
+				return JS_TRUE;
+			}
 		}
 
+		JS_GetProperty(cx, obj, "_oDbC_dB_RoW_DaTa_", rval);
+		return JS_TRUE;
+		
+
 	}
 
   done:
@@ -499,5 +498,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c	Mon Aug  4 21:29:58 2008
@@ -322,5 +322,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c	Mon Aug  4 21:29:58 2008
@@ -359,5 +359,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_console/mod_console.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_console/mod_console.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_console/mod_console.c	Mon Aug  4 21:29:58 2008
@@ -42,21 +42,13 @@
 static HANDLE hStdout;
 static WORD wOldColorAttrs;
 static CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
-static WORD COLORS[] = { FOREGROUND_RED | FOREGROUND_INTENSITY,
-	FOREGROUND_RED | FOREGROUND_INTENSITY,
-	FOREGROUND_RED | FOREGROUND_INTENSITY,
-	FOREGROUND_RED | FOREGROUND_INTENSITY,
-	FOREGROUND_BLUE | FOREGROUND_INTENSITY,
-	FOREGROUND_BLUE | FOREGROUND_INTENSITY,
-	FOREGROUND_GREEN | FOREGROUND_INTENSITY,
-	FOREGROUND_GREEN | FOREGROUND_INTENSITY,
-	FOREGROUND_GREEN | FOREGROUND_INTENSITY
-};
+
+static WORD 
 #else
-static const char *COLORS[] = { SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN,
-	SWITCH_SEQ_FGREEN, SWITCH_SEQ_FYELLOW, ""
-};
+static const char*
 #endif
+COLORS[] = { SWITCH_SEQ_DEFAULT_COLOR, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN, SWITCH_SEQ_FGREEN, SWITCH_SEQ_FYELLOW };
+
 
 static switch_memory_pool_t *module_pool = NULL;
 static switch_hash_t *log_hash = NULL;
@@ -86,7 +78,7 @@
 	}
 
 	if (!strcasecmp(var, "all")) {
-		all_level |= m;
+		all_level = m | switch_log_str2mask("console");
 		return;
 	}
 
@@ -338,7 +330,7 @@
 
 
 	/* setup my logger function */
-	switch_log_bind_logger(switch_console_logger, SWITCH_LOG_DEBUG);
+	switch_log_bind_logger(switch_console_logger, SWITCH_LOG_DEBUG, SWITCH_TRUE);
 
 	config_logger();
 	RUNNING = 1;
@@ -348,10 +340,12 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_console_shutdown)
 {
-	//switch_core_hash_destroy(&log_hash);
-	//switch_core_hash_destroy(&name_hash);
+
+	switch_log_unbind_logger(switch_console_logger);
+	switch_core_hash_destroy(&log_hash);
+
 	RUNNING = 0;
-	return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_UNLOAD;
 }
 
 /* For Emacs:
@@ -362,5 +356,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_logfile/mod_logfile.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_logfile/mod_logfile.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_logfile/mod_logfile.c	Mon Aug  4 21:29:58 2008
@@ -46,6 +46,7 @@
 static struct {
 	int rotate;
 	switch_mutex_t *mutex;
+	switch_event_node_t *node;
 } globals;
 
 struct logfile_profile {
@@ -341,7 +342,7 @@
 	}
 	switch_core_hash_init(&profile_hash, module_pool);
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
@@ -373,9 +374,9 @@
 		switch_xml_free(xml);
 	}
 
-	switch_log_bind_logger(mod_logfile_logger, SWITCH_LOG_DEBUG);
+	switch_log_bind_logger(mod_logfile_logger, SWITCH_LOG_DEBUG, SWITCH_FALSE);
 
-	return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_NOUNLOAD;
 }
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_logfile_shutdown)
@@ -383,6 +384,8 @@
 	/* TODO:  Need to finish processing pending log messages before we close the file handle */
 
 	//switch_file_close(globals->log_afd);
+	switch_event_unbind(&globals.node);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -394,5 +397,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_syslog/mod_syslog.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_syslog/mod_syslog.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_syslog/mod_syslog.c	Mon Aug  4 21:29:58 2008
@@ -44,6 +44,7 @@
 SWITCH_MODULE_DEFINITION(mod_syslog, mod_syslog_load, mod_syslog_shutdown, NULL);
 
 static switch_status_t load_config(void);
+static switch_log_level_t log_level;
 
 static struct {
 	char *ident;
@@ -68,7 +69,6 @@
 
 static switch_status_t mod_syslog_logger(const switch_log_node_t *node, switch_log_level_t level)
 {
-	char *message = NULL;
 	int syslog_level;
 
 	switch (level) {
@@ -98,7 +98,7 @@
 		break;
 	}
 
-	if (!switch_strlen_zero(message)) {
+	if (!switch_strlen_zero(node->data)) {
 		syslog(syslog_level, "%s", node->data);
 	}
 
@@ -111,6 +111,9 @@
 {
 	char *cf = "syslog.conf";
 	switch_xml_t cfg, xml, settings, param;
+    
+    /* default log level */
+    log_level = SWITCH_LOG_WARNING;
 
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
@@ -124,7 +127,13 @@
 					set_global_ident(val);
 				} else if (!strcmp(var, "format")) {
 					set_global_format(val);
-				}
+                } else if (!strcasecmp(var, "loglevel") && !switch_strlen_zero(val)) {
+                    log_level = switch_log_str2level(val);
+                    if(log_level == SWITCH_LOG_INVALID)
+                    {
+                        log_level = SWITCH_LOG_WARNING;
+                    }
+                }
 
 			}
 		}
@@ -152,7 +161,8 @@
 
 	openlog(globals.ident, LOG_PID, LOG_USER);
 
-	switch_log_bind_logger(mod_syslog_logger, SWITCH_LOG_DEBUG);
+	setlogmask(LOG_UPTO(LOG_DEBUG));
+	switch_log_bind_logger(mod_syslog_logger, log_level, SWITCH_FALSE);
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -160,6 +170,7 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_syslog_shutdown)
 {
 	closelog();
+	switch_log_unbind_logger(mod_syslog_logger);
 
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_de/mod_say_de.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_de/mod_say_de.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_de/mod_say_de.c	Mon Aug  4 21:29:58 2008
@@ -544,5 +544,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_en/mod_say_en.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_en/mod_say_en.c	Mon Aug  4 21:29:58 2008
@@ -534,5 +534,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_es/mod_say_es.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_es/mod_say_es.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_es/mod_say_es.c	Mon Aug  4 21:29:58 2008
@@ -534,5 +534,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_fr/mod_say_fr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_fr/mod_say_fr.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_fr/mod_say_fr.c	Mon Aug  4 21:29:58 2008
@@ -534,5 +534,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_it/mod_say_it.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_it/mod_say_it.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_it/mod_say_it.c	Mon Aug  4 21:29:58 2008
@@ -534,5 +534,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_nl/mod_say_nl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_nl/mod_say_nl.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_nl/mod_say_nl.c	Mon Aug  4 21:29:58 2008
@@ -534,5 +534,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_zh/mod_say_zh.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_zh/mod_say_zh.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_zh/mod_say_zh.c	Mon Aug  4 21:29:58 2008
@@ -37,10 +37,13 @@
  *
  * Contributor(s):
  * 
+ * Anthony Minessale II <anthmct at yahoo.com>
  * PeteDao <petekay at gmail.com>
+ * Steve Underwood 0.0.1 <steveu at coppice.org>
  * 
  *
- * mod_say_zh.c -- Say for Mandarin
+ * mod_say_zh.c -- Say for Mandarin, Cantonese, and probably any other Chinese
+ *                 dialect.
  *
  */
 
@@ -48,6 +51,10 @@
 #include <math.h>
 #include <ctype.h>
 
+/*  SSM_COUNTED means ordinal number
+	SSM_PRONOUNCED
+    SSM_ITERATED */
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_say_zh_load);
 SWITCH_MODULE_DEFINITION(mod_say_zh, mod_say_zh_load, NULL, NULL);
 
@@ -57,7 +64,8 @@
 		switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num);				\
 	if ((tstatus = zh_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
 		return tstatus;\
-	}}\
+	}\
+}\
 
 #define say_file(...) {\
 		char tmp[80];\
@@ -68,7 +76,8 @@
 		}\
 		if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
 			return SWITCH_STATUS_FALSE;\
-		}}\
+		}\
+}\
 
 
 static switch_status_t zh_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
@@ -77,8 +86,8 @@
 
 	for (p = tosay; p && *p; p++) {
 		int a = tolower((int) *p);
-		if (a >= 48 && a <= 57) {
-			say_file("digits/%d.wav", a - 48);
+		if (a >= '0' && a <= '9') {
+			say_file("digits/%d.wav", a - '0');
 		} else {
 			if (type == SST_NAME_SPELLED) {
 				say_file("ascii/%d.wav", a);
@@ -91,46 +100,15 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args)
-{
-
-	if (a) {
-		say_file("digits/%d.wav", a);
-		say_file("digits/hundred.wav");
-	}
-
-	if (b) {
-		if (b > 1) {
-			say_file("digits/%d0.wav", b);
-		} else {
-			say_file("digits/%d%d.wav", b, c);
-			c = 0;
-		}
-	}
-
-	if (c) {
-		if (method == SSM_COUNTED) {
-			say_file("digits/h-%d.wav", c);
-		} else {
-			say_file("digits/%d.wav", c);
-		}
-	}
-
-	if (what && (a || b || c)) {
-		say_file(what);
-	}
-
-	return SWITCH_STATUS_SUCCESS;
-}
-
 static char *strip_commas(char *in, char *out, switch_size_t len)
 {
-	char *p = in, *q = out;
+	char *p = in;
+    char *q = out;
 	char *ret = out;
 	switch_size_t x = 0;
 
-	for (; p && *p; p++) {
-		if ((*p > 47 && *p < 58)) {
+	for ( ; p && *p; p++) {
+		if ((*p >= '0' && *p <= '9')) {
 			*q++ = *p;
 		} else if (*p != ',') {
 			ret = NULL;
@@ -148,12 +126,14 @@
 
 static char *strip_nonnumerics(char *in, char *out, switch_size_t len)
 {
-	char *p = in, *q = out;
+	char *p = in;
+    char *q = out;
 	char *ret = out;
 	switch_size_t x = 0;
-	// valid are 0 - 9, period (.), minus (-), and plus (+) - remove all others
+
+	/* valid are 0 - 9, period (.), minus (-), and plus (+) - remove all others */
 	for (; p && *p; p++) {
-		if ((*p > 47 && *p < 58) || *p == '.' || *p == '-' || *p == '+') {
+		if ((*p >= '0' && *p <= '9') || *p == '.' || *p == '-' || *p == '+') {
 			*q++ = *p;
 		}
 
@@ -170,10 +150,9 @@
 											char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
 {
 	int in;
-	int x = 0;
-	int places[9] = { 0 };
 	char sbuf[13] = "";
-	switch_status_t status;
+    char digits[11];
+    int i;
 
 	if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -183,29 +162,118 @@
 	in = atoi(tosay);
 
 	if (in != 0) {
-		for (x = 8; x >= 0; x--) {
-			int num = (int) pow(10, x);
-			if ((places[(uint32_t) x] = in / num)) {
-				in -= places[(uint32_t) x] * num;
-			}
-		}
-
+		snprintf(digits, sizeof(digits), "%10.10d", in);
 		switch (method) {
 		case SSM_COUNTED:
+			say_file("digits/ordinal.wav");
+			/* Fall through */
 		case SSM_PRONOUNCED:
-			if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
-				return status;
-			}
-			if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
-				return status;
-			}
-			if ((status = play_group(method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
-				return status;
-			}
+            for (i = 0;  i <= 9;  i++)
+            {
+                switch (i)
+                {
+                case 0:
+                    /* Billions column */
+                    if (digits[i] != '0')
+                    {
+                        if (digits[i] != '1')
+                    		say_file("digits/%c.wav", digits[i]);
+                  		say_file("digits/10.wav");
+                    }
+                    break;
+                case 1:
+                    /* Hundred millions columns */
+                    if (digits[i] != '0')
+                   		say_file("digits/%c.wav", digits[i]);
+                    if (memcmp (digits, "00", 2) != 0)
+                  		say_file("digits/100000000.wav");
+                    break;
+                case 2:
+                case 6:
+                    /* Ten millions or thousands column */
+                    if (digits[i] != '0')
+                    {
+                   		say_file("digits/%c.wav", digits[i]);
+                  		say_file("digits/1000.wav");
+                    }
+                    break;
+                case 3:
+                case 7:
+                    /* Millions or hundreds column */
+                    if (digits[i] != '0')
+                    {
+                   		say_file("digits/%c.wav", digits[i]);
+                   		say_file("digits/100.wav");
+                    }
+                    break;
+                case 4:
+                    /* Hundred thousands column */
+                    if (digits[i] != '0')
+                    {
+                        if (digits[i] != '1'
+                            ||
+                            memcmp (digits, "0000", 4) != 0)
+                        {
+                       		say_file("digits/%c.wav", digits[i]);
+                        }
+                    }
+                    else
+                    {
+                        if (digits[i + 1] != '0'
+                            &&
+                            memcmp (digits, "0000", 4) != 0)
+                        {
+                       		say_file("digits/%c.wav", digits[i]);
+                        }
+                    }
+                    if (digits[i] != '0')
+                   		say_file("digits/10.wav");
+                    break;
+        
+                case 5:
+                    /* Ten thousands column */
+                    if (digits[i] != '0')
+                    {
+                   		say_file("digits/%c.wav", digits[i]);
+                        if (memcmp (digits + 2, "0000", 4) != 0)
+                       		say_file("digits/10000.wav");
+                    }
+                    break;
+                case 8:
+                    /* Tens column */
+                    if (digits[i] != '0')
+                    {
+                        if (digits[i] != '1'
+                            ||
+                            memcmp (digits, "00000000", 8) != 0)
+                        {
+                       		say_file("digits/%c.wav", digits[i]);
+                        }
+                    }
+                    else
+                    {
+                        if (digits[9] != '0'
+                            &&
+                            memcmp (digits, "00000000", 8) != 0)
+                        {
+                       		say_file("digits/%c.wav", digits[i]);
+                        }
+                    }
+                    if (digits[8] != '0')
+                   		say_file("digits/10.wav");
+                    break;
+                case 9:
+                    /* Units column */
+                    if (digits[9] != '0')
+                   		say_file("digits/%c.wav", digits[i]);
+                    break;
+                }
+            }
 			break;
 		case SSM_ITERATED:
 			{
 				char *p;
+
 				for (p = tosay; p && *p; p++) {
 					say_file("digits/%c.wav", *p);
 				}
@@ -224,7 +292,11 @@
 
 static switch_status_t zh_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
 {
-	char *a, *b, *c, *d;
+	char *a;
+    char *b;
+    char *c;
+    char *d;
+
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	if (!(a = strdup(tosay))) {
 		return SWITCH_STATUS_FALSE;
@@ -259,19 +331,22 @@
 	say_file("digits/dot.wav");
 	say_num(atoi(d), method);
 
-  done:
+done:
 	switch_safe_free(a);
 	return status;
 }
 
-
-static switch_status_t zh_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
+static switch_status_t zh_say_time(switch_core_session_t *session,
+								   char *tosay,
+								   switch_say_type_t type,
+								   switch_say_method_t method,
 								   switch_input_args_t *args)
 {
 	int32_t t;
 	switch_time_t target = 0;
 	switch_time_exp_t tm;
-	uint8_t say_date = 0, say_time = 0;
+	uint8_t say_date = 0;
+    uint8_t say_time = 0;
 
 	if (type == SST_TIME_MEASUREMENT) {
 		int64_t hours = 0;
@@ -315,54 +390,54 @@
 		}
 
 		if (hours) {
-			say_num(hours, SSM_PRONOUNCED);
-			if (hours == 1) {
-				say_file("time/hour.wav");
-			} else {
-				say_file("time/hours.wav");
+			if (hours == 2) {
+				say_file("time/2s.wav");
+ 			} else {
+			    say_num(hours, SSM_PRONOUNCED);
 			}
-		} else {
-			say_file("digits/0.wav");
 			say_file("time/hours.wav");
 		}
-
 		if (minutes) {
-			say_num(minutes, SSM_PRONOUNCED);
-			if (minutes == 1) {
-				say_file("time/minute.wav");
-			} else {
-				say_file("time/minutes.wav");
+			if (minutes == 2) {
+				say_file("time/2s.wav");
+ 			} else {
+			    say_num(minutes, SSM_PRONOUNCED);
 			}
+			say_file("time/minute.wav");
 		} else {
-			say_file("digits/0.wav");
-			say_file("time/minutes.wav");
+			if (hours) {
+				say_file("digits/0.wav");
+				say_file("time/minute.wav");
+			}
 		}
 
 		if (seconds) {
-			say_num(seconds, SSM_PRONOUNCED);
-			if (seconds == 1) {
-				say_file("time/second.wav");
-			} else {
-				say_file("time/seconds.wav");
+			if (seconds == 2) {
+				say_file("time/2s.wav");
+ 			} else {
+			    say_num(hours, SSM_PRONOUNCED);
 			}
-		} else {
-			say_file("digits/0.wav");
 			say_file("time/seconds.wav");
+		} else {
+			if (hours  ||  minutes) {
+				say_file("digits/0.wav");
+				say_file("time/seconds.wav");
+			}
 		}
 
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	if ((t = atoi(tosay)) > 0) {
+	if ((t = atoi(tosay)) > 0)
 		target = switch_time_make(t, 0);
-	} else {
+	else
 		target = switch_timestamp_now();
-	}
 	switch_time_exp_lt(&tm, target);
 
 	switch (type) {
 	case SST_CURRENT_DATE_TIME:
-		say_date = say_time = 1;
+		say_date =
+		say_time = 1;
 		break;
 	case SST_CURRENT_DATE:
 		say_date = 1;
@@ -375,43 +450,48 @@
 	}
 
 	if (say_date) {
+        say_num(tm.tm_year + 1900, SSM_ITERATED);
+		say_file("time/year.wav");
+		say_num(tm.tm_mon + 1, SSM_PRONOUNCED);
+		say_file("time/month.wav");
+		say_num(tm.tm_mday, SSM_PRONOUNCED);
+		say_file("time/day.wav");
 		say_file("time/day-%d.wav", tm.tm_wday);
-		say_file("time/mon-%d.wav", tm.tm_mon);
-		say_num(tm.tm_mday, SSM_COUNTED);
-		say_num(tm.tm_year + 1900, SSM_PRONOUNCED);
 	}
 
 	if (say_time) {
-		int32_t hour = tm.tm_hour, pm = 0;
+		int32_t hour = tm.tm_hour;
 
-		if (hour > 12) {
+		if (hour < 6) {
+            say_file("time/morning.wav");
+		} else if (hour < 12) {
+            say_file("time/a-m.wav");
+		} else if (tm.tm_hour < 18) {
+            say_file("time/p-m.wav");
+		} else {
+            say_file("time/evening.wav");
+		}
+		if (hour > 12)
 			hour -= 12;
-			pm = 1;
-		} else if (hour == 12) {
-			pm = 1;
-		} else if (hour == 0) {
+		if (hour == 0)
 			hour = 12;
-			pm = 0;
-		}
 
-		say_num(hour, SSM_PRONOUNCED);
-
-		if (tm.tm_min > 9) {
-			say_num(tm.tm_min, SSM_PRONOUNCED);
-		} else if (tm.tm_min) {
-			say_file("time/oh.wav");
-			say_num(tm.tm_min, SSM_PRONOUNCED);
+		if (hour == 2) {
+			say_file("time/2s.wav");
 		} else {
-			say_file("time/oclock.wav");
+			say_num(hour, SSM_PRONOUNCED);
 		}
-
-		say_file("time/%s.wav", pm ? "p-m" : "a-m");
+		say_file("time/hour.wav");
+		if (tm.tm_min == 2) {
+			say_file("time/2s.wav");
+		} else {
+			say_num(tm.tm_min, SSM_PRONOUNCED);
+		}
+		say_file("time/minute.wav");  
 	}
-
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
 static switch_status_t zh_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
 									switch_input_args_t *args)
 {
@@ -446,36 +526,21 @@
 
 	/* Say dollar amount */
 	zh_say_general_count(session, dollars, type, method, args);
-	if (atoi(dollars) == 1) {
-		say_file("currency/dollar.wav");
-	} else {
-		say_file("currency/dollars.wav");
-	}
-
-	/* Say "and" */
-	say_file("currency/and.wav");
+	say_file("currency/dollar.wav");
 
 	/* Say cents */
 	if (cents) {
 		zh_say_general_count(session, cents, type, method, args);
-		if (atoi(cents) == 1) {
-			say_file("currency/cent.wav");
-		} else {
-			say_file("currency/cents.wav");
-		}
 	} else {
 		say_file("digits/0.wav");
-		say_file("currency/cents.wav");
 	}
+	say_file("currency/cent.wav");
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
-
 static switch_status_t zh_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
 {
-
 	switch_say_callback_t say_cb = NULL;
 
 	switch (type) {

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	Mon Aug  4 21:29:58 2008
@@ -23,7 +23,7 @@
  *
  * Contributor(s):
  * 
- * Brian West <brian.west at mac.com>
+ * Brian West <brian at freeswitch.org>
  * Bret McDanel <trixter AT 0xdecafbad.com>
  * Justin Cassidy <xachenant at hotmail.com>
  *
@@ -350,5 +350,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	Mon Aug  4 21:29:58 2008
@@ -44,7 +44,6 @@
 	int disable100continue;
 	uint32_t ignore_cacert_check;
 	switch_hash_t *vars_map;
-	switch_memory_pool_t *vars_map_pool;
 };
 
 static int keep_files_around = 0;
@@ -56,6 +55,17 @@
 	int fd;
 };
 
+typedef struct hash_node {
+    switch_hash_t* hash;
+    struct hash_node* next;
+} hash_node_t;
+
+static struct {
+    switch_memory_pool_t* pool;
+    hash_node_t* hash_root;
+    hash_node_t* hash_tail;
+} globals;
+
 #define XML_CURL_SYNTAX "[debug_on|debug_off]"
 SWITCH_STANDARD_API(xml_curl_function)
 {
@@ -212,7 +222,6 @@
 	int x = 0;
 	int need_vars_map = 0;
 	switch_hash_t *vars_map = NULL;
-	switch_memory_pool_t *vars_map_pool = NULL;
 
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
@@ -231,6 +240,9 @@
 		char *bind_mask = NULL;
 		int disable100continue = 0;
 		uint32_t ignore_cacert_check = 0;
+		hash_node_t* hash_node;
+		need_vars_map = 0;
+		vars_map = NULL;
 
 		for (param = switch_xml_child(binding_tag, "param"); param; param = param->next) {
 			char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -248,15 +260,8 @@
 				ignore_cacert_check = 1;
 			} else if (!strcasecmp(var, "enable-post-var")) {
 				if (!vars_map && need_vars_map == 0) {
-					if (switch_core_new_memory_pool(&vars_map_pool) != SWITCH_STATUS_SUCCESS) {
-						need_vars_map = -1;
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant create memory pool!\n");
-						continue;
-					}
-
-					if (switch_core_hash_init(&vars_map, vars_map_pool) != SWITCH_STATUS_SUCCESS) {
+					if (switch_core_hash_init(&vars_map, globals.pool) != SWITCH_STATUS_SUCCESS) {
 						need_vars_map = -1;
-						switch_core_destroy_memory_pool(&vars_map_pool);
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant init params hash!\n");
 						continue;
 					}
@@ -267,16 +272,19 @@
 					if (switch_core_hash_insert(vars_map, val, ENABLE_PARAM_VALUE) != SWITCH_STATUS_SUCCESS) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant add %s to params hash!\n", val);
 					}
-
 			}
 		}
 
 		if (!url) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Binding has no url!\n");
+			if (vars_map)
+			    switch_core_hash_destroy(&vars_map);
 			continue;
 		}
 
 		if (!(binding = malloc(sizeof(*binding)))) {
+			if (vars_map)
+			    switch_core_hash_destroy(&vars_map);
 			goto done;
 		}
 		memset(binding, 0, sizeof(*binding));
@@ -295,7 +303,23 @@
 		binding->ignore_cacert_check = ignore_cacert_check;
 
 		binding->vars_map = vars_map;
-		binding->vars_map_pool = vars_map_pool;
+		
+		if(vars_map) {
+		    switch_zmalloc(hash_node,sizeof(hash_node_t));
+		    hash_node->hash = vars_map;
+		    hash_node->next = NULL;
+		    
+		    if(!globals.hash_root) {
+			globals.hash_root = hash_node;
+			globals.hash_tail = globals.hash_root;
+		    }
+		    
+		    else {
+			globals.hash_tail->next = hash_node;
+			globals.hash_tail = globals.hash_tail->next;
+		    }
+			
+		}
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
 						  switch_strlen_zero(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all");
@@ -318,6 +342,13 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	SWITCH_ADD_API(xml_curl_api_interface, "xml_curl", "XML Curl", xml_curl_function, XML_CURL_SYNTAX);
+	switch_console_set_complete("add xml_curl debug_on");
+	switch_console_set_complete("add xml_curl debug_off");
+
+	memset(&globals,0,sizeof(globals));
+	globals.pool = pool;
+	globals.hash_root = NULL;
+	globals.hash_tail = NULL;
 
 	if (do_config() == SWITCH_STATUS_SUCCESS) {
 		curl_global_init(CURL_GLOBAL_ALL);
@@ -331,6 +362,16 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_curl_shutdown)
 {
+	hash_node_t* ptr = NULL;
+
+	while(globals.hash_root) {
+	    ptr = globals.hash_root;
+	    switch_core_hash_destroy(&ptr->hash);
+	    globals.hash_root = ptr->next;
+	    switch_safe_free(ptr);
+	}
+	
+	switch_xml_unbind_search_function_ptr(xml_url_fetch);
 	curl_global_cleanup();
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -343,5 +384,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/Makefile	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/Makefile	Mon Aug  4 21:29:58 2008
@@ -5,13 +5,14 @@
 
 LDAPLA=$(LDAP_DIR)/libraries/libldap_r/libldap_r.la
 LIBLBERLA=$(LDAP_DIR)/libraries/liblber/liblber.la
+LIBLUTILA=$(LDAP_DIR)/libraries/liblutil/liblutil.a
 
 LOCAL_CFLAGS=-DWITH_OPENLDAP -DLDAP_DEPRECATED -I$(LDAP_DIR)/include
 
 DEFAULT_ARGS= --prefix=$(PREFIX) --disable-shared --with-pic --disable-slapd
 DEFAULT_ARGS+= --disable-slurpd --disable-relay --disable-bdb --disable-hdb
 
-LOCAL_LIBADD=$(LDAPLA) $(LIBLBERLA)
+LOCAL_LIBADD=$(LDAPLA) $(LIBLBERLA) $(LIBLUTILA)
 
 include $(switch_srcdir)/build/modmake.rules
 
@@ -19,6 +20,6 @@
 	$(GETLIB) $(LDAP).tgz
 	cd $(LDAP_DIR) && CFLAGS="`echo $(CFLAGS) | sed -e 's:-std=c99::'`" ./configure $(DEFAULT_ARGS)
 
-$(LDAPLA) $(LIBLBERLA): $(LDAP_DIR)
+$(LIBLUTILA) $(LDAPLA) $(LIBLBERLA): $(LDAP_DIR)
 	cd $(LDAP_DIR) && $(MAKE)
 	$(TOUCH_TARGET)

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c	Mon Aug  4 21:29:58 2008
@@ -42,6 +42,8 @@
 #else
 #include <lber.h>
 #include <ldap.h>
+#include <sasl/sasl.h>
+#include "lutil_ldap.h"
 #endif
 
 typedef enum {
@@ -55,18 +57,18 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_ldap_shutdown);
 SWITCH_MODULE_DEFINITION(mod_xml_ldap, mod_xml_ldap_load, mod_xml_ldap_shutdown, NULL);
 
-struct xml_binding {
+typedef struct xml_binding {
 	char *bindings;
 	char *host;
-	char *ldap_base;
+	char *basedn;
 	char *binddn;
 	char *bindpass;
-	char *queryfmt;
-};
+	char *filter;
+	char **attrs;
+	lutilSASLdefaults *defaults;
+} xml_binding_t;
 
-typedef struct xml_binding xml_binding_t;
-
-struct ldap_c {
+typedef struct ldap_c {
 	LDAP *ld;
 	LDAPMessage *msg;
 	LDAPMessage *entry;
@@ -76,8 +78,8 @@
 	char *val;
 	char **keyvals;
 	char **valvals;
-
-};
+	char *sp;
+} ldap_ctx;
 
 static switch_status_t xml_ldap_directory_result(void *ldap_connection, xml_binding_t *binding, switch_xml_t *xml, int *off);
 static switch_status_t xml_ldap_dialplan_result(void *ldap_connection, xml_binding_t *binding, switch_xml_t *xml, int *off);
@@ -223,10 +225,12 @@
 	int desired_version = LDAP_VERSION3;
 	xml_ldap_query_type_t query_type;
 	char *dir_exten = NULL, *dir_domain = NULL;
-	char *filter = "(objectClass=*)";
 
-	char *search_base = NULL;
-	int off = 0;
+	char *search_filter = NULL, *search_base = NULL;
+	int off = 0, ret = 1;
+
+	//char *buf;
+	//buf = malloc(4096);
 
 
 	if (!binding) {
@@ -287,15 +291,18 @@
 						if ((sub = switch_xml_add_child_d(sub, "user", off++))) {
 							switch_xml_set_attr_d(sub, "id", dir_exten);
 						}
+
 					}
 
-					search_base = switch_mprintf(binding->queryfmt, dir_exten, dir_domain, binding->ldap_base);
+					search_filter = switch_mprintf(binding->filter, dir_exten);
+					search_base = switch_mprintf(binding->basedn, dir_domain);
 
 					free(dir_exten);
 					dir_exten = NULL;
 
 					free(dir_domain);
 					dir_domain = NULL;
+
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
 									  "something bad happened during the query construction phase likely exten(%s) or domain(%s) is null\n", dir_exten,
@@ -314,7 +321,7 @@
 
 					sub = switch_xml_add_child_d(xml, "context", off++);
 				}
-				search_base = switch_mprintf(binding->queryfmt, dir_exten, dir_domain, binding->ldap_base);
+
 				break;
 
 			case XML_LDAP_PHRASE:
@@ -327,7 +334,7 @@
 
 
 
-	if ((ldap->ld = ldap_init(binding->host, LDAP_PORT)) == NULL) {
+	if ((ldap->ld = (LDAP*)ldap_init(binding->host, LDAP_PORT)) == NULL) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to connect to ldap server.%s\n", binding->host);
 		goto cleanup;
 	}
@@ -336,12 +343,24 @@
 		goto cleanup;
 	}
 
-	if (ldap_bind_s(ldap->ld, binding->binddn, binding->bindpass, auth_method) != LDAP_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to bind to ldap server %s as %s\n", binding->host, binding->binddn);
-		goto cleanup;
+	ldap_set_option( ldap->ld, LDAP_OPT_X_SASL_SECPROPS, &ldap->sp );
+
+
+
+	if (binding->binddn) {
+		if (ldap_bind_s(ldap->ld, binding->binddn, binding->bindpass, auth_method) != LDAP_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to bind to ldap server %s as %s\n", binding->host, binding->binddn);
+			goto cleanup;
+		}
+	} else {
+		if (ldap_sasl_interactive_bind_s( ldap->ld, NULL, binding->defaults->mech, NULL, NULL,(unsigned)LDAP_SASL_SIMPLE, lutil_sasl_interact , binding->defaults ) != LDAP_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to sasl_bind to ldap server %s as %s\n", binding->host, binding->defaults->authcid);
+			goto cleanup;
+		}
 	}
 
-	if (ldap_search_s(ldap->ld, search_base, LDAP_SCOPE_SUBTREE, filter, NULL, 0, &ldap->msg) != LDAP_SUCCESS) {
+	if (ldap_search_s(ldap->ld, search_base, LDAP_SCOPE_SUBTREE, search_filter, NULL, 0, &ldap->msg) != LDAP_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Query failed: -b \"%s\" \"%s\"\n", search_base, search_filter);
 		goto cleanup;
 	}
 
@@ -353,6 +372,8 @@
 		goto cleanup;
 	}
 
+	ret = 0;
+
   cleanup:
 	if (ldap->msg) {
 		ldap_msgfree(ldap->msg);
@@ -362,8 +383,17 @@
 		ldap_unbind_s(ldap->ld);
 	}
 
+	switch_safe_free(search_filter);
 	switch_safe_free(search_base);
 
+	//switch_xml_toxml_buf(xml,buf,0,0,1);
+	//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "providing:\n%s\n", buf);
+
+	if(ret) {
+		switch_xml_free(xml);
+		return NULL;
+	}
+
 	return xml;
 }
 
@@ -393,35 +423,50 @@
 		}
 		memset(binding, 0, sizeof(*binding));
 
+		if (!(binding->defaults = malloc(sizeof(lutilSASLdefaults)))) {
+			goto done;
+		}
+		memset(binding->defaults, 0, sizeof(lutilSASLdefaults));
+
 		for (param = switch_xml_child(binding_tag, "param"); param; param = param->next) {
 
 			char *var = (char *) switch_xml_attr_soft(param, "name");
 			char *val = (char *) switch_xml_attr_soft(param, "value");
 
-			if (!strcasecmp(var, "queryfmt")) {
+			if (!strcasecmp(var, "filter")) {
 				binding->bindings = (char *) switch_xml_attr_soft(param, "bindings");
 				if (val) {
-					binding->queryfmt = strdup(val);
+					binding->filter = strdup(val);
 				}
-			} else if (!strcasecmp(var, "base")) {
-				binding->ldap_base = strdup(val);
+			} else if (!strcasecmp(var, "basedn")) {
+				binding->basedn = strdup(val);
 			} else if (!strcasecmp(var, "binddn")) {
 				binding->binddn = strdup(val);
 			} else if (!strcasecmp(var, "bindpass")) {
 				binding->bindpass = strdup(val);
 			} else if (!strcasecmp(var, "host")) {
 				binding->host = strdup(val);
+			} else if (!strcasecmp(var, "mech")) {
+				binding->defaults->mech = strdup(val);
+			} else if (!strcasecmp(var, "realm")) {
+				binding->defaults->realm = strdup(val);
+			} else if (!strcasecmp(var, "authcid")) {
+				binding->defaults->authcid = strdup(val);
+			} else if (!strcasecmp(var, "authzid")) {
+				binding->defaults->authzid = strdup(val);
 			}
+
 		}
 
-		if (!binding->ldap_base || !binding->binddn || !binding->bindpass || !binding->queryfmt) {
+		if (!binding->basedn || !binding->filter) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-							  "You must define \"base\", \"binddn\", \"bindpass\", and \"queryfmt\" in mod_xml_ldap.conf.xml\n");
+							  "You must define \"basedn\", and \"filter\" in mod_xml_ldap.conf.xml\n");
 			continue;
 		}
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
-						  switch_strlen_zero(bname) ? "N/A" : bname, binding->ldap_base, binding->bindings ? binding->bindings : "all");
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] (%s) [%s]\n",
+						  switch_strlen_zero(bname) ? "N/A" : bname, binding->basedn, binding->filter, binding->bindings ? binding->bindings : "all");
 
 		switch_xml_bind_search_function(xml_ldap_search, switch_xml_parse_section_string(bname), binding);
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	Mon Aug  4 21:29:58 2008
@@ -835,5 +835,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c	Mon Aug  4 21:29:58 2008
@@ -179,6 +179,8 @@
 	/* update the service status */
 	SetServiceStatus(hStatus, &status);
 
+	switch_core_set_globals();
+
 	/* attempt to initialize freeswitch and load modules */
 	if (switch_core_init_and_modload(flags, SWITCH_FALSE, &err) != SWITCH_STATUS_SUCCESS) {
 		/* freeswitch did not start sucessfully */
@@ -567,5 +569,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_apr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_apr.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_apr.c	Mon Aug  4 21:29:58 2008
@@ -230,6 +230,11 @@
 	return apr_time_exp_lt((apr_time_exp_t *) result, input);
 }
 
+SWITCH_DECLARE(switch_status_t) switch_time_exp_tz(switch_time_exp_t *result, switch_time_t input, switch_int32_t offs)
+{
+	return apr_time_exp_tz((apr_time_exp_t *) result, input, (apr_int32_t )offs);
+}
+
 SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input)
 {
 	return apr_time_exp_gmt((apr_time_exp_t *) result, input);
@@ -294,6 +299,15 @@
 	return rv;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_file_copy(const char *from_path, 
+												 const char *to_path,
+												 switch_fileperms_t perms,
+												 switch_memory_pool_t *pool)
+{
+	return apr_file_copy(from_path, to_path, perms, pool);
+}
+
+
 SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile)
 {
 	return apr_file_close(thefile);
@@ -564,9 +578,10 @@
 	switch_size_t req = *len, wrote = 0, need = *len;
 	int to_count = 0;
 
-	while ((wrote < req && status == SWITCH_STATUS_SUCCESS) || (need == 0 && status == SWITCH_STATUS_BREAK)) {
+	while ((wrote < req && status == SWITCH_STATUS_SUCCESS) || (need == 0 && status == SWITCH_STATUS_BREAK) || status == 730035) {
 		need = req - wrote;
-		if ((status = apr_socket_send(sock, buf + wrote, &need)) == SWITCH_STATUS_BREAK) {
+		status = apr_socket_send(sock, buf + wrote, &need);
+		if (status == SWITCH_STATUS_BREAK || status == 730035) {
 			if (++to_count > 10000) {
 				status = SWITCH_STATUS_FALSE;
 				break;
@@ -629,7 +644,7 @@
 	if (!in) {
 		return "";
 	}
-	return get_addr(buf, len, &in->sa.sin.sin_addr);
+	return get_addr(buf, len, (struct sockaddr*)&in->sa, in->salen);
 }
 
 SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa)
@@ -818,5 +833,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_buffer.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_buffer.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_buffer.c	Mon Aug  4 21:29:58 2008
@@ -229,6 +229,7 @@
 	if (switch_test_flag(buffer, SWITCH_BUFFER_FLAG_DYNAMIC)) {
 		if (freespace < datalen && (!buffer->max_len || (buffer->used + datalen <= buffer->max_len))) {
 			switch_size_t new_size, new_block_size;
+			void *tmp;
 
 			new_size = buffer->datalen + datalen;
 			new_block_size = buffer->datalen + buffer->blocksize;
@@ -237,9 +238,10 @@
 				new_size = new_block_size;
 			}
 			buffer->head = buffer->data;
-			if (!(buffer->data = realloc(buffer->data, new_size))) {
+			if (!(tmp = realloc(buffer->data, new_size))) {
 				return 0;
 			}
+			buffer->data = tmp;
 			buffer->head = buffer->data;
 			buffer->datalen = new_size;
 		}
@@ -297,5 +299,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_caller.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_caller.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_caller.c	Mon Aug  4 21:29:58 2008
@@ -56,6 +56,14 @@
 		context = "default";
 	}
 
+	if (switch_strlen_zero(caller_id_name)) {
+		caller_id_name = "FreeSWITCH";
+	}
+
+	if (switch_strlen_zero(caller_id_number)) {
+		caller_id_number = "0000000000";
+	}
+
 	profile_dup_clean(username, profile->username, pool);
 	profile_dup_clean(dialplan, profile->dialplan, pool);
 	profile_dup_clean(caller_id_name, profile->caller_id_name, pool);
@@ -319,5 +327,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c	Mon Aug  4 21:29:58 2008
@@ -40,8 +40,8 @@
 };
 
 static struct switch_cause_table CAUSE_CHART[] = {
-	{"UNALLOCATED", SWITCH_CAUSE_UNALLOCATED},
-	{"SUCCESS", SWITCH_CAUSE_SUCCESS},
+	{"NONE", SWITCH_CAUSE_NONE},
+	{"UNALLOCATED_NUMBER", SWITCH_CAUSE_UNALLOCATED_NUMBER},
 	{"NO_ROUTE_TRANSIT_NET", SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET},
 	{"NO_ROUTE_DESTINATION", SWITCH_CAUSE_NO_ROUTE_DESTINATION},
 	{"CHANNEL_UNACCEPTABLE", SWITCH_CAUSE_CHANNEL_UNACCEPTABLE},
@@ -89,6 +89,7 @@
 	{"MANDATORY_IE_LENGTH_ERROR", SWITCH_CAUSE_MANDATORY_IE_LENGTH_ERROR},
 	{"PROTOCOL_ERROR", SWITCH_CAUSE_PROTOCOL_ERROR},
 	{"INTERWORKING", SWITCH_CAUSE_INTERWORKING},
+	{"SUCCESS", SWITCH_CAUSE_SUCCESS},
 	{"ORIGINATOR_CANCEL", SWITCH_CAUSE_ORIGINATOR_CANCEL},
 	{"CRASH", SWITCH_CAUSE_CRASH},
 	{"SYSTEM_SHUTDOWN", SWITCH_CAUSE_SYSTEM_SHUTDOWN},
@@ -143,7 +144,7 @@
 SWITCH_DECLARE(switch_call_cause_t) switch_channel_str2cause(const char *str)
 {
 	uint8_t x;
-	switch_call_cause_t cause = SWITCH_CAUSE_UNALLOCATED;
+	switch_call_cause_t cause = SWITCH_CAUSE_NONE;
 
 	if (*str > 47 && *str < 58) {
 		cause = atoi(str);
@@ -192,7 +193,7 @@
 	switch_mutex_init(&(*channel)->dtmf_mutex, SWITCH_MUTEX_NESTED, pool);
 	switch_mutex_init(&(*channel)->flag_mutex, SWITCH_MUTEX_NESTED, pool);
 	switch_mutex_init(&(*channel)->profile_mutex, SWITCH_MUTEX_NESTED, pool);
-	(*channel)->hangup_cause = SWITCH_CAUSE_UNALLOCATED;
+	(*channel)->hangup_cause = SWITCH_CAUSE_NONE;
 	(*channel)->name = "";
 
 	return SWITCH_STATUS_SUCCESS;
@@ -1369,6 +1370,9 @@
 
 SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready(switch_channel_t *channel, const char *file, const char *func, int line)
 {
+	const char *var;
+	char *app;
+
 	if (!switch_channel_test_flag(channel, CF_RING_READY)) {
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
 		switch_channel_set_flag(channel, CF_RING_READY);
@@ -1377,6 +1381,18 @@
 			channel->caller_profile->times->progress = switch_timestamp_now();
 			switch_mutex_unlock(channel->profile_mutex);
 		}
+
+		var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE);
+		if (var) {
+			char *arg = NULL;
+			app = switch_core_session_strdup(channel->session, var);
+			if ((arg = strchr(app, ' '))) {
+				*arg++ = '\0';
+			}
+			switch_core_session_execute_application(channel->session, app, arg);
+		}
+
+
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -1490,6 +1506,8 @@
 	switch_event_t *event;
 	const char *uuid;
 	switch_core_session_t *other_session;
+	const char *var;
+	char *app;
 
 	switch_assert(channel != NULL);
 
@@ -1525,7 +1543,17 @@
 
 	switch_channel_set_variable(channel, "endpoint_disposition", "ANSWER");
 	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
+	if ((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE))) {
+		char *arg = NULL;
+
+		app = switch_core_session_strdup(channel->session, var);
+
+		if ((arg = strchr(app, ' '))) {
+			*arg++ = '\0';
+		}
 
+		switch_core_session_execute_application(channel->session, app, arg);
+	}
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1549,17 +1577,7 @@
 	status = switch_core_session_receive_message(channel->session, &msg);
 
 	if (status == SWITCH_STATUS_SUCCESS) {
-		const char *var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE);
-		char *app;
 		switch_channel_perform_mark_answered(channel, file, func, line);
-		if (var) {
-			char *arg = NULL;
-			app = switch_core_session_strdup(channel->session, var);
-			if ((arg = strchr(app, ' '))) {
-				*arg++ = '\0';
-			}
-			switch_core_session_execute_application(channel->session, app, arg);
-		}
 	} else {
 		switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
 	}
@@ -1582,8 +1600,8 @@
 	char *p, *c = NULL;
 	char *data, *indup;
 	size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128;
-	const char *q, *sub_val = NULL;
-	char *cloned_sub_val = NULL;
+	const char *q;
+	char *cloned_sub_val = NULL, *sub_val = NULL;
 	char *func_val = NULL;
 	int nv = 0;
 
@@ -1726,7 +1744,7 @@
 						}
 					}
 
-					if ((sub_val = switch_channel_get_variable(channel, vname))) {
+					if ((sub_val = (char *) switch_channel_get_variable(channel, vname))) {
 						if (offset || ooffset) {
 							cloned_sub_val = strdup(sub_val);
 							switch_assert(cloned_sub_val);
@@ -1734,7 +1752,11 @@
 						}
 
 						if (offset >= 0) {
-							sub_val += offset;
+							if ((size_t)offset > strlen(sub_val)) {
+								*sub_val = '\0';
+							} else {
+								sub_val += offset;
+							}
 						} else if ((size_t) abs(offset) <= strlen(sub_val)) {
 							sub_val = cloned_sub_val + (strlen(cloned_sub_val) + offset);
 						}
@@ -1929,6 +1951,15 @@
 	return stream.data;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event)
+{
+	switch_status_t status;
+	switch_mutex_lock(channel->profile_mutex);
+	status = switch_event_dup(event, channel->variables);
+	switch_mutex_lock(channel->profile_mutex);
+	return status;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *channel)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -2131,5 +2162,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c	Mon Aug  4 21:29:58 2008
@@ -206,5 +206,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c	Mon Aug  4 21:29:58 2008
@@ -407,8 +407,13 @@
 	switch_memory_pool_t *pool = (switch_memory_pool_t *) obj;
 
 	while (running) {
-		int32_t arg;
+		int32_t arg = 0;
 
+		if (getppid() == 1) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "We've become an orphan, no more console for us.\n");
+			break;
+		}
+		
 		switch_core_session_ctl(SCSC_CHECK_RUNNING, &arg);
 		if (!arg) {
 			break;
@@ -437,6 +442,7 @@
 	}
 
 	switch_core_destroy_memory_pool(&pool);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Editline thread exiting\n");
 	return NULL;
 }
 
@@ -461,12 +467,14 @@
 		return -1;
 	}
 
-	fprintf(h->out, "%20s\t", target);
+	fprintf(h->out, "[%20s]\t", target);
 
 	switch_copy_string(h->last, target, sizeof(h->last));
 
-	if ((++h->hits % 4) == 0) {
-		fprintf(h->out, "\n");
+	if (!switch_strlen_zero(target)) {
+		if ((++h->hits % 4) == 0) {
+			fprintf(h->out, "\n");
+		}
 	}
 
 	return 0;
@@ -681,7 +689,6 @@
 
 }
 
-
 SWITCH_DECLARE(void) switch_console_loop(void)
 {
 	switch_thread_t *thread;
@@ -862,5 +869,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c	Mon Aug  4 21:29:58 2008
@@ -44,6 +44,7 @@
 
 /* The main runtime obj we keep this hidden for ourselves */
 struct switch_runtime runtime;
+static void switch_load_core_config(const char *file);
 
 static void send_heartbeat(void)
 {
@@ -75,9 +76,55 @@
 	}
 }
 
+static char main_ip4[256] = "";
+static char main_ip6[256] = "";
+
+static void check_ip(void) {
+	char guess_ip4[256] = "";
+	char guess_ip6[256] = "";
+	int ok4 = 1, ok6 = 1;
+	
+	switch_find_local_ip(guess_ip4, sizeof(guess_ip4), AF_INET);
+	switch_find_local_ip(guess_ip6, sizeof(guess_ip6), AF_INET6);
+
+	if (!*main_ip4) {
+		switch_set_string(main_ip4, guess_ip4);
+	} else {
+		if (!(ok4 = !strcmp(main_ip4, guess_ip4))) {
+			switch_set_string(main_ip4, guess_ip4);
+			switch_core_set_variable("local_ip_v4", guess_ip4);
+		}
+	}
+
+	if (!*main_ip6) {
+		switch_set_string(main_ip6, guess_ip6);
+	} else {
+		if (!(ok6 = !strcmp(main_ip6, guess_ip6))) {
+			switch_set_string(main_ip6, guess_ip6);
+			switch_core_set_variable("local_ip_v4", guess_ip6);
+		}
+	}
+	
+	if (!ok4 || !ok6) {
+		switch_event_t *event;
+
+		if (switch_event_create(&event, SWITCH_EVENT_TRAP) == SWITCH_STATUS_SUCCESS) {
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "condition", "network-address-change");
+			if (!ok4) {
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "network-address-change-v4", "%s", main_ip4);
+			}
+			if (!ok6) {
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "network-address-change-v6", "%s", main_ip6);
+			}
+			switch_event_fire(&event);
+		}
+	}
+}
+
 SWITCH_STANDARD_SCHED_FUNC(heartbeat_callback)
 {
 	send_heartbeat();
+	check_ip();
 
 	/* reschedule this task */
 	task->runtime = switch_timestamp(NULL) + 20;
@@ -138,6 +185,22 @@
 	return runtime.state_handlers[index];
 }
 
+SWITCH_DECLARE(void) switch_core_dump_variables(switch_stream_handle_t *stream)
+{
+	switch_hash_index_t *hi;
+	const void *var;
+	void *val;
+	switch_mutex_lock(runtime.global_mutex);
+	for (hi = switch_hash_first(NULL, runtime.global_vars); hi; hi = switch_hash_next(hi)) {
+		char *vvar, *vval;
+		switch_hash_this(hi, &var, NULL, &val);
+		vvar = (char *) var;
+		vval = (char *) val;
+		stream->write_function(stream, "%s=%s\n", vvar, vval);
+	}
+	switch_mutex_unlock(runtime.global_mutex);
+}
+
 SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname)
 {
 	char *val;
@@ -268,7 +331,6 @@
 
 SWITCH_DECLARE(void) switch_core_set_globals(void)
 {
-	char *dir_path;
 #define BUFSIZE 1024
 #ifdef WIN32
 	char lpPathBuffer[BUFSIZE];
@@ -363,12 +425,6 @@
 #endif
 	}
 
-	dir_path = switch_mprintf("%s%ssounds", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
-	switch_dir_make_recursive(dir_path,
-							  SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE,
-							  runtime.memory_pool);
-	switch_safe_free(dir_path);
-
 	switch_assert(SWITCH_GLOBAL_dirs.base_dir);
 	switch_assert(SWITCH_GLOBAL_dirs.mod_dir);
 	switch_assert(SWITCH_GLOBAL_dirs.conf_dir);
@@ -378,16 +434,6 @@
 	switch_assert(SWITCH_GLOBAL_dirs.htdocs_dir);
 	switch_assert(SWITCH_GLOBAL_dirs.grammar_dir);
 	switch_assert(SWITCH_GLOBAL_dirs.temp_dir);
-
-	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.base_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
-	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.mod_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
-	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.conf_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
-	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.log_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
-	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.db_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
-	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.script_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
-	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.htdocs_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
-	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
-	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.temp_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
 }
 
 SWITCH_DECLARE(int32_t) set_high_priority(void)
@@ -623,11 +669,11 @@
 	mime_path = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.conf_dir, cf);
 	switch_assert(mime_path);
 
-	fd = open(mime_path, O_RDONLY);
+	fd = open(mime_path, O_RDONLY | O_BINARY);
 	if (fd <= 0) {
-		return;
+		goto end;
 	}
-
+	
 	while ((switch_fd_read_line(fd, line_buf, sizeof(line_buf)))) {
 		char *p;
 		char *type = line_buf;
@@ -656,6 +702,11 @@
 		close(fd);
 		fd = -1;
 	}
+
+ end:
+
+	switch_safe_free(mime_path);
+
 }
 
 SWITCH_DECLARE(void) switch_core_setrlimits(void)
@@ -703,7 +754,7 @@
 
 static switch_ip_list_t IP_LIST = { 0 };
 
-SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip(const char *ip_str, const char *list_name)
+SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip_token(const char *ip_str, const char *list_name, const char **token)
 {
 	switch_network_list_t *list;
 	uint32_t ip, net, mask, bits;
@@ -712,8 +763,10 @@
 	switch_mutex_lock(runtime.global_mutex);
 	switch_inet_pton(AF_INET, ip_str, &ip);
 
+	ip = htonl(ip);
+
 	if ((list = switch_core_hash_find(IP_LIST.hash, list_name))) {
-		ok = switch_network_list_validate_ip(list, ip);
+		ok = switch_network_list_validate_ip_token(list, ip, token);
 	} else if (strchr(list_name, '/')) {
 		switch_parse_cidr(list_name, &net, &mask, &bits);
 		ok = switch_test_subnet(ip, net, mask);
@@ -771,7 +824,7 @@
 
 
 				for (x_node = switch_xml_child(x_list, "node"); x_node; x_node = x_node->next) {
-					const char *cidr = NULL, *host = NULL, *mask = NULL;
+					const char *cidr = NULL, *host = NULL, *mask = NULL, *domain = NULL;
 					switch_bool_t ok = default_type;
 					const char *type = switch_xml_attr(x_node, "type");
 
@@ -782,35 +835,58 @@
 					cidr = switch_xml_attr(x_node, "cidr");
 					host = switch_xml_attr(x_node, "host");
 					mask = switch_xml_attr(x_node, "mask");
+					domain = switch_xml_attr(x_node, "domain");
 
-					if (cidr) {
-						if (switch_network_list_add_cidr(list, cidr, ok) == SWITCH_STATUS_SUCCESS) {
-							if (reload) {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
-							} else {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny",
-												  name);
+					if (domain) {
+						switch_event_t *my_params = NULL;
+						switch_xml_t x_domain, xml_root;
+						switch_xml_t ut;
+
+						switch_event_create(&my_params, SWITCH_EVENT_MESSAGE);
+						switch_assert(my_params);
+						switch_event_add_header_string(my_params, SWITCH_STACK_BOTTOM, "domain", domain);
+						switch_event_add_header_string(my_params, SWITCH_STACK_BOTTOM, "purpose", "network-list");
+						
+						if (switch_xml_locate_domain(domain, my_params, &xml_root, &x_domain) != SWITCH_STATUS_SUCCESS) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate domain %s\n", domain);
+							switch_event_destroy(&my_params);
+							continue;
+						}
+						
+						switch_event_destroy(&my_params);
+
+						for (ut = switch_xml_child(x_domain, "user"); ut; ut = ut->next) {
+							const char *user_cidr = switch_xml_attr(ut, "cidr");
+							const char *id = switch_xml_attr(ut, "id");
+
+							if (id && user_cidr) {
+								char *token = switch_mprintf("%s@%s", id, domain);
+								switch_assert(token);
+								
+								if (switch_network_list_add_cidr_token(list, user_cidr, ok, token) == SWITCH_STATUS_SUCCESS) {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", 
+													  user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name);
+								} else {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n",
+													  user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name);
+								}
+								free(token);
 							}
+						}
+						switch_xml_free(xml_root);
+					} else if (cidr) {
+						if (switch_network_list_add_cidr(list, cidr, ok) == SWITCH_STATUS_SUCCESS) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
 						} else {
-							if (reload) {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-												  "Error Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
-							} else {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
-												  "Error Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
-							}
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+											  "Error Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
 						}
 					} else if (host && mask) {
 						if (switch_network_list_add_host_mask(list, host, mask, ok) == SWITCH_STATUS_SUCCESS) {
-							if (reload) {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
-												  "Adding %s/%s (%s) to list %s\n", host, mask, ok ? "allow" : "deny", name);
-							} else {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
-												  "Adding %s/%s (%s) to list %s\n", host, mask, ok ? "allow" : "deny", name);
-							}
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
+											  "Adding %s/%s (%s) to list %s\n", host, mask, ok ? "allow" : "deny", name);
 						}
-					}
+					} 
 
 					switch_core_hash_insert(IP_LIST.hash, name, list);
 				}
@@ -847,9 +923,9 @@
 
 SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err)
 {
-	switch_xml_t xml = NULL, cfg = NULL;
 	switch_uuid_t uuid;
 	char guess_ip[256];
+	char *dir_path;
 
 	memset(&runtime, 0, sizeof(runtime));
 
@@ -876,6 +952,21 @@
 		return SWITCH_STATUS_MEMERR;
 	}
 	switch_assert(runtime.memory_pool != NULL);
+
+	dir_path = switch_mprintf("%s%ssounds", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
+	switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+	switch_safe_free(dir_path);
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.base_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.mod_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.conf_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.log_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.db_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.script_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.htdocs_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.temp_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+
+
 	switch_mutex_init(&runtime.throttle_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
 	switch_mutex_init(&runtime.global_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
 	switch_core_set_globals();
@@ -892,7 +983,7 @@
 	switch_core_set_variable("local_ip_v6", guess_ip);
 	switch_core_set_variable("base_dir", SWITCH_GLOBAL_dirs.base_dir);
 
-	switch_log_init(runtime.memory_pool);
+
 	switch_event_init(runtime.memory_pool);
 
 	if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) {
@@ -900,80 +991,9 @@
 		return SWITCH_STATUS_MEMERR;
 	}
 
-	if ((xml = switch_xml_open_cfg("switch.conf", &cfg, NULL))) {
-		switch_xml_t settings, param;
-
-		if ((settings = switch_xml_child(cfg, "settings"))) {
-			for (param = switch_xml_child(settings, "param"); param; param = param->next) {
-				const char *var = switch_xml_attr_soft(param, "name");
-				const char *val = switch_xml_attr_soft(param, "value");
-
-				if (!strcasecmp(var, "crash-protection")) {
-					if (switch_true(val)) {
-						switch_set_flag((&runtime), SCF_CRASH_PROT);
-					}
-				} else if (!strcasecmp(var, "loglevel")) {
-					int level;
-					if (*val > 47 && *val < 58) {
-						level = atoi(val);
-					} else {
-						level = switch_log_str2level(val);
-					}
-
-					if (level != SWITCH_LOG_INVALID) {
-						switch_core_session_ctl(SCSC_LOGLEVEL, &level);
-					}
-#ifdef HAVE_SETRLIMIT
-				} else if (!strcasecmp(var, "dump-cores")) {
-					struct rlimit rlp;
-					memset(&rlp, 0, sizeof(rlp));
-					rlp.rlim_cur = RLIM_INFINITY;
-					rlp.rlim_max = RLIM_INFINITY;
-					setrlimit(RLIMIT_CORE, &rlp);
-#endif
-				} else if (!strcasecmp(var, "mailer-app")) {
-					runtime.mailer_app = switch_core_strdup(runtime.memory_pool, val);
-				} else if (!strcasecmp(var, "mailer-app-args")) {
-					runtime.mailer_app_args = switch_core_strdup(runtime.memory_pool, val);
-				} else if (!strcasecmp(var, "sessions-per-second")) {
-					switch_core_sessions_per_second(atoi(val));
-				} else if (!strcasecmp(var, "max_dtmf_duration")) {
-					int tmp = atoi(val);
-					if (tmp > 0) {
-						switch_core_max_dtmf_duration((uint32_t) tmp);
-					}
-				} else if (!strcasecmp(var, "default_dtmf_duration")) {
-					int tmp = atoi(val);
-					if (tmp > 0) {
-						switch_core_default_dtmf_duration((uint32_t) tmp);
-					}
-				} else if (!strcasecmp(var, "disable-monotonic-timing")) {
-					switch_time_set_monotonic(SWITCH_FALSE);
-				} else if (!strcasecmp(var, "max-sessions")) {
-					switch_core_session_limit(atoi(val));
-				} else if (!strcasecmp(var, "rtp-start-port")) {
-					switch_rtp_set_start_port((switch_port_t) atoi(val));
-				} else if (!strcasecmp(var, "rtp-end-port")) {
-					switch_rtp_set_end_port((switch_port_t) atoi(val));
-				}
-			}
-		}
-
-		if ((settings = switch_xml_child(cfg, "variables"))) {
-			for (param = switch_xml_child(settings, "variable"); param; param = param->next) {
-				const char *var = switch_xml_attr_soft(param, "name");
-				const char *val = switch_xml_attr_soft(param, "value");
-				char *varr = NULL, *vall = NULL;
-
-				varr = switch_core_strdup(runtime.memory_pool, var);
-				vall = switch_core_strdup(runtime.memory_pool, val);
-				switch_core_hash_insert(runtime.global_vars, varr, vall);
-			}
-		}
-
-		switch_xml_free(xml);
-	}
+	switch_load_core_config("switch.conf");
 
+	switch_log_init(runtime.memory_pool, runtime.colorize_console);
 	switch_core_state_machine_init(runtime.memory_pool);
 
 	*err = NULL;
@@ -1064,9 +1084,95 @@
 	return;
 }
 
+
+static void switch_load_core_config(const char *file)
+{
+	switch_xml_t xml = NULL, cfg = NULL;
+	
+	if ((xml = switch_xml_open_cfg(file, &cfg, NULL))) {
+		switch_xml_t settings, param;
+		
+		if ((settings = switch_xml_child(cfg, "settings"))) {
+			for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+				const char *var = switch_xml_attr_soft(param, "name");
+				const char *val = switch_xml_attr_soft(param, "value");
+
+				if (!strcasecmp(var, "crash-protection")) {
+					if (switch_true(val)) {
+						switch_set_flag((&runtime), SCF_CRASH_PROT);
+					}
+				} else if (!strcasecmp(var, "loglevel")) {
+					int level;
+					if (*val > 47 && *val < 58) {
+						level = atoi(val);
+					} else {
+						level = switch_log_str2level(val);
+					}
+
+					if (level != SWITCH_LOG_INVALID) {
+						switch_core_session_ctl(SCSC_LOGLEVEL, &level);
+					}
+#ifdef HAVE_SETRLIMIT
+				} else if (!strcasecmp(var, "dump-cores")) {
+					struct rlimit rlp;
+					memset(&rlp, 0, sizeof(rlp));
+					rlp.rlim_cur = RLIM_INFINITY;
+					rlp.rlim_max = RLIM_INFINITY;
+					setrlimit(RLIMIT_CORE, &rlp);
+#endif
+				} else if (!strcasecmp(var, "colorize-console") && switch_true(val)) {
+					runtime.colorize_console = SWITCH_TRUE;
+				} else if (!strcasecmp(var, "mailer-app") && !switch_strlen_zero(val)) {
+					runtime.mailer_app = switch_core_strdup(runtime.memory_pool, val);
+				} else if (!strcasecmp(var, "mailer-app-args") && val) {
+					runtime.mailer_app_args = switch_core_strdup(runtime.memory_pool, val);
+				} else if (!strcasecmp(var, "sessions-per-second") && !switch_strlen_zero(val)) {
+					switch_core_sessions_per_second(atoi(val));
+				} else if (!strcasecmp(var, "max_dtmf_duration") && !switch_strlen_zero(val)) {
+					int tmp = atoi(val);
+					if (tmp > 0) {
+						switch_core_max_dtmf_duration((uint32_t) tmp);
+					}
+				} else if (!strcasecmp(var, "default_dtmf_duration") && !switch_strlen_zero(val)) {
+					int tmp = atoi(val);
+					if (tmp > 0) {
+						switch_core_default_dtmf_duration((uint32_t) tmp);
+					}
+				} else if (!strcasecmp(var, "disable-monotonic-timing")) {
+					switch_time_set_monotonic(SWITCH_FALSE);
+				} else if (!strcasecmp(var, "max-sessions") && !switch_strlen_zero(val)) {
+					switch_core_session_limit(atoi(val));
+				} else if (!strcasecmp(var, "rtp-start-port") && !switch_strlen_zero(val)) {
+					switch_rtp_set_start_port((switch_port_t) atoi(val));
+				} else if (!strcasecmp(var, "rtp-end-port") && !switch_strlen_zero(val)) {
+					switch_rtp_set_end_port((switch_port_t) atoi(val));
+				}
+			}
+		}
+
+		if ((settings = switch_xml_child(cfg, "variables"))) {
+			for (param = switch_xml_child(settings, "variable"); param; param = param->next) {
+				const char *var = switch_xml_attr_soft(param, "name");
+				const char *val = switch_xml_attr_soft(param, "value");
+				char *varr = NULL, *vall = NULL;
+
+				varr = switch_core_strdup(runtime.memory_pool, var);
+				vall = switch_core_strdup(runtime.memory_pool, val);
+				switch_core_hash_insert(runtime.global_vars, varr, vall);
+			}
+		}
+
+		switch_xml_free(xml);
+	}
+
+
+}
+
+
 SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t flags, switch_bool_t console, const char **err)
 {
 	switch_event_t *event;
+
 	if (switch_core_init(flags, console, err) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_GENERR;
 	}
@@ -1088,9 +1194,11 @@
 #ifdef TRAP_BUS
 	signal(SIGBUS, handle_SIGBUS);
 #endif
-
+#ifdef SIGUSR1
+	signal(SIGUSR1, handle_SIGHUP);
+#endif
 	signal(SIGHUP, handle_SIGHUP);
-	switch_load_network_lists(SWITCH_FALSE);
+
 
 	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");
@@ -1100,6 +1208,10 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
+	switch_load_network_lists(SWITCH_FALSE);
+
+	switch_load_core_config("post_load_switch.conf");
+
 	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);
@@ -1299,5 +1411,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_asr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_asr.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_asr.c	Mon Aug  4 21:29:58 2008
@@ -164,5 +164,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_codec.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_codec.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_codec.c	Mon Aug  4 21:29:58 2008
@@ -42,6 +42,11 @@
 	return CODEC_ID++;
 }
 
+SWITCH_DECLARE(void) switch_core_session_unset_read_codec(switch_core_session_t *session)
+{
+	session->real_read_codec = session->read_codec = NULL;
+}
+
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_session_t *session, switch_codec_t *codec)
 {
@@ -49,68 +54,127 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	char tmp[30];
 
-	switch_assert(codec->implementation);
+	if (codec && !codec->implementation) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set ININITILIZED codec!\n");
+		return SWITCH_STATUS_FALSE;
+	}
 
-	if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
-		switch_channel_event_set_data(session->channel, event);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", codec->implementation->iananame);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", codec->implementation->actual_samples_per_second);
-		if (codec->implementation->actual_samples_per_second != codec->implementation->samples_per_second) {
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", codec->implementation->samples_per_second);
+	if (!codec || codec == session->real_read_codec) {
+		if (session->real_read_codec) {
+			session->read_codec = session->real_read_codec;
+		} else {
+			return SWITCH_STATUS_FALSE;
+		}
+	} else if (codec) {
+		if (session->read_codec != session->real_read_codec) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot double-set codec!\n");
+			return SWITCH_STATUS_FALSE;
+		}
+
+		session->read_codec = codec;
+
+		if (!session->real_read_codec) {
+			session->real_read_codec = session->read_codec;
 		}
-		switch_event_fire(&event);
 	}
 
-	switch_channel_set_variable(channel, "read_codec", codec->implementation->iananame);
-	switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
-	switch_channel_set_variable(channel, "read_rate", tmp);
+	if (session->read_codec && session->read_codec->implementation) {
+		if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
+			switch_channel_event_set_data(session->channel, event);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", session->read_codec->implementation->iananame);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", session->read_codec->implementation->actual_samples_per_second);
+			if (session->read_codec->implementation->actual_samples_per_second != session->read_codec->implementation->samples_per_second) {
+				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", session->read_codec->implementation->samples_per_second);
+			}
+			switch_event_fire(&event);
+		}
 
-	session->read_codec = codec;
-	session->raw_read_frame.codec = session->read_codec;
-	session->raw_write_frame.codec = session->read_codec;
-	session->enc_read_frame.codec = session->read_codec;
-	session->enc_write_frame.codec = session->read_codec;
+		switch_channel_set_variable(channel, "read_codec", session->read_codec->implementation->iananame);
+		switch_snprintf(tmp, sizeof(tmp), "%d", session->read_codec->implementation->actual_samples_per_second);
+		switch_channel_set_variable(channel, "read_rate", tmp);
+
+
+		session->raw_read_frame.codec = session->read_codec;
+		session->raw_write_frame.codec = session->read_codec;
+		session->enc_read_frame.codec = session->read_codec;
+		session->enc_write_frame.codec = session->read_codec;
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	return SWITCH_STATUS_FALSE;
 
-	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_read_codec(switch_core_session_t *session)
+SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_read_codec(switch_core_session_t *session)
 {
 	return session->read_codec;
 }
 
+SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_read_codec(switch_core_session_t *session)
+{
+	return session->real_read_codec ? session->real_read_codec : session->read_codec;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_session_t *session, switch_codec_t *codec)
 {
 	switch_event_t *event;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	char tmp[30];
 
-	switch_assert(codec->implementation);
+	if (!codec || !codec->implementation) {
+		if (session->real_write_codec) {
+			session->write_codec = session->real_write_codec;
+			session->real_write_codec = NULL;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set NULL codec!\n");
+			return SWITCH_STATUS_FALSE;
+		}
+	} else if (session->write_codec) {
+		if (session->real_write_codec) {
+			if (codec == session->real_write_codec) {
+				session->write_codec = codec;
+				session->real_write_codec = NULL;
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot double-set codec!\n");
+				return SWITCH_STATUS_FALSE;
+			}
+		} else {
+			session->real_write_codec = session->write_codec;
+			session->write_codec = codec;
+		}
+	} else {
+		session->write_codec = codec;
+	}
 
 	if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(session->channel, event);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", codec->implementation->iananame);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
-		if (codec->implementation->actual_samples_per_second != codec->implementation->samples_per_second) {
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", session->write_codec->implementation->iananame);
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", session->write_codec->implementation->actual_samples_per_second);
+		if (session->write_codec->implementation->actual_samples_per_second != session->write_codec->implementation->samples_per_second) {
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-write-codec-rate", "%d",
-									codec->implementation->actual_samples_per_second);
+									session->write_codec->implementation->actual_samples_per_second);
 		}
 		switch_event_fire(&event);
 	}
 
-	switch_channel_set_variable(channel, "write_codec", codec->implementation->iananame);
-	switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
+	switch_channel_set_variable(channel, "write_codec", session->write_codec->implementation->iananame);
+	switch_snprintf(tmp, sizeof(tmp), "%d", session->write_codec->implementation->actual_samples_per_second);
 	switch_channel_set_variable(channel, "write_rate", tmp);
 
-	session->write_codec = codec;
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_write_codec(switch_core_session_t *session)
+
+SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_write_codec(switch_core_session_t *session)
 {
 	return session->write_codec;
 }
 
+SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_write_codec(switch_core_session_t *session)
+{
+	return session->real_write_codec ? session->real_write_codec : session->write_codec;
+}
+
 
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_codec(switch_core_session_t *session, switch_codec_t *codec)
@@ -360,5 +424,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c	Mon Aug  4 21:29:58 2008
@@ -234,5 +234,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_directory.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_directory.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_directory.c	Mon Aug  4 21:29:58 2008
@@ -93,5 +93,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_event_hook.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_event_hook.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_event_hook.c	Mon Aug  4 21:29:58 2008
@@ -52,5 +52,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_file.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_file.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_file.c	Mon Aug  4 21:29:58 2008
@@ -133,6 +133,7 @@
 	}
 
 	if ((status = fh->file_interface->file_read(fh, data, len)) != SWITCH_STATUS_SUCCESS) {
+		*len = 0;
 		goto done;
 	}
 
@@ -295,5 +296,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_hash.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_hash.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_hash.c	Mon Aug  4 21:29:58 2008
@@ -157,5 +157,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c	Mon Aug  4 21:29:58 2008
@@ -634,6 +634,11 @@
 				status = SWITCH_STATUS_SUCCESS;
 				break;
 			default:
+				if (ptime_mismatch) {
+					status = perform_write(session, frame, flags, stream_id);
+					return SWITCH_STATUS_SUCCESS;
+				}
+
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s decoder error!\n", frame->codec->codec_interface->interface_name);
 				return status;
 			}
@@ -1088,5 +1093,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_media_bug.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_media_bug.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_media_bug.c	Mon Aug  4 21:29:58 2008
@@ -362,5 +362,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_memory.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_memory.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_memory.c	Mon Aug  4 21:29:58 2008
@@ -489,5 +489,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_port_allocator.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_port_allocator.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_port_allocator.c	Mon Aug  4 21:29:58 2008
@@ -121,23 +121,20 @@
 	srand(getpid() + (unsigned) switch_timestamp(NULL));
 
 	while (alloc->track_used < alloc->track_len) {
-		double r;
 		uint32_t index;
-		int tries = 0;
+		uint32_t tries = 0;
 
-		do {
-			r = ((double) rand() / ((double) (RAND_MAX) + (double) (1)));
-			index = (int) (r * alloc->track_len);
-			tries++;
-		} while ((alloc->track[index] || index >= alloc->track_len) && tries < 10000);
+		/* randomly pick a port */
+		index = rand() % alloc->track_len;
 
-		while (alloc->track[index]) {
-			if (++index >= alloc->track_len) {
-				index = 0;
-			}
+		/* if it is used walk up the list to find a free one */
+		while (alloc->track[index] && tries < alloc->track_len)
+		{
+			tries++;
+			if(++index >= alloc->track_len) index = 0;
 		}
 
-		if (index < alloc->track_len) {
+		if (tries < alloc->track_len) {
 			alloc->track[index] = 1;
 			alloc->track_used++;
 			status = SWITCH_STATUS_SUCCESS;
@@ -205,5 +202,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_rwlock.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_rwlock.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_rwlock.c	Mon Aug  4 21:29:58 2008
@@ -106,5 +106,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c	Mon Aug  4 21:29:58 2008
@@ -72,6 +72,50 @@
 	return session;
 }
 
+
+SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_name, const char *var_val, switch_call_cause_t cause)
+{
+	switch_hash_index_t *hi;
+	void *val;
+	switch_core_session_t *session;
+
+	switch_mutex_lock(runtime.throttle_mutex);
+	for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
+		switch_hash_this(hi, NULL, NULL, &val);
+		if (val) {
+			const char *this_val;
+			session = (switch_core_session_t *) val;
+			switch_core_session_read_lock(session);
+			if ((this_val = switch_channel_get_variable(session->channel, var_name)) && (!strcmp(this_val, var_val))) {
+				switch_channel_hangup(switch_core_session_get_channel(session), cause);
+			}
+			switch_core_session_rwunlock(session);
+		}
+	}
+	switch_mutex_unlock(runtime.throttle_mutex);
+}	
+
+SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause)
+{
+	switch_hash_index_t *hi;
+	void *val;
+	switch_core_session_t *session;
+
+	switch_mutex_lock(runtime.throttle_mutex);
+	for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
+		switch_hash_this(hi, NULL, NULL, &val);
+		if (val) {
+			session = (switch_core_session_t *) val;
+			switch_core_session_read_lock(session);
+			if (session->endpoint_interface == endpoint_interface) {
+				switch_channel_hangup(switch_core_session_get_channel(session), cause);
+			}
+			switch_core_session_rwunlock(session);
+		}
+	}
+	switch_mutex_unlock(runtime.throttle_mutex);
+}	
+
 SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause)
 {
 	switch_hash_index_t *hi;
@@ -622,13 +666,15 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_size_t has;
 
+	switch_core_session_set_read_codec(session, NULL);
+	
 	/* clear resamplers */
+	switch_mutex_lock(session->resample_mutex);
 	switch_resample_destroy(&session->read_resampler);
 	switch_resample_destroy(&session->write_resampler);
-
+	switch_mutex_unlock(session->resample_mutex);
 	/* clear indications */
 	switch_core_session_flush_message(session);
-
 	/* wipe theese, they will be recreated if need be */
 	switch_buffer_destroy(&session->raw_read_buffer);
 	switch_buffer_destroy(&session->raw_write_buffer);
@@ -686,10 +732,15 @@
 {
 	switch_memory_pool_t *pool;
 	switch_event_t *event;
+	const switch_endpoint_interface_t *endpoint_interface = (*session)->endpoint_interface;
+
 
 	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n",
 					  switch_channel_get_name((*session)->channel), switch_channel_state_name(switch_channel_get_state((*session)->channel)));
 
+
+	switch_core_session_reset(*session, TRUE);
+	
 	switch_core_media_bug_remove_all(*session);
 	switch_ivr_deactivate_unicast(*session);
 
@@ -720,6 +771,8 @@
 	*session = NULL;
 	switch_core_destroy_memory_pool(&pool);
 
+	switch_thread_rwlock_unlock(endpoint_interface->rwlock);
+
 }
 
 static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t *thread, void *obj)
@@ -730,8 +783,9 @@
 	const char *val;
 
 	session->thread = thread;
-
+	
 	switch_core_session_run(session);
+	switch_core_media_bug_remove_all(session);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session %" SWITCH_SIZE_T_FMT " (%s) Locked, Waiting on external entities\n",
 					  session->id, switch_channel_get_name(session->channel));
 	switch_core_session_write_lock(session);
@@ -826,6 +880,8 @@
 		return NULL;
 	}
 
+	switch_thread_rwlock_rdlock(endpoint_interface->rwlock);
+
 	if (pool && *pool) {
 		usepool = *pool;
 		*pool = NULL;
@@ -1046,8 +1102,12 @@
 
 	switch_assert(application_interface->application_function);
 
-	application_interface->application_function(session, arg);
+	switch_channel_set_variable(session->channel, SWITCH_CURRENT_APPLICATION_VARIABLE, application_interface->interface_name);
 
+	switch_thread_rwlock_rdlock(application_interface->rwlock);
+	application_interface->application_function(session, arg);
+	switch_thread_rwlock_unlock(application_interface->rwlock);
+	
 	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(session->channel, event);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "%s", application_interface->interface_name);
@@ -1163,5 +1223,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_speech.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_speech.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_speech.c	Mon Aug  4 21:29:58 2008
@@ -154,5 +154,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c	Mon Aug  4 21:29:58 2008
@@ -506,5 +506,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c	Mon Aug  4 21:29:58 2008
@@ -198,7 +198,7 @@
 //static switch_hash_t *stack_table = NULL;
 static Hash stack_table;
 
-#if defined (__GNUC__) && defined (LINUX)
+#if defined (__GNUC__) && defined (LINUX) && defined (HAVE_EXECINFO_H)
 #include <execinfo.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -483,5 +483,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_timer.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_timer.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_timer.c	Mon Aug  4 21:29:58 2008
@@ -136,5 +136,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp	Mon Aug  4 21:29:58 2008
@@ -37,6 +37,68 @@
 #pragma warning(disable:4127 4003)
 #endif
 
+static void event_handler(switch_event_t *event)
+{
+	EventConsumer *E = (EventConsumer *) event->bind_user_data;
+	switch_event_t *dup;
+	
+	switch_event_dup(&dup, event);
+
+	if (switch_queue_trypush(E->events, dup) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot queue any more events.....\n");
+	}
+
+}
+
+SWITCH_DECLARE_CONSTRUCTOR EventConsumer::EventConsumer(const char *event_name, const char *subclass_name)
+{
+	switch_name_event(event_name, &e_event_id);
+	switch_core_new_memory_pool(&pool);
+	
+	if (!switch_strlen_zero(subclass_name)) {
+		e_subclass_name = switch_core_strdup(pool, subclass_name);
+	} else {
+		e_subclass_name = NULL;
+	}
+
+	switch_queue_create(&events, 5000, pool);
+	
+	if (switch_event_bind_removable(__FILE__, e_event_id, e_subclass_name, event_handler, this, &node) == SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "bound to %s %s\n", event_name, switch_str_nil(e_subclass_name));
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind to %s %s\n", event_name, switch_str_nil(e_subclass_name));
+	}
+
+}
+
+
+SWITCH_DECLARE(Event *) EventConsumer::pop(int block)
+{
+	void *pop = NULL;
+	Event *ret = NULL;
+	switch_event_t *event;
+	
+	if (block) {
+		switch_queue_pop(events, &pop);
+	} else {
+		switch_queue_trypop(events, &pop);
+	}
+
+	if ((event = (switch_event_t *) pop)) {
+		ret = new Event(event);
+	}
+
+	return ret;
+}
+
+SWITCH_DECLARE_CONSTRUCTOR EventConsumer::~EventConsumer()
+{
+	if (node) {
+		switch_event_unbind(&node);
+	}
+
+	switch_core_destroy_memory_pool(&pool);
+}
 
 SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main,
 											const char *name,
@@ -176,10 +238,9 @@
 
 	this_check("");
 
-	if (serialized_string) {
-		free(serialized_string);
-	}
 
+	switch_safe_free(serialized_string);
+	
 	if (!event) {
 		return "";
 	}
@@ -199,6 +260,7 @@
 		}
 	} else {
 		if (switch_event_serialize(event, &serialized_string, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
+			serialized_string = switch_mprintf("'%s'", serialized_string);
 			return serialized_string;
 		}
 	}
@@ -305,6 +367,24 @@
 	return (char *) "invalid";
 }
 
+
+SWITCH_DECLARE_CONSTRUCTOR DTMF::DTMF(char idigit, uint32_t iduration)
+{
+	digit = idigit;
+
+	if (iduration == 0) {
+		iduration = SWITCH_DEFAULT_DTMF_DURATION;
+	}
+
+	duration = iduration;
+}
+
+SWITCH_DECLARE_CONSTRUCTOR DTMF::~DTMF()
+{
+	
+}
+
+
 SWITCH_DECLARE_CONSTRUCTOR Stream::Stream()
 {
 	SWITCH_STANDARD_STREAM(mystream);
@@ -342,41 +422,20 @@
 
 SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession()
 {
-	session = NULL;
-	channel = NULL;
-	uuid = NULL;
-	tts_name = NULL;
-	voice_name = NULL;
-	memset(&args, 0, sizeof(args));
-	ap = NULL;
-	on_hangup = NULL;
-	cb_state.function = NULL;
-	
-	memset(&caller_profile, 0, sizeof(caller_profile)); 
-	caller_profile.source = "mod_unknown";
-	caller_profile.dialplan = "";
-	caller_profile.context = "";
-	caller_profile.caller_id_name = "";
-	caller_profile.caller_id_number = "";
-	caller_profile.network_addr = "";
-	caller_profile.ani = "";
-	caller_profile.aniii = "";
-	caller_profile.rdnis = "";
-	caller_profile.username = "";
-		
+	init_vars();
 }
 
-SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid)
+SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid, CoreSession *a_leg)
 {
-	memset(&caller_profile, 0, sizeof(caller_profile)); 	
 	init_vars();
+
 	if (!strchr(nuuid, '/') && (session = switch_core_session_locate(nuuid))) {
 		uuid = strdup(nuuid);
 		channel = switch_core_session_get_channel(session);
 		allocated = 1;
     } else {
 		switch_call_cause_t cause;
-		if (switch_ivr_originate(NULL, &session, &cause, nuuid, 60, NULL, NULL, NULL, NULL, SOF_NONE) == SWITCH_STATUS_SUCCESS) {
+		if (switch_ivr_originate(a_leg ? a_leg->session : NULL, &session, &cause, nuuid, 60, NULL, NULL, NULL, NULL, SOF_NONE) == SWITCH_STATUS_SUCCESS) {
 			channel = switch_core_session_get_channel(session);
 			allocated = 1;
 			switch_set_flag(this, S_HUP);
@@ -388,8 +447,8 @@
 
 SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(switch_core_session_t *new_session)
 {
-	memset(&caller_profile, 0, sizeof(caller_profile)); 
 	init_vars();
+
 	if (new_session) {
 		session = new_session;
 		channel = switch_core_session_get_channel(session);
@@ -402,6 +461,12 @@
 {
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::~CoreSession desctructor\n");
 	switch_channel_t *channel = NULL;
+	
+	this_check_void();
+	switch_safe_free(xml_cdr_text);
+	switch_safe_free(uuid);	
+	switch_safe_free(tts_name);
+	switch_safe_free(voice_name);
 
 	if (session) {
 		channel = switch_core_session_get_channel(session);
@@ -410,11 +475,6 @@
 		}
 		switch_core_session_rwunlock(session);
 	}
-
-	switch_safe_free(xml_cdr_text);
-	switch_safe_free(uuid);	
-	switch_safe_free(tts_name);
-	switch_safe_free(voice_name);
 }
 
 SWITCH_DECLARE(char *) CoreSession::getXMLCDR()
@@ -558,11 +618,6 @@
 	this_check(-1);
 	sanity_check(-1);
 
-	// create and store an empty filehandle in callback args 
-	// to workaround a bug in the presumptuous process_callback_result()
-    switch_file_handle_t fh = { 0 };
-	store_file_handle(&fh);
-
 	if (!tts_name) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No TTS engine specified\n");
 		return SWITCH_STATUS_FALSE;
@@ -601,9 +656,15 @@
     return SWITCH_STATUS_SUCCESS;
 } 
 
+SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits, char *terminators, int timeout)
+{
+    return getDigits(maxdigits, terminators, timeout, 0);
+}
+
 SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits, 
 											  char *terminators, 
-											  int timeout)
+											  int timeout,
+											  int interdigit)
 {
     switch_status_t status;
 	this_check((char *)"");
@@ -618,7 +679,7 @@
 											 maxdigits, 
 											 terminators, 
 											 &terminator, 
-											 (uint32_t) timeout, 0, 0);
+											 (uint32_t) timeout, (uint32_t)interdigit, 0);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "getDigits dtmf_buf: %s\n", dtmf_buf);
 	end_allow_threads();
@@ -663,13 +724,13 @@
 }
 
 SWITCH_DECLARE(char *) CoreSession::playAndGetDigits(int min_digits, 
-												  int max_digits, 
-												  int max_tries, 
-												  int timeout, 
-												  char *terminators, 
-												  char *audio_files, 
-												  char *bad_input_audio_files, 
-												  char *digits_regex)
+													 int max_digits, 
+													 int max_tries, 
+													 int timeout, 
+													 char *terminators, 
+													 char *audio_files, 
+													 char *bad_input_audio_files, 
+													 char *digits_regex)
 {
     switch_status_t status;
 	sanity_check((char *)"");
@@ -743,11 +804,25 @@
         }
 	}
 
+    begin_allow_threads();
+    status = switch_ivr_play_file(session, fhp, file, ap);
+    end_allow_threads();
+
+	fhp = NULL;
+	
+    return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+
+}
+
+SWITCH_DECLARE(int) CoreSession::sleep(int ms) {
 
-	store_file_handle(&local_fh);
+    switch_status_t status;
 
+	this_check(-1);
+    sanity_check(-1);
+	
     begin_allow_threads();
-    status = switch_ivr_play_file(session, fhp, file, ap);
+    status = switch_ivr_sleep(session, ms, ap);
     end_allow_threads();
 
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
@@ -761,6 +836,20 @@
 	return switch_channel_ready(channel) != 0;
 }
 
+SWITCH_DECLARE(bool) CoreSession::mediaReady() {
+
+	this_check(false);
+	sanity_check(false);	
+	return switch_channel_media_ready(channel) != 0;
+}
+
+SWITCH_DECLARE(bool) CoreSession::answered() {
+
+	this_check(false);
+	sanity_check(false);	
+	return switch_channel_test_flag(channel, CF_ANSWERED) != 0;
+}
+
 SWITCH_DECLARE(int) CoreSession::originate(CoreSession *a_leg_session, char *dest, int timeout)
 {
 
@@ -769,7 +858,6 @@
 	switch_call_cause_t cause;
 
 	this_check(0);
-	sanity_check(0);
 
 	cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 
@@ -817,18 +905,22 @@
 
 SWITCH_DECLARE(int) CoreSession::recordFile(char *file_name, int max_len, int silence_threshold, int silence_secs) 
 {
-	switch_file_handle_t fh = { 0 };
 	switch_status_t status;
 
 	this_check(-1);
 	sanity_check(-1);
 
-	fh.thresh = silence_threshold;
-	fh.silence_hits = silence_secs;
-	store_file_handle(&fh);
+	memset(&local_fh, 0, sizeof(local_fh));
+	fhp = &local_fh;
+	local_fh.thresh = silence_threshold;
+	local_fh.silence_hits = silence_secs;
+
 	begin_allow_threads();
-	status = switch_ivr_record_file(session, &fh, file_name, &args, max_len);
+	status = switch_ivr_record_file(session, &local_fh, file_name, &args, max_len);
 	end_allow_threads();
+
+	fhp = NULL;
+
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 
 }
@@ -876,6 +968,15 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_DECLARE(void) CoreSession::waitForAnswer(CoreSession *calling_session) 
+{
+	this_check_void();
+	sanity_check_noreturn;
+	
+	switch_ivr_wait_for_answer(calling_session ? calling_session->session : NULL, session);
+
+}
+
 SWITCH_DECLARE(void) CoreSession::setCallerData(char *var, char *val) {
 
 	this_check_void();
@@ -925,22 +1026,6 @@
     switch_core_event_hook_add_state_change(session, hanguphook);
 }
 
-/** \brief Store a file handle in the callback args
- * 
- * In a few of the methods like playFile and streamfile,
- * an empty switch_file_handle_t is created and passed
- * to core, and stored in callback args so that the callback
- * handler can retrieve it for pausing, ff, rewinding file ptr. 
- * 
- * \param fh - a switch_file_handle_t
- */
-void CoreSession::store_file_handle(switch_file_handle_t *fh) {
-    cb_state.extra = fh;  // set a file handle so callback handler can pause
-    args.buf = &cb_state;     
-    ap = &args;
-}
-
-
 /* ---- methods not bound to CoreSession instance ---- */
 
 SWITCH_DECLARE(void) consoleLog(char *level_str, char *msg)
@@ -976,12 +1061,35 @@
     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bridge called, session_a uuid: %s\n", session_a.get_uuid());
 	switch_input_callback_function_t dtmf_func = NULL;
 	switch_input_args_t args;
+	switch_channel_t *channel_a = NULL, *channel_b = NULL;
+	const char *err = "Channels not ready\n";
+	
+	if (session_a.allocated && session_a.session && session_b.allocated && session_b.session) {
+		channel_a = switch_core_session_get_channel(session_a.session);
+		channel_b = switch_core_session_get_channel(session_b.session);
+
+		if (switch_channel_ready(channel_a) && switch_channel_ready(channel_b)) {
+			session_a.begin_allow_threads();
+			if (!switch_channel_test_flag(channel_a, CF_ANSWERED)) {
+				switch_channel_answer(channel_a);
+			}
+			if (!switch_channel_test_flag(channel_b, CF_ANSWERED)) {
+				switch_channel_answer(channel_b);
+			}
+			if (switch_channel_ready(channel_a) && switch_channel_ready(channel_b)) {
+				args = session_a.get_cb_args();  // get the cb_args data structure for session a
+				dtmf_func = args.input_callback;   // get the call back function
+				err = NULL;
+				switch_ivr_multi_threaded_bridge(session_a.session, session_b.session, dtmf_func, args.buf, args.buf);
+			}
+			session_a.end_allow_threads();
+		}
+	}
+
+	if (err) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s", err);
+	}
 
-	session_a.begin_allow_threads();
-	args = session_a.get_cb_args();  // get the cb_args data structure for session a
-	dtmf_func = args.input_callback;   // get the call back function
-	switch_ivr_multi_threaded_bridge(session_a.session, session_b.session, dtmf_func, args.buf, args.buf);
-	session_a.end_allow_threads();
 
 }
 
@@ -1006,10 +1114,10 @@
 
 
 SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session_cb, 
-							  void *input, 
-							  switch_input_type_t itype, 
-							  void *buf,  
-							  unsigned int buflen) {
+													 void *input, 
+													 switch_input_type_t itype, 
+													 void *buf,  
+													 unsigned int buflen) {
 	
 	switch_channel_t *channel = switch_core_session_get_channel(session_cb);
 	CoreSession *coresession = NULL;
@@ -1039,8 +1147,6 @@
 SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *result)
 {
 	
-    switch_file_handle_t *fh = NULL;	   
-
 	this_check(SWITCH_STATUS_FALSE);
 	sanity_check(SWITCH_STATUS_FALSE);
 	
@@ -1049,102 +1155,76 @@
     }
 
 	if (fhp) {
-		fh = fhp;
-	} else {
-		if (!cb_state.extra) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because cb_state.extra is null\n");
-			return SWITCH_STATUS_FALSE;	
-		}
+		if (!strncasecmp(result, "speed", 4)) {
+			char *p;
 		
-		fh = (switch_file_handle_t *) cb_state.extra;    
-	}
-
-
-    if (!fh) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because fh is null\n");
-		return SWITCH_STATUS_FALSE;	
-    }
-
-    if (!fh->file_interface) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because fh->file_interface is null\n");
-		return SWITCH_STATUS_FALSE;	
-    }
-
-    if (!session) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because session is null\n");
-		return SWITCH_STATUS_FALSE;	
-    }
-
+			if ((p = strchr(result, ':'))) {
+				p++;
+				if (*p == '+' || *p == '-') {
+					int step;
+					if (!(step = atoi(p))) {
+						step = 1;
+					}
+					fhp->speed += step;
+				} else {
+					int speed = atoi(p);
+					fhp->speed = speed;
+				}
+				return SWITCH_STATUS_SUCCESS;
+			}
 
-    if (!strncasecmp(result, "speed", 4)) {
-		char *p;
+			return SWITCH_STATUS_FALSE;
 
-		if ((p = strchr(result, ':'))) {
-			p++;
-			if (*p == '+' || *p == '-') {
-				int step;
-				if (!(step = atoi(p))) {
-					step = 1;
-				}
-				fh->speed += step;
+		} else if (!strcasecmp(result, "pause")) {
+			if (switch_test_flag(fhp, SWITCH_FILE_PAUSE)) {
+				switch_clear_flag(fhp, SWITCH_FILE_PAUSE);
 			} else {
-				int speed = atoi(p);
-				fh->speed = speed;
+				switch_set_flag(fhp, SWITCH_FILE_PAUSE);
 			}
 			return SWITCH_STATUS_SUCCESS;
-		}
-
-		return SWITCH_STATUS_FALSE;
-
-    } else if (!strcasecmp(result, "pause")) {
-		if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
-			switch_clear_flag(fh, SWITCH_FILE_PAUSE);
-		} else {
-			switch_set_flag(fh, SWITCH_FILE_PAUSE);
-		}
-		return SWITCH_STATUS_SUCCESS;
-    } else if (!strcasecmp(result, "stop")) {
-		return SWITCH_STATUS_FALSE;
-    } else if (!strcasecmp(result, "restart")) {
-		unsigned int pos = 0;
-		fh->speed = 0;
-		switch_core_file_seek(fh, &pos, 0, SEEK_SET);
-		return SWITCH_STATUS_SUCCESS;
-    } else if (!strncasecmp(result, "seek", 4)) {
-		switch_codec_t *codec;
-		unsigned int samps = 0;
-		unsigned int pos = 0;
-		char *p;
-		codec = switch_core_session_get_read_codec(session);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got codec\n");
-		if ((p = strchr(result, ':'))) {
-			p++;
-			if (*p == '+' || *p == '-') {
-				int step;
-				if (!(step = atoi(p))) {
-					step = 1000;
-				}
-				if (step > 0) {
-					samps = step * (codec->implementation->samples_per_second / 1000);
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
-					switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
+		} else if (!strcasecmp(result, "stop")) {
+			return SWITCH_STATUS_FALSE;
+		} else if (!strcasecmp(result, "restart")) {
+			unsigned int pos = 0;
+			fhp->speed = 0;
+			switch_core_file_seek(fhp, &pos, 0, SEEK_SET);
+			return SWITCH_STATUS_SUCCESS;
+		} else if (!strncasecmp(result, "seek", 4)) {
+			switch_codec_t *codec;
+			unsigned int samps = 0;
+			unsigned int pos = 0;
+			char *p;
+			codec = switch_core_session_get_read_codec(session);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got codec\n");
+			if ((p = strchr(result, ':'))) {
+				p++;
+				if (*p == '+' || *p == '-') {
+					int step;
+					if (!(step = atoi(p))) {
+						step = 1000;
+					}
+					if (step > 0) {
+						samps = step * (codec->implementation->samples_per_second / 1000);
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
+						switch_core_file_seek(fhp, &pos, samps, SEEK_CUR);
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
+					} else {
+						samps = step * (codec->implementation->samples_per_second / 1000);
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
+						switch_core_file_seek(fhp, &pos, fhp->pos - samps, SEEK_SET);
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
+					}
 				} else {
-					samps = step * (codec->implementation->samples_per_second / 1000);
+					samps = atoi(p) * (codec->implementation->samples_per_second / 1000);
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
-					switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
+					switch_core_file_seek(fhp, &pos, samps, SEEK_SET);
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
 				}
-			} else {
-				samps = atoi(p) * (codec->implementation->samples_per_second / 1000);
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
-				switch_core_file_seek(fh, &pos, samps, SEEK_SET);
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
 			}
-		}
 
-		return SWITCH_STATUS_SUCCESS;
-    }
+			return SWITCH_STATUS_SUCCESS;
+		}
+	}
 
     if (!strcmp(result, "true") || !strcmp(result, "undefined")) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "return success\n");
@@ -1164,5 +1244,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c	Mon Aug  4 21:29:58 2008
@@ -38,11 +38,35 @@
 #define DISPATCH_QUEUE_LEN 5000
 //#define DEBUG_DISPATCH_QUEUES
 
+/*! \brief A node to store binded events */
+struct switch_event_node {
+	/*! the id of the node */
+	char *id;
+	/*! the event id enumeration to bind to */
+	switch_event_types_t event_id;
+	/*! the event subclass to bind to for custom events */
+	switch_event_subclass_t *subclass;
+	/*! a callback function to execute when the event is triggered */
+	switch_event_callback_t callback;
+	/*! private data */
+	void *user_data;
+	struct switch_event_node *next;
+};
+
+/*! \brief A registered custom event subclass  */
+struct switch_event_subclass {
+	/*! the owner of the subclass */
+	char *owner;
+	/*! the subclass name */
+	char *name;
+};
+
 static int SOFT_MAX_DISPATCH = 0;
 static char hostname[128] = "";
 static char guess_ip_v4[80] = "";
 static char guess_ip_v6[80] = "";
 static switch_event_node_t *EVENT_NODES[SWITCH_EVENT_ALL + 1] = { NULL };
+static switch_thread_rwlock_t *RWLOCK = NULL;
 static switch_mutex_t *BLOCK = NULL;
 static switch_mutex_t *POOL_LOCK = NULL;
 static switch_memory_pool_t *RUNTIME_POOL = NULL;
@@ -131,6 +155,9 @@
 	"EXE_SCHEDULE",
 	"RE_SCHEDULE",
 	"RELOADXML",
+	"NOTIFY",
+	"SEND_MESSAGE",
+	"RECV_MESSAGE",
 	"ALL"
 };
 
@@ -148,7 +175,7 @@
 
 	if (match || event->event_id == node->event_id) {
 
-		if (event->subclass && node->subclass) {
+		if (event->subclass_name && node->subclass) {
 			if (!strncasecmp(node->subclass->name, "file:", 5)) {
 				char *file_header;
 				if ((file_header = switch_event_get_header(event, "file")) != 0) {
@@ -159,10 +186,10 @@
 				if ((func_header = switch_event_get_header(event, "function")) != 0) {
 					match = strstr(node->subclass->name + 5, func_header) ? 1 : 0;
 				}
-			} else {
-				match = strstr(event->subclass->name, node->subclass->name) ? 1 : 0;
+			} else if (event->subclass_name && node->subclass->name) {
+				match = strstr(event->subclass_name, node->subclass->name) ? 1 : 0;
 			}
-		} else if ((event->subclass && !node->subclass) || (!event->subclass && !node->subclass)) {
+		} else if ((event->subclass_name && !node->subclass) || (!event->subclass_name && !node->subclass)) {
 			match = 1;
 		} else {
 			match = 0;
@@ -276,6 +303,7 @@
 	switch_event_types_t e;
 	switch_event_node_t *node;
 
+	switch_thread_rwlock_rdlock(RWLOCK);
 	for (e = (*event)->event_id;; e = SWITCH_EVENT_ALL) {
 		for (node = EVENT_NODES[e]; node; node = node->next) {
 			if (switch_events_match(*event, node)) {
@@ -288,6 +316,7 @@
 			break;
 		}
 	}
+	switch_thread_rwlock_unlock(RWLOCK);
 
 	switch_event_destroy(event);
 }
@@ -321,6 +350,30 @@
 	return SWITCH_STATUS_FALSE;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_event_free_subclass_detailed(const char *owner, const char *subclass_name)
+{
+	switch_event_subclass_t *subclass;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	switch_assert(RUNTIME_POOL != NULL);
+	switch_assert(CUSTOM_HASH != NULL);
+
+	if ((subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) {
+		if (!strcmp(owner, subclass->owner)) {
+			switch_thread_rwlock_wrlock(RWLOCK);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Subclass reservation deleted for %s:%s\n", owner, subclass_name);
+			switch_core_hash_delete(CUSTOM_HASH, subclass_name);
+			FREE(subclass->owner);
+			FREE(subclass->name);
+			FREE(subclass);
+			status = SWITCH_STATUS_SUCCESS;
+			switch_thread_rwlock_unlock(RWLOCK);
+		}
+	}
+	
+	return status;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_event_reserve_subclass_detailed(const char *owner, const char *subclass_name)
 {
 	switch_event_subclass_t *subclass;
@@ -332,13 +385,11 @@
 		return SWITCH_STATUS_INUSE;
 	}
 
-	if ((subclass = switch_core_alloc(RUNTIME_POOL, sizeof(*subclass))) == 0) {
-		return SWITCH_STATUS_MEMERR;
-	}
-
-	subclass->owner = switch_core_strdup(RUNTIME_POOL, owner);
-	subclass->name = switch_core_strdup(RUNTIME_POOL, subclass_name);
+	switch_zmalloc(subclass, sizeof(*subclass));
 
+	subclass->owner = DUP(owner);
+	subclass->name = DUP(subclass_name);
+	
 	switch_core_hash_insert(CUSTOM_HASH, subclass->name, subclass);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -448,6 +499,7 @@
 
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activate Eventing Engine.\n");
+	switch_thread_rwlock_create(&RWLOCK, RUNTIME_POOL);
 	switch_mutex_init(&BLOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
 	switch_mutex_init(&POOL_LOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
 	switch_mutex_init(&EVENT_QUEUE_MUTEX, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
@@ -492,10 +544,7 @@
 	(*event)->event_id = event_id;
 
 	if (subclass_name) {
-		if (!((*event)->subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) {
-			switch_event_reserve_subclass((char *) subclass_name);
-			(*event)->subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name);
-		}
+		(*event)->subclass_name = DUP(subclass_name);
 		switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Subclass", subclass_name);
 	}
 
@@ -509,7 +558,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, char *header_name)
+SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, const char *header_name)
 {
 	switch_event_header_t *hp;
 	switch_assert(event);
@@ -662,6 +711,7 @@
 			}
 		}
 		FREE(ep->body);
+		FREE(ep->subclass_name);
 		memset(ep, 0, sizeof(*ep));
 		if (switch_queue_trypush(EVENT_RECYCLE_QUEUE, ep) != SWITCH_STATUS_SUCCESS) {
 			FREE(ep);
@@ -674,11 +724,13 @@
 {
 	switch_event_header_t *header, *hp, *hp2, *last = NULL;
 
-	if (switch_event_create_subclass(event, todup->event_id, todup->subclass ? todup->subclass->name : NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_create_subclass(event, todup->event_id, todup->subclass_name) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_GENERR;
 	}
 
-	(*event)->subclass = todup->subclass;
+	if (todup->subclass_name) {
+		(*event)->subclass_name = DUP(todup->subclass_name);
+	}
 	(*event)->event_user_data = todup->event_user_data;
 	(*event)->bind_user_data = todup->bind_user_data;
 
@@ -942,9 +994,8 @@
 	switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Calling-Function", func);
 	switch_event_add_header(*event, SWITCH_STACK_BOTTOM, "Event-Calling-Line-Number", "%d", line);
 
-	if ((*event)->subclass) {
-		switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Subclass", (*event)->subclass->name);
-		switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Subclass-Owner", (*event)->subclass->owner);
+	if ((*event)->subclass_name) {
+		switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Subclass", (*event)->subclass_name);
 	}
 
 	if (user_data) {
@@ -958,8 +1009,8 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_event_bind(const char *id, switch_event_types_t event, const char *subclass_name, switch_event_callback_t callback,
-												  void *user_data)
+SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, switch_event_types_t event, const char *subclass_name, 
+															switch_event_callback_t callback, void *user_data, switch_event_node_t **node)
 {
 	switch_event_node_t *event_node;
 	switch_event_subclass_t *subclass = NULL;
@@ -967,21 +1018,27 @@
 	switch_assert(BLOCK != NULL);
 	switch_assert(RUNTIME_POOL != NULL);
 
+	if (node) {
+		*node = NULL;
+	}
+
 	if (subclass_name) {
-		if ((subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name)) == 0) {
-			if ((subclass = switch_core_alloc(RUNTIME_POOL, sizeof(*subclass))) == 0) {
-				return SWITCH_STATUS_MEMERR;
-			} else {
-				subclass->owner = switch_core_strdup(RUNTIME_POOL, id);
-				subclass->name = switch_core_strdup(RUNTIME_POOL, subclass_name);
-			}
+		if (!(subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) {
+			switch_event_reserve_subclass_detailed(id, subclass_name);
+			subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name);
+		}
+		if (!subclass) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not reserve subclass. '%s'\n", subclass_name);
+			return SWITCH_STATUS_FALSE;
 		}
 	}
-
-	if (event <= SWITCH_EVENT_ALL && (event_node = switch_core_alloc(RUNTIME_POOL, sizeof(switch_event_node_t))) != 0) {
+	
+	if (event <= SWITCH_EVENT_ALL) {
+		switch_zmalloc(event_node, sizeof(*event_node));
 		switch_mutex_lock(BLOCK);
+		switch_thread_rwlock_wrlock(RWLOCK);
 		/* <LOCKED> ----------------------------------------------- */
-		event_node->id = switch_core_strdup(RUNTIME_POOL, id);
+		event_node->id = DUP(id);
 		event_node->event_id = event;
 		event_node->subclass = subclass;
 		event_node->callback = callback;
@@ -992,14 +1049,106 @@
 		}
 
 		EVENT_NODES[event] = event_node;
+		switch_thread_rwlock_unlock(RWLOCK);
 		switch_mutex_unlock(BLOCK);
 		/* </LOCKED> ----------------------------------------------- */
+
+		if (node) {
+			*node = event_node;
+		}
+
 		return SWITCH_STATUS_SUCCESS;
 	}
 
 	return SWITCH_STATUS_MEMERR;
 }
 
+
+SWITCH_DECLARE(switch_status_t) switch_event_bind(const char *id, switch_event_types_t event, const char *subclass_name, 
+												  switch_event_callback_t callback, void *user_data) 
+{
+	return switch_event_bind_removable(id, event, subclass_name, callback, user_data, NULL);
+}
+
+
+SWITCH_DECLARE(switch_status_t) switch_event_unbind_callback(switch_event_callback_t callback)
+{
+	switch_event_node_t *n, *np, *lnp = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	int id;
+
+	switch_thread_rwlock_wrlock(RWLOCK);
+	switch_mutex_lock(BLOCK);
+	/* <LOCKED> ----------------------------------------------- */
+	for (id = 0; id < SWITCH_EVENT_ALL; id++) {
+		lnp = NULL;
+
+		for (np = EVENT_NODES[id]; np;) {
+			n = np;
+			np = np->next;
+			if (n->callback == callback) {
+				if (lnp) {
+					lnp->next = n->next;
+				} else {
+					EVENT_NODES[n->event_id] = n->next;
+				}
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Event Binding deleted for %s:%s\n", n->id, switch_event_name(n->event_id));
+				n->subclass = NULL;
+				FREE(n->id);
+				FREE(n);
+				status = SWITCH_STATUS_SUCCESS;
+			} else {
+				lnp = n;
+			}
+		}
+	}
+	switch_mutex_unlock(BLOCK);
+	switch_thread_rwlock_unlock(RWLOCK);
+	/* </LOCKED> ----------------------------------------------- */
+
+	return status;
+}
+
+
+
+SWITCH_DECLARE(switch_status_t) switch_event_unbind(switch_event_node_t **node)
+{
+	switch_event_node_t *n, *np, *lnp = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	n = *node;
+
+	if (!n) {
+		return status;
+	}
+
+	switch_thread_rwlock_wrlock(RWLOCK);
+	switch_mutex_lock(BLOCK);
+	/* <LOCKED> ----------------------------------------------- */
+	for (np = EVENT_NODES[n->event_id]; np; np = np->next) {
+		if (np == n) {
+			if (lnp) {
+				lnp->next = n->next;
+			} else {
+				EVENT_NODES[n->event_id] = n->next;
+			}
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Event Binding deleted for %s:%s\n", n->id, switch_event_name(n->event_id));
+			n->subclass = NULL;
+			FREE(n->id);
+			FREE(n);
+			*node = NULL;
+			status = SWITCH_STATUS_SUCCESS;
+			break;
+		}
+		lnp = np;
+	}
+	switch_mutex_unlock(BLOCK);
+	switch_thread_rwlock_unlock(RWLOCK);
+	/* </LOCKED> ----------------------------------------------- */
+
+	return status;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(char *file, char *func, int line,
 																	 const char *proto, const char *login,
 																	 const char *from, const char *from_domain,
@@ -1376,5 +1525,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c	Mon Aug  4 21:29:58 2008
@@ -38,7 +38,7 @@
 #include <switch_ivr.h>
 #include "stfu.h"
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, uint32_t ms)
+SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, uint32_t ms, switch_input_args_t *args)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -55,10 +55,55 @@
 			status = SWITCH_STATUS_FALSE;
 			break;
 		}
+		
+		if (switch_channel_test_flag(channel, CF_BREAK)) {
+			switch_channel_clear_flag(channel, CF_BREAK);
+			status = SWITCH_STATUS_BREAK;
+			break;
+		}
 
 		if (now > done || left <= 0) {
 			break;
 		}
+		
+		if (switch_core_session_private_event_count(session)) {
+			switch_ivr_parse_all_events(session);
+		}
+
+		if (args && (args->input_callback || args->buf || args->buflen)) {
+			switch_dtmf_t dtmf;
+			
+			/*
+			   dtmf handler function you can hook up to be executed when a digit is dialed during playback 
+			   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
+			 */
+			if (switch_channel_has_dtmf(channel)) {
+				if (!args->input_callback && !args->buf) {
+					status = SWITCH_STATUS_BREAK;
+					break;
+				}
+				switch_channel_dequeue_dtmf(channel, &dtmf);
+				if (args->input_callback) {
+					status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+				} else {
+					switch_copy_string((char *) args->buf, (void *) &dtmf, args->buflen);
+					status = SWITCH_STATUS_BREAK;
+				}
+			}
+			
+			if (args->input_callback) {
+				switch_event_t *event = NULL;
+
+				if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+					status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
+					switch_event_destroy(&event);
+				}
+			}
+
+			if (status != SWITCH_STATUS_SUCCESS) {
+				break;
+			}
+		}
 
 		if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
 			switch_yield(1000);
@@ -436,15 +481,25 @@
 	int stream_id = 0;
 	switch_event_t *event;
 	switch_unicast_conninfo_t *conninfo = NULL;
-	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
+	switch_codec_t *read_codec;
 	uint32_t rate;
 	uint32_t bpf;
 
 	if (switch_channel_test_flag(channel, CF_CONTROLLED)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot park channels that is under control already.\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot park channels that are under control already.\n");
 		return SWITCH_STATUS_FALSE;
 	}
 
+	if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Careful, Channel is unanswered. Pre-answering...\n");
+		if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot establish media.\n");
+			return SWITCH_STATUS_FALSE;
+		}
+	}
+
+	read_codec = switch_core_session_get_read_codec(session);
+
 	if (!read_codec || !read_codec->implementation) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot park channels that have no read codec.\n");
 		return SWITCH_STATUS_FALSE;
@@ -453,11 +508,6 @@
 	rate = read_codec->implementation->actual_samples_per_second;
 	bpf = read_codec->implementation->bytes_per_frame;
 
-	if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Careful, Channel is unanswered. Pre-answering...\n");
-		switch_channel_pre_answer(channel);
-	}
-
 	switch_channel_set_flag(channel, CF_CONTROLLED);
 	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PARK) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(channel, event);
@@ -1710,6 +1760,64 @@
 }
 
 
+SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data)
+{
+	switch_xml_t x_domain, xml = NULL, x_user, x_param, x_params;
+	char *user, *mailbox, *domain;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	if (switch_strlen_zero(data)) {
+		goto error;
+	}
+
+	user = switch_core_session_strdup(session, data);
+
+	if (!(domain = strchr(user, '@'))) {
+		goto error;
+	}
+
+	*domain++ = '\0';
+
+	if (switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, NULL) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", user, domain);
+		goto done;
+	}
+
+	status = SWITCH_STATUS_SUCCESS;
+
+	if ((mailbox = (char *) switch_xml_attr(x_user, "mailbox"))) {
+		switch_channel_set_variable(channel, "mailbox", mailbox);
+	}
+
+	if ((x_params = switch_xml_child(x_user, "variables"))) {
+		for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
+			const char *var = switch_xml_attr(x_param, "name");
+			const char *val = switch_xml_attr(x_param, "value");
+
+			if (var && val) {
+				switch_channel_set_variable(channel, var, val);
+			}
+		}
+	}
+
+	switch_channel_set_variable(channel, "user_name", user);
+	switch_channel_set_variable(channel, "domain_name", domain);
+
+	goto done;
+
+  error:
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No user at domain specified.\n");
+
+  done:
+	if (xml) {
+		switch_xml_free(xml);
+	}
+
+	return status;
+}
+
+
 /* For Emacs:
  * Local Variables:
  * mode:c
@@ -1718,5 +1826,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c	Mon Aug  4 21:29:58 2008
@@ -127,6 +127,7 @@
 	switch_file_handle_t fh;
 	int mux;
 	int loop;
+	char *file;
 } displace_helper_t;
 
 static switch_bool_t write_displace_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
@@ -182,6 +183,12 @@
 					uint32_t pos = 0;
 					switch_core_file_seek(&dh->fh, &pos, 0, SEEK_SET);
 				} else {
+					switch_core_session_t *session = switch_core_media_bug_get_session(bug);
+					switch_channel_t *channel;
+
+					if (session && (channel = switch_core_session_get_channel(session))) {
+						switch_channel_set_private(channel, dh->file, NULL);
+					}
 					return SWITCH_FALSE;
 				}
 			}
@@ -249,6 +256,12 @@
 					uint32_t pos = 0;
 					switch_core_file_seek(&dh->fh, &pos, 0, SEEK_SET);
 				} else {
+					switch_core_session_t *session = switch_core_media_bug_get_session(bug);
+					switch_channel_t *channel;
+
+					if (session && (channel = switch_core_session_get_channel(session))) {
+						switch_channel_set_private(channel, dh->file, NULL);
+					}
 					return SWITCH_FALSE;
 				}
 			}
@@ -302,6 +315,7 @@
 
 	dh->fh.channels = read_codec->implementation->number_of_channels;
 	dh->fh.samplerate = read_codec->implementation->actual_samples_per_second;
+	dh->file = switch_core_session_strdup(session, file);
 
 	if (switch_core_file_open(&dh->fh,
 							  file,
@@ -495,6 +509,7 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
+	int codec_initialized = 0;
 
 	if ((tsession = switch_core_session_locate(uuid))) {
 		struct eavesdrop_pvt *ep = NULL;
@@ -527,8 +542,30 @@
 
 
 		if (!switch_strlen_zero(require_group)) {
+			int argc, i;
+			int ok = 0;
+			char *argv[10] = { 0 };
+			char *data;
+
 			const char *group_name = switch_channel_get_variable(tchannel, "eavesdrop_group");
-			if (!group_name || strcmp(group_name, require_group)) {
+			/* If we don't have a group, then return */
+			if (!group_name) {
+				status = SWITCH_STATUS_BREAK;
+				goto end;
+			}
+			/* Separate the group */
+			data = strdup(group_name);
+			if ( (argc = switch_separate_string(data, ',', argv, (sizeof(argv) / sizeof(argv[0])))) ) {
+				for ( i = 0; i < argc; i++ ) {
+					/* If one of the group matches, then ok */
+					if (argv[i] && !strcmp(argv[i], require_group)) {
+						ok = 1;
+					}
+				}
+			}
+			switch_safe_free(data);
+			/* If we didn't find any match, then end */
+			if ( !ok ) {
 				status = SWITCH_STATUS_BREAK;
 				goto end;
 			}
@@ -554,6 +591,8 @@
 			goto end;
 		}
 
+		codec_initialized = 1;
+
 		switch_core_session_set_read_codec(session, &codec);
 		write_frame.codec = &codec;
 		write_frame.data = buf;
@@ -683,8 +722,8 @@
 		}
 
 	  end:
-
-		switch_core_codec_destroy(&codec);
+		if ( codec_initialized )
+			switch_core_codec_destroy(&codec);
 
 		if (bug) {
 			switch_core_media_bug_remove(tsession, &bug);
@@ -707,7 +746,6 @@
 		switch_core_session_rwunlock(tsession);
 		status = SWITCH_STATUS_SUCCESS;
 
-		switch_core_session_set_read_codec(session, read_codec);
 		switch_core_session_reset(session, SWITCH_TRUE);
 	}
 
@@ -1465,6 +1503,7 @@
 	switch_mutex_t *mutex;
 	switch_thread_cond_t *cond;
 	switch_memory_pool_t *pool;
+	int ready;
 };
 
 static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj)
@@ -1480,6 +1519,8 @@
 	switch_core_session_read_lock(sth->session);
 	switch_mutex_lock(sth->mutex);
 
+	sth->ready = 1;
+
 	while (switch_channel_ready(channel) && !switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
 		char *xmlstr = NULL;
 
@@ -1493,6 +1534,49 @@
 				goto done;
 			}
 
+			if (status == SWITCH_STATUS_SUCCESS && switch_true(switch_channel_get_variable(channel, "asr_intercept_dtmf"))) {
+				const char *p;
+
+				if ((p = switch_stristr("<input>", xmlstr))) {
+					p += 7;
+				}
+				
+				while(p && *p) {
+					char c;
+
+					if (*p == '<') {
+						break;
+					}
+					
+					if (!strncasecmp(p, "pound", 5)) {
+						c = '#';
+						p += 5;
+					} else if (!strncasecmp(p, "hash", 4)) {
+						c = '#';
+						p += 4;
+					} else if (!strncasecmp(p, "star", 4)) {
+						c = '*';
+						p += 4;
+					} else if (!strncasecmp(p, "asterisk", 8)) {
+						c = '*';
+						p += 8;
+					} else {
+						c = *p;
+						p++;
+					}
+					
+					if (is_dtmf(c)) {
+						switch_dtmf_t dtmf;
+						dtmf.digit = c;
+						dtmf.duration = switch_core_default_dtmf_duration(0);
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Queue speech detected dtmf %c\n", c);
+						switch_channel_queue_dtmf(channel, &dtmf);						
+					}
+					
+				}
+				switch_ivr_resume_detect_speech(sth->session);
+			}
+
 			if (switch_event_create(&event, SWITCH_EVENT_DETECTED_SPEECH) == SWITCH_STATUS_SUCCESS) {
 				if (status == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Speech-Type", "detected-speech");
@@ -1551,9 +1635,11 @@
 		break;
 	case SWITCH_ABC_TYPE_CLOSE:{
 			switch_core_asr_close(sth->ah, &flags);
-			switch_mutex_lock(sth->mutex);
-			switch_thread_cond_signal(sth->cond);
-			switch_mutex_unlock(sth->mutex);
+			if (sth->mutex && sth->cond && sth->ready) {
+				switch_mutex_lock(sth->mutex);
+				switch_thread_cond_signal(sth->cond);
+				switch_mutex_unlock(sth->mutex);
+			}
 		}
 		break;
 	case SWITCH_ABC_TYPE_READ:
@@ -1564,9 +1650,11 @@
 					return SWITCH_FALSE;
 				}
 				if (switch_core_asr_check_results(sth->ah, &flags) == SWITCH_STATUS_SUCCESS) {
-					switch_mutex_lock(sth->mutex);
-					switch_thread_cond_signal(sth->cond);
-					switch_mutex_unlock(sth->mutex);
+					if (sth->mutex && sth->cond && sth->ready) {
+						switch_mutex_lock(sth->mutex);
+						switch_thread_cond_signal(sth->cond);
+						switch_mutex_unlock(sth->mutex);
+					}
 				}
 			}
 		}
@@ -1998,5 +2086,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c	Mon Aug  4 21:29:58 2008
@@ -382,6 +382,20 @@
 		switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
 	}
 
+	if (switch_true(switch_channel_get_variable(channel, SWITCH_COPY_XML_CDR_VARIABLE))) {
+		switch_xml_t cdr;
+		char *xml_text;
+
+		if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
+			if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
+				switch_channel_set_variable_partner(channel, "b_leg_cdr", xml_text);
+				switch_safe_free(xml_text);
+			}
+			switch_xml_free(cdr);
+		}
+	}
+
+
 	return SWITCH_STATUS_FALSE;
 }
 
@@ -481,7 +495,12 @@
 			}
 
 			if (!ready_b) {
-				switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+				const char *cid = switch_channel_get_variable(other_channel, "rdnis");
+				if (ready_a && cid) {
+					switch_ivr_session_transfer(session, cid, NULL, NULL);
+				} else {
+					switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+				}
 			}
 			switch_core_session_rwunlock(other_session);
 			return SWITCH_STATUS_FALSE;
@@ -682,7 +701,6 @@
 	if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA) ||
 		switch_channel_test_flag(peer_channel, CF_RING_READY)) {
 		switch_core_session_message_t msg = { 0 };
-		const switch_application_interface_t *application_interface;
 		const char *app, *data;
 
 		switch_channel_set_state(peer_channel, CS_CONSUME_MEDIA);
@@ -748,16 +766,12 @@
 
 			if ((app = switch_channel_get_variable(caller_channel, "bridge_pre_execute_aleg_app"))) {
 				data = switch_channel_get_variable(caller_channel, "bridge_pre_execute_aleg_data");
-				if ((application_interface = switch_loadable_module_get_application_interface(app))) {
-					switch_core_session_exec(session, application_interface, data);
-				}
+				switch_core_session_execute_application(session, app, data);
 			}
 
 			if ((app = switch_channel_get_variable(caller_channel, "bridge_pre_execute_bleg_app"))) {
 				data = switch_channel_get_variable(caller_channel, "bridge_pre_execute_bleg_data");
-				if ((application_interface = switch_loadable_module_get_application_interface(app))) {
-					switch_core_session_exec(peer_session, application_interface, data);
-				}
+				switch_core_session_execute_application(peer_session, app, data);
 			}
 
 			switch_channel_set_private(peer_channel, "_bridge_", b_leg);
@@ -816,6 +830,7 @@
 	switch_channel_t *originator_channel, *originatee_channel, *swap_channel;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_caller_profile_t *cp, *originator_cp, *originatee_cp;
+	char *p;
 
 	if ((originator_session = switch_core_session_locate(originator_uuid))) {
 		if ((originatee_session = switch_core_session_locate(originatee_uuid))) {
@@ -886,6 +901,10 @@
 			cp->destination_number = switch_core_strdup(cp->pool, originator_cp->caller_id_number);
 			cp->caller_id_number = switch_core_strdup(cp->pool, originator_cp->caller_id_number);
 			cp->caller_id_name = switch_core_strdup(cp->pool, originator_cp->caller_id_name);
+			cp->rdnis = switch_core_strdup(cp->pool, originatee_cp->destination_number);
+			if ((p = strchr(cp->rdnis, '@'))) {
+				*p = '\0';
+			}
 			switch_channel_set_caller_profile(originatee_channel, cp);
 			switch_channel_set_originator_caller_profile(originatee_channel, switch_caller_profile_clone(originatee_session, originator_cp));
 
@@ -893,6 +912,10 @@
 			cp->destination_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
 			cp->caller_id_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
 			cp->caller_id_name = switch_core_strdup(cp->pool, originatee_cp->caller_id_name);
+			cp->rdnis = switch_core_strdup(cp->pool, originator_cp->destination_number);
+			if ((p = strchr(cp->rdnis, '@'))) {
+				*p = '\0';
+			}
 			switch_channel_set_caller_profile(originator_channel, cp);
 			switch_channel_set_originatee_caller_profile(originator_channel, switch_caller_profile_clone(originator_session, originatee_cp));
 
@@ -951,7 +974,7 @@
 SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid, switch_bool_t bleg)
 {
 	switch_core_session_t *rsession, *bsession = NULL;
-	switch_channel_t *channel, *rchannel, *bchannel;
+	switch_channel_t *channel, *rchannel, *bchannel = NULL;
 	const char *buuid;
 	char brto[SWITCH_UUID_FORMATTED_LENGTH + 1] = "";
 
@@ -976,24 +999,31 @@
 
 	if ((buuid = switch_channel_get_variable(rchannel, SWITCH_SIGNAL_BOND_VARIABLE))) {
 		bsession = switch_core_session_locate(buuid);
+		bchannel = switch_core_session_get_channel(bsession);
 	}
 
 	if (!switch_channel_test_flag(rchannel, CF_ANSWERED)) {
 		switch_channel_answer(rchannel);
 	}
-	//switch_ivr_park_session(rsession);
+
 	switch_channel_set_state_flag(rchannel, CF_TRANSFER);
-	switch_channel_set_state(rchannel, CS_RESET);
+	switch_channel_set_state(rchannel, CS_PARK);
+	
+	if (bchannel) {
+		switch_channel_set_state_flag(bchannel, CF_TRANSFER);
+		switch_channel_set_state(bchannel, CS_PARK);
+	}
+
+	switch_ivr_uuid_bridge(switch_core_session_get_uuid(session), uuid);
+	switch_core_session_rwunlock(rsession);
 
 	if (bsession) {
-		bchannel = switch_core_session_get_channel(bsession);
 		switch_channel_hangup(bchannel, SWITCH_CAUSE_PICKED_OFF);
 		switch_core_session_rwunlock(bsession);
 	}
 
-	switch_core_session_rwunlock(rsession);
+	
 
-	switch_ivr_uuid_bridge(switch_core_session_get_uuid(session), uuid);
 }
 
 /* For Emacs:
@@ -1004,5 +1034,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c	Mon Aug  4 21:29:58 2008
@@ -501,7 +501,7 @@
 			}
 			errs++;
 			if (status == SWITCH_STATUS_SUCCESS) {
-				status = switch_ivr_sleep(session, 1000);
+				status = switch_ivr_sleep(session, 1000, NULL);
 			}
 			/* breaks are ok too */
 			if (SWITCH_STATUS_IS_BREAK(status)) {
@@ -782,5 +782,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c	Mon Aug  4 21:29:58 2008
@@ -40,7 +40,7 @@
 
 	if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) {
 		while (switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
-			switch_ivr_sleep(session, 10);
+			switch_ivr_sleep(session, 10, NULL);
 		}
 	}
 
@@ -115,7 +115,6 @@
 			goto wbreak;
 		}
 
-		switch_channel_set_state(channel, CS_SOFT_EXECUTE);
 		switch_core_session_exec(collect->session, application_interface, app_data);
 
 		if (switch_channel_get_state(channel) < CS_HANGUP) {
@@ -166,7 +165,8 @@
 
 static uint8_t check_channel_status(switch_channel_t **peer_channels,
 									switch_core_session_t **peer_sessions,
-									uint32_t len, int32_t *idx, uint32_t *hups, char *file, char *key, uint8_t early_ok, uint8_t *ring_ready,
+									uint32_t len, int32_t *idx, uint32_t *hups, char *file, char *key, uint8_t early_ok, 
+									uint8_t *ring_ready, uint8_t *progress,
 									uint8_t return_ring_ready)
 {
 
@@ -182,6 +182,9 @@
 		if (!*ring_ready && switch_channel_test_flag(peer_channels[i], CF_RING_READY)) {
 			*ring_ready = 1;
 		}
+		if (!*ring_ready && switch_channel_test_flag(peer_channels[i], CF_EARLY_MEDIA)) {
+			*progress = 1;
+		}
 
 		state = switch_channel_get_state(peer_channels[i]);
 		if (state >= CS_HANGUP || state == CS_RESET || switch_channel_test_flag(peer_channels[i], CF_TRANSFER) ||
@@ -189,7 +192,7 @@
 			) {
 			(*hups)++;
 		} else if ((switch_channel_test_flag(peer_channels[i], CF_ANSWERED) ||
-					(early_ok && len == 1 && switch_channel_test_flag(peer_channels[i], CF_EARLY_MEDIA)) ||
+					(early_ok && switch_channel_test_flag(peer_channels[i], CF_EARLY_MEDIA)) ||
 					(*ring_ready && return_ring_ready && len == 1 && switch_channel_test_flag(peer_channels[i], CF_RING_READY))
 				   )
 				   && !switch_channel_test_flag(peer_channels[i], CF_TAGGED)
@@ -253,7 +256,7 @@
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t *session, switch_core_session_t *peer_session)
 {
-	switch_channel_t *caller_channel = switch_core_session_get_channel(session);
+	switch_channel_t *caller_channel = NULL;
 	switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
 	const char *ringback_data = NULL;
 	switch_frame_t write_frame = { 0 };
@@ -265,9 +268,15 @@
 	switch_frame_t *read_frame = NULL;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	int timelimit = 60;
-	const char *var = switch_channel_get_variable(caller_channel, "call_timeout");
+	const char *var;
 	switch_time_t start = 0;
 
+	switch_assert(peer_channel);
+	
+	if (session) {
+		caller_channel = switch_core_session_get_channel(session);
+	}
+
 	if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -275,7 +284,7 @@
 	switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
 	write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 
-	if (var) {
+	if (caller_channel && (var = switch_channel_get_variable(caller_channel, "call_timeout"))) {
 		timelimit = atoi(var);
 		if (timelimit < 0) {
 			timelimit = 60;
@@ -285,17 +294,23 @@
 	timelimit *= 1000000;
 	start = switch_timestamp_now();
 
-	if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
-		ringback_data = switch_channel_get_variable(caller_channel, "transfer_ringback");
-	}
+	if (caller_channel) {
+		if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
+			ringback_data = switch_channel_get_variable(caller_channel, "transfer_ringback");
+		}
+		
+		if (!ringback_data) {
+			ringback_data = switch_channel_get_variable(caller_channel, "ringback");
+		}
+
 
-	if (!ringback_data) {
-		ringback_data = switch_channel_get_variable(caller_channel, "ringback");
+		if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) || switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)) {
+			ringback_data = NULL;
+		}
 	}
 
 
-	if (read_codec && (ringback_data ||
-					   (!(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) && switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA))))) {
+	if (read_codec && ringback_data) {
 		if (!(pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) {
 			if (switch_core_codec_init(&write_codec,
 									   "L16",
@@ -363,7 +378,9 @@
 				}
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec Error!\n");
-				switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE);
+				if (caller_channel) {
+					switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE);
+				}
 				read_codec = NULL;
 			}
 		}
@@ -441,11 +458,9 @@
 		switch_buffer_destroy(&ringback.audio_buffer);
 	}
 
-	if (!pass && write_codec.implementation) {
-		if (read_codec && !ringback.asis) {
-			switch_core_session_set_read_codec(session, read_codec);
-			switch_core_session_reset(session, SWITCH_TRUE);
-		}
+	switch_core_session_reset(session, SWITCH_TRUE);
+
+	if (write_codec.implementation) {
 		switch_core_codec_destroy(&write_codec);
 	}
 
@@ -454,6 +469,29 @@
 	return status;
 }
 
+static void process_import(switch_core_session_t *session, switch_channel_t *peer_channel)
+{
+	const char *import, *val;
+	switch_channel_t *caller_channel;
+
+	switch_assert(session && peer_channel);
+	caller_channel = switch_core_session_get_channel(session);
+	
+	if ((import = switch_channel_get_variable(caller_channel, "import"))) {
+		char *mydata = switch_core_session_strdup(session, import);
+		int i, argc;
+		char *argv[64] = { 0 };
+
+		if ((argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+			for(i = 0; i < argc; i++) {
+				if ((val = switch_channel_get_variable(peer_channel, argv[i]))) {
+					switch_channel_set_variable(caller_channel, argv[i], val);
+				}
+			}
+		}
+	}
+}
+
 #define MAX_PEERS 128
 SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session,
 													 switch_core_session_t **bleg,
@@ -485,17 +523,18 @@
 	switch_frame_t write_frame = { 0 };
 	uint8_t pass = 0;
 	char key[80] = SWITCH_BLANK_STRING, file[512] = SWITCH_BLANK_STRING, *odata, *var;
-	switch_call_cause_t reason = SWITCH_CAUSE_UNALLOCATED;
+	switch_call_cause_t reason = SWITCH_CAUSE_NONE;
 	uint8_t to = 0;
 	char *var_val, *vars = NULL;
 	const char *ringback_data = NULL;
 	switch_codec_t *read_codec = NULL;
-	uint8_t sent_ring = 0, early_ok = 1, return_ring_ready = 0;
+	uint8_t sent_ring = 0, early_ok = 1, return_ring_ready = 0, progress = 0;
 	switch_core_session_message_t *message = NULL;
 	switch_event_t *var_event = NULL;
 	uint8_t fail_on_single_reject = 0;
 	uint8_t ring_ready = 0;
 	char *loop_data = NULL;
+	uint32_t progress_timelimit_sec = 0;
 
 	switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
 	write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
@@ -573,6 +612,8 @@
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "originate_timeout")) {
 					ok = 1;
+				} else if (!strcasecmp((char *) hi->name, "progress_timeout")) {
+					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "originate_retry_sleep_ms")) {
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "origination_caller_id_name")) {
@@ -656,13 +697,20 @@
 		return_ring_ready = 1;
 	}
 
-	if ((var_val = switch_event_get_header(var_event, "originate_timeout")) && switch_true(var_val)) {
+	if ((var_val = switch_event_get_header(var_event, "originate_timeout"))) {
 		int tmp = atoi(var_val);
 		if (tmp > 0) {
 			timelimit_sec = (uint32_t) tmp;
 		}
 	}
 
+	if ((var_val = switch_event_get_header(var_event, "progress_timeout"))) {
+		int tmp = atoi(var_val);
+		if (tmp > 0) {
+			progress_timelimit_sec = (uint32_t) tmp;
+		}
+	}
+
 	if ((var_val = switch_event_get_header(var_event, "originate_retries")) && switch_true(var_val)) {
 		int32_t tmp;
 		tmp = atoi(var_val);
@@ -677,7 +725,7 @@
 	if ((var_val = switch_event_get_header(var_event, "originate_retry_sleep_ms")) && switch_true(var_val)) {
 		int32_t tmp;
 		tmp = atoi(var_val);
-		if (tmp > 500 && tmp < 60000) {
+		if (tmp >= 500 && tmp <= 60000) {
 			sleep_ms = tmp;
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
@@ -685,14 +733,22 @@
 		}
 	}
 
-	if (!cid_name_override) {
+	if (cid_name_override) {
+		switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_caller_id_name", cid_name_override);
+	} else {
 		cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name");
 	}
 
-	if (!cid_num_override) {
+	if (cid_num_override) {
+		switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_caller_id_number", cid_num_override);
+	} else {
 		cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number");
 	}
 
+	if (!progress_timelimit_sec) {
+		progress_timelimit_sec = timelimit_sec;
+	}
+
 	for (try = 0; try < retries; try++) {
 		switch_safe_free(loop_data);
 		loop_data = strdup(data);
@@ -706,7 +762,10 @@
 
 		for (r = 0; r < or_argc; r++) {
 			uint32_t hups;
-			reason = SWITCH_CAUSE_UNALLOCATED;
+			char *p, *e = NULL;
+			const char *var_begin, *var_end;
+			
+			reason = SWITCH_CAUSE_NONE;
 			memset(peer_names, 0, sizeof(peer_names));
 			peer_session = NULL;
 			memset(peer_sessions, 0, sizeof(peer_sessions));
@@ -723,12 +782,31 @@
 			pass = 0;
 			var = NULL;
 			to = 0;
+			sent_ring = 0;
+			progress = 0;
 
 			if (try > 0) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Originate attempt %d/%d in %d ms\n", try + 1, retries, sleep_ms);
 				switch_yield(sleep_ms * 1000);
 			}
+			
+			p = pipe_names[r];
+			while(p && *p) {
+				if (*p == '[') {
+					e = switch_find_end_paren(p, '[', ']');
+				}
 
+				if (e && p && *p == ',') {
+					*p = '|';
+				}
+
+				if (p == e) {
+					e = NULL;
+				}
+
+				p++;
+			}
+			
 			and_argc = switch_separate_string(pipe_names[r], ',', peer_names, (sizeof(peer_names) / sizeof(peer_names[0])));
 
 			if ((flags & SOF_NOBLOCK) && and_argc > 1) {
@@ -738,7 +816,7 @@
 
 			for (i = 0; i < and_argc; i++) {
 				char *vdata;
-				char *e = NULL;
+				e = NULL;
 				chan_type = peer_names[i];
 
 				while (chan_type && *chan_type && *chan_type == ' ') {
@@ -817,6 +895,31 @@
 						myflags |= SOF_FORKED_DIAL;
 					}
 				}
+
+				if (vdata && (var_begin = switch_stristr("origination_caller_id_number=", vdata))) {
+					char tmp[512] = "";
+					var_begin += strlen("origination_caller_id_number=");
+					var_end = strchr(var_begin, '|');
+					if (var_end) {
+						strncpy(tmp, var_begin, var_end-var_begin);
+					} else {
+						strncpy(tmp, var_begin, strlen(var_begin));
+					}
+					new_profile->caller_id_number = switch_core_strdup(new_profile->pool, tmp);
+				}
+
+				if (vdata && (var_begin = switch_stristr("origination_caller_id_name=", vdata))) {
+					char tmp[512] = "";
+					var_begin += strlen("origination_caller_id_name=");
+					var_end = strchr(var_begin, '|');
+					if (var_end) {
+						strncpy(tmp, var_begin, var_end-var_begin);
+					} else {
+						strncpy(tmp, var_begin, strlen(var_begin));
+					}
+					new_profile->caller_id_name = switch_core_strdup(new_profile->pool, tmp);
+				}
+
 				if ((reason =
 					 switch_core_session_outgoing_channel(session, var_event, chan_type, new_profile, &new_session, &pool,
 														  myflags)) != SWITCH_CAUSE_SUCCESS) {
@@ -839,7 +942,7 @@
 				if (vdata) {
 					char *var_array[1024] = { 0 };
 					int var_count = 0;
-					if ((var_count = switch_separate_string(vdata, ',', var_array, (sizeof(var_array) / sizeof(var_array[0]))))) {
+					if ((var_count = switch_separate_string(vdata, '|', var_array, (sizeof(var_array) / sizeof(var_array[0]))))) {
 						int x = 0;
 						for (x = 0; x < var_count; x++) {
 							char *inner_var_array[2] = { 0 };
@@ -924,6 +1027,12 @@
 						goto notready;
 					}
 
+					if (!sent_ring && !progress && progress_timelimit_sec && (switch_timestamp(NULL) - start) > (time_t) progress_timelimit_sec) {
+						to++;
+						idx = IDX_TIMEOUT;
+						goto notready;
+					}
+
 					switch_yield(10000);
 				}
 
@@ -936,6 +1045,12 @@
 
 		  endfor1:
 
+			if (caller_channel) {
+				if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) || switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)) {
+					ringback_data = NULL;
+				}
+			}
+
 			if (ringback_data && !switch_channel_test_flag(caller_channel, CF_ANSWERED)
 				&& !switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
 				if ((status = switch_channel_pre_answer(caller_channel)) != SWITCH_STATUS_SUCCESS) {
@@ -944,10 +1059,7 @@
 				}
 			}
 
-			if (session && (read_codec = switch_core_session_get_read_codec(session)) &&
-				(ringback_data ||
-				 (!(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) && switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA))))) {
-
+			if (session && (read_codec = switch_core_session_get_read_codec(session)) && ringback_data) {
 				if (!(pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) {
 					if (switch_core_codec_init(&write_codec,
 											   "L16",
@@ -1030,8 +1142,8 @@
 			}
 
 			while ((!caller_channel || switch_channel_ready(caller_channel)) &&
-				   check_channel_status(peer_channels, peer_sessions, and_argc, &idx, &hups, file, key, early_ok, &ring_ready, return_ring_ready)) {
-
+				   check_channel_status(peer_channels, peer_sessions, and_argc, &idx, &hups, file, key, early_ok, &ring_ready, &progress, return_ring_ready)) {
+				
 				if (caller_channel && !sent_ring && ring_ready && !return_ring_ready) {
 					switch_channel_ring_ready(caller_channel);
 					sent_ring = 1;
@@ -1102,8 +1214,10 @@
 							}
 						}
 
-						if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
-							break;
+						if ((ringback.fh || ringback.audio_buffer) && write_frame.codec && write_frame.datalen) {
+							if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
+								break;
+							}
 						}
 					}
 
@@ -1172,6 +1286,9 @@
 				peer_channel = peer_channels[idx];
 			} else {
 				status = SWITCH_STATUS_FALSE;
+				if (caller_channel && peer_channel) {
+					process_import(session, peer_channel);
+				}
 				peer_channel = NULL;
 				goto done;
 			}
@@ -1202,7 +1319,8 @@
 			}
 
 		  done:
-			*cause = SWITCH_CAUSE_UNALLOCATED;
+			
+			*cause = SWITCH_CAUSE_NONE;
 
 			if (caller_channel && !switch_channel_ready(caller_channel)) {
 				status = SWITCH_STATUS_FALSE;
@@ -1211,13 +1329,26 @@
 			if (status == SWITCH_STATUS_SUCCESS) {
 				if (caller_channel) {
 					switch_channel_set_variable(caller_channel, "originate_disposition", "call accepted");
+					if (peer_channel) {
+						process_import(session, peer_channel);
+					}
 				}
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n", switch_channel_get_name(peer_channel));
 				*cause = SWITCH_CAUSE_SUCCESS;
 
 			} else {
+				const char *cdr_var = NULL;
+				int cdr_total = 0;
+				switch_xml_t cdr;
+				char *xml_text;
+				char buf[128] = "", buf2[128] = "";
+
+				if (caller_channel) {
+					cdr_var = switch_channel_get_variable(caller_channel, "failed_xml_cdr_prefix");
+				}
+
 				if (peer_channel) {
-					*cause = switch_channel_get_cause(peer_channel);
+					*cause = switch_channel_get_cause(peer_channel);					
 				} else {
 					for (i = 0; i < and_argc; i++) {
 						if (!peer_channels[i]) {
@@ -1227,6 +1358,28 @@
 						break;
 					}
 				}
+				
+				if (cdr_var) {
+					for (i = 0; i < and_argc; i++) {
+						if (!peer_sessions[i]) {
+                            continue;
+                        }
+						
+						if (switch_ivr_generate_xml_cdr(peer_sessions[i], &cdr) == SWITCH_STATUS_SUCCESS) {
+							if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
+								switch_snprintf(buf, sizeof(buf), "%s_%d", cdr_var, ++cdr_total);
+								switch_channel_set_variable(caller_channel, buf, xml_text);
+								switch_safe_free(xml_text);
+							}
+							switch_xml_free(cdr);
+							cdr = NULL;
+						}
+
+					}
+					switch_snprintf(buf, sizeof(buf), "%s_total", cdr_var);
+					switch_snprintf(buf2, sizeof(buf2), "%d", cdr_total ? cdr_total : 0);
+					switch_channel_set_variable(caller_channel, buf, buf2);
+				}
 
 				if (!*cause) {
 					if (reason) {
@@ -1238,7 +1391,7 @@
 					}
 				}
 
-				if (*cause == SWITCH_CAUSE_SUCCESS || *cause == SWITCH_CAUSE_UNALLOCATED) {
+				if (*cause == SWITCH_CAUSE_SUCCESS || *cause == SWITCH_CAUSE_NONE) {
 					*cause = SWITCH_CAUSE_ORIGINATOR_CANCEL;
 				}
 
@@ -1265,23 +1418,27 @@
 				switch_buffer_destroy(&ringback.audio_buffer);
 			}
 
-			if (!pass && write_codec.implementation) {
-				if (read_codec && !ringback.asis) {
-					switch_core_session_set_read_codec(session, read_codec);
-					switch_core_session_reset(session, SWITCH_FALSE);
-				}
-				switch_core_codec_destroy(&write_codec);
+			if (session) {
+				switch_core_session_reset(session, SWITCH_FALSE);
 			}
 
+			if (write_codec.implementation) {
+				switch_core_codec_destroy(&write_codec);
+			}
 
 			for (i = 0; i < and_argc; i++) {
 				if (!peer_channels[i]) {
 					continue;
 				}
 				switch_channel_clear_flag(peer_channels[i], CF_ORIGINATING);
-				if (status == SWITCH_STATUS_SUCCESS && bleg && *bleg && *bleg == peer_sessions[i]) {
-					continue;
+				if (status == SWITCH_STATUS_SUCCESS) { 
+					if (bleg && *bleg && *bleg == peer_sessions[i]) {
+						continue;
+					}
+				} else if (switch_channel_get_state(switch_core_session_get_channel(peer_sessions[i])) < CS_HANGUP) {
+					switch_channel_hangup(switch_core_session_get_channel(peer_sessions[i]), *cause);
 				}
+
 				switch_core_session_rwunlock(peer_sessions[i]);
 			}
 
@@ -1315,5 +1472,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c	Mon Aug  4 21:29:58 2008
@@ -567,7 +567,6 @@
 		}
 	}
 
-	switch_core_session_set_read_codec(session, read_codec);
 	switch_core_file_close(fh);
 	switch_core_session_reset(session, SWITCH_TRUE);
 	return status;
@@ -730,6 +729,8 @@
 	const char *timer_name;
 	const char *prebuf;
 	const char *alt = NULL;
+	int eof = 0;
+	switch_size_t bread = 0;
 
 	switch_channel_pre_answer(channel);
 
@@ -954,13 +955,13 @@
 
 		if (!switch_channel_ready(channel)) {
 			status = SWITCH_STATUS_FALSE;
-			break;
+			break; 
 		}
 
 		if (switch_channel_test_flag(channel, CF_BREAK)) {
 			switch_channel_clear_flag(channel, CF_BREAK);
 			status = SWITCH_STATUS_BREAK;
-			break;
+			break; 
 		}
 
 		if (switch_core_session_private_event_count(session)) {
@@ -976,7 +977,7 @@
 				if (!args->input_callback && !args->buf) {
 					status = SWITCH_STATUS_BREAK;
 					done = 1;
-					break;
+					break; 
 				}
 				switch_channel_dequeue_dtmf(channel, &dtmf);
 				if (args->input_callback) {
@@ -998,7 +999,7 @@
 
 			if (status != SWITCH_STATUS_SUCCESS) {
 				done = 1;
-				break;
+				break; 
 			}
 		}
 
@@ -1009,19 +1010,47 @@
 			memset(abuf, 0, framelen);
 			olen = ilen;
 			do_speed = 0;
-		} else if (fh->sp_audio_buffer && (switch_buffer_inuse(fh->sp_audio_buffer) > (switch_size_t) (framelen))) {
-			switch_buffer_read(fh->sp_audio_buffer, abuf, framelen);
+		} else if (fh->sp_audio_buffer && (eof || (switch_buffer_inuse(fh->sp_audio_buffer) > (switch_size_t) (framelen)))) {
+			if (!(bread = switch_buffer_read(fh->sp_audio_buffer, abuf, framelen))) {
+				if (eof) {
+					continue;
+				} else {
+					break; 
+				}
+			}
+
+			if (bread < framelen) {
+				memset(abuf + bread, 0, framelen - bread);
+			}
+
 			olen = asis ? framelen : ilen;
 			do_speed = 0;
-		} else if (fh->audio_buffer && (switch_buffer_inuse(fh->audio_buffer) > (switch_size_t) (framelen))) {
-			switch_buffer_read(fh->audio_buffer, abuf, framelen);
+		} else if (fh->audio_buffer && (eof || (switch_buffer_inuse(fh->audio_buffer) > (switch_size_t) (framelen)))) {
+			if (!(bread = switch_buffer_read(fh->audio_buffer, abuf, framelen))) {
+				if (eof) {
+					break; 
+				} else {
+					continue;
+				}
+			}
+
+			if (bread < framelen) {
+				memset(abuf + bread, 0, framelen - bread);
+			}
+
 			olen = asis ? framelen : ilen;
 		} else {
+			if (eof) {
+				break;
+			}
 			olen = FILE_STARTSAMPLES;
 			if (!asis) {
 				olen /= 2;
 			}
-			switch_core_file_read(fh, abuf, &olen);
+			if (switch_core_file_read(fh, abuf, &olen) != SWITCH_STATUS_SUCCESS) {
+				eof++;
+				continue;
+			}
 			switch_buffer_write(fh->audio_buffer, abuf, asis ? olen : olen * 2);
 			olen = switch_buffer_read(fh->audio_buffer, abuf, framelen);
 			if (!asis) {
@@ -1030,7 +1059,7 @@
 		}
 
 		if (done || olen <= 0) {
-			break;
+			break; 
 		}
 
 		if (!asis) {
@@ -1114,7 +1143,8 @@
 			write_frame.timestamp = timer.samplecount;
 		}
 #ifndef WIN32
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if 0 // don't seem to need it, maybe only on mac?
+//#if SWITCH_BYTE_ORDER == __BIG_ENDIAN
 		if (!asis) {
 			switch_swap_linear(write_frame.data, (int) write_frame.datalen / 2);
 		}
@@ -1132,16 +1162,16 @@
 			continue;
 		} else if (status != SWITCH_STATUS_SUCCESS) {
 			done = 1;
-			break;
+			break; 
 		}
 
 		if (done) {
-			break;
+			break; 
 		}
 
 		if (timer_name) {
 			if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
-				break;
+				break; 
 			}
 		} else {				/* time off the channel (if you must) */
 			switch_frame_t *read_frame;
@@ -1153,7 +1183,7 @@
 			tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 
 			if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
-				break;
+				break; 
 			}
 
 			if (args && (args->read_frame_callback)) {
@@ -1164,7 +1194,7 @@
 				}
 				switch_clear_flag(fh, SWITCH_FILE_CALLBACK);
 				if (!ok) {
-					break;
+					break; 
 				}
 			}
 		}
@@ -1193,6 +1223,138 @@
 	return status;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_t *session, uint32_t thresh,
+															uint32_t silence_hits, uint32_t listen_hits, uint32_t timeout_ms, const char *file)
+{
+	uint32_t score, count = 0, j = 0;
+	double energy = 0;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	int divisor = 0;
+	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
+	uint32_t org_silence_hits = silence_hits;
+	uint32_t channels;
+	switch_frame_t *read_frame;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	int16_t *data;
+	uint32_t listening = 0;
+	int countdown = 0;
+	switch_codec_t raw_codec = {0};
+	int16_t *abuf = NULL;
+	switch_frame_t write_frame = {0};
+	switch_file_handle_t fh = {0};
+	int32_t sample_count = 0;
+
+	switch_assert(read_codec);
+
+	if (timeout_ms) {
+		sample_count = (read_codec->implementation->actual_samples_per_second / 1000) * timeout_ms;
+	}
+
+	if (file) {
+		if (switch_core_file_open(&fh,
+								  file,
+								  read_codec->implementation->number_of_channels,
+								  read_codec->implementation->actual_samples_per_second,
+								  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+			switch_core_session_reset(session, SWITCH_TRUE);
+			return SWITCH_STATUS_NOTFOUND;
+		}
+		switch_zmalloc(abuf, SWITCH_RECOMMENDED_BUFFER_SIZE);
+		write_frame.data = abuf;
+		write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
+	}
+
+
+	if (switch_core_codec_init(&raw_codec,
+							   "L16",
+							   NULL,
+							   read_codec->implementation->actual_samples_per_second,
+							   read_codec->implementation->microseconds_per_frame / 1000,
+							   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+							   NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+
+		status = SWITCH_STATUS_FALSE;
+		goto end;
+	}
+
+	write_frame.codec = &raw_codec;
+
+	divisor = read_codec->implementation->actual_samples_per_second / 8000;
+	channels = read_codec->implementation->number_of_channels;
+
+	switch_core_session_set_read_codec(session, &raw_codec);
+
+	while (switch_channel_ready(channel)) {
+
+		status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
+		
+		if (!SWITCH_READ_ACCEPTABLE(status)) {
+			break;
+		}
+
+		if (sample_count) {
+			sample_count -= raw_codec.implementation->samples_per_frame;
+			if (sample_count <= 0) {
+				break;
+			}
+		}
+		
+		if (abuf) {
+			switch_size_t olen = raw_codec.implementation->samples_per_frame;
+			
+			if (switch_core_file_read(&fh, abuf, &olen) != SWITCH_STATUS_SUCCESS) {
+                break;
+            }
+			
+			write_frame.samples = (uint32_t)olen;
+			write_frame.datalen = (uint32_t)(olen * sizeof(int16_t));
+			if ((status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0)) != SWITCH_STATUS_SUCCESS) {
+				break;
+			}
+		}
+		
+		if (countdown) {
+			if (!--countdown) {
+				break;
+			} else {
+				continue;
+			}
+		}
+
+		data = (int16_t *) read_frame->data;
+		
+		for (energy = 0, j = 0, count = 0; count < read_frame->samples; count++) {
+			energy += abs(data[j++]);
+			j += channels;
+		}
+		
+		score = (uint32_t) (energy / (read_frame->samples / divisor));
+		
+		if (score >= thresh) {
+			listening++;
+		}
+
+		if (listening > listen_hits && score < thresh) {
+			if (!--silence_hits) {
+				countdown = 25;
+			}
+		} else {
+			silence_hits = org_silence_hits;
+		}
+	}
+
+	switch_core_session_reset(session, SWITCH_FALSE);
+	switch_core_codec_destroy(&raw_codec);
+
+ end:
+
+	if (abuf) {
+		switch_core_file_close(&fh);
+	}
+
+	return status;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
 												uint32_t min_digits,
 												uint32_t max_digits,
@@ -1872,5 +2034,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c	Mon Aug  4 21:29:58 2008
@@ -138,6 +138,11 @@
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Endpoint '%s'\n", ptr->interface_name);
 				switch_core_hash_insert(loadable_modules.endpoint_hash, ptr->interface_name, (const void *) ptr);
+				if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
+					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "endpoint");
+					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name);
+					switch_event_fire(&event);
+				}
 			}
 		}
 	}
@@ -308,7 +313,7 @@
 			if (!ptr->interface_name) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to load asr interface from %s due to no interface name.\n", key);
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Asr interface '%s'\n", ptr->interface_name);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding ASR interface '%s'\n", ptr->interface_name);
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "asr");
 					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name);
@@ -412,8 +417,16 @@
 
 	if (old_module->module_interface->endpoint_interface) {
 		const switch_endpoint_interface_t *ptr;
+
 		for (ptr = old_module->module_interface->endpoint_interface; ptr; ptr = ptr->next) {
 			if (ptr->interface_name) {
+
+				switch_core_session_hupall_endpoint(ptr, SWITCH_CAUSE_SYSTEM_SHUTDOWN);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
+				switch_thread_rwlock_wrlock(ptr->rwlock);
+				switch_thread_rwlock_unlock(ptr->rwlock);
+			
+
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Endpoint '%s'\n", ptr->interface_name);
 				switch_core_hash_delete(loadable_modules.endpoint_hash, ptr->interface_name);
 			}
@@ -486,10 +499,14 @@
 
 	if (old_module->module_interface->application_interface) {
 		const switch_application_interface_t *ptr;
-
 		for (ptr = old_module->module_interface->application_interface; ptr; ptr = ptr->next) {
 			if (ptr->interface_name) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Application '%s'\n", ptr->interface_name);
+				switch_core_session_hupall_matching_var(SWITCH_CURRENT_APPLICATION_VARIABLE, ptr->interface_name, SWITCH_CAUSE_SYSTEM_SHUTDOWN);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
+				switch_thread_rwlock_wrlock(ptr->rwlock);
+				switch_thread_rwlock_unlock(ptr->rwlock);
+
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "application");
 					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name);
@@ -508,6 +525,11 @@
 		for (ptr = old_module->module_interface->api_interface; ptr; ptr = ptr->next) {
 			if (ptr->interface_name) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting API Function '%s'\n", ptr->interface_name);
+
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
+				switch_thread_rwlock_wrlock(ptr->rwlock);
+				switch_thread_rwlock_unlock(ptr->rwlock);
+
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "api");
 					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name);
@@ -813,7 +835,24 @@
 
 }
 
+SWITCH_DECLARE(switch_status_t) switch_loadable_module_exists(const char *mod)
+{
+	switch_status_t status;  
 
+	if (switch_strlen_zero(mod)) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	switch_mutex_lock(loadable_modules.mutex);
+	if (switch_core_hash_find(loadable_modules.module_hash, mod)) {
+		status = SWITCH_STATUS_SUCCESS;
+	} else {
+		status = SWITCH_STATUS_FALSE;
+	}
+	switch_mutex_unlock(loadable_modules.mutex);
+
+	return status;
+}
 
 SWITCH_DECLARE(switch_status_t) switch_loadable_module_unload_module(char *dir, char *fname, const char **err)
 {
@@ -826,6 +865,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Module is not unloadable.\n");
 			*err = "Module is not unloadable";
 			status = SWITCH_STATUS_NOUNLOAD;
+			goto end;
 		} else {
 			do_shutdown(module);
 		}
@@ -834,6 +874,7 @@
 		*err = "No such module!";
 		status = SWITCH_STATUS_FALSE;
 	}
+ end:
 	switch_mutex_unlock(loadable_modules.mutex);
 
 	return status;
@@ -1357,9 +1398,11 @@
 
 
 	if (cmd && (api = switch_loadable_module_get_api_interface(cmd)) != 0) {
+		switch_thread_rwlock_rdlock(api->rwlock);
 		if ((status = api->function(arg, session, stream)) != SWITCH_STATUS_SUCCESS) {
 			stream->write_function(stream, "COMMAND RETURNED ERROR!\n");
 		}
+		switch_thread_rwlock_unlock(api->rwlock);
 	} else {
 		status = SWITCH_STATUS_FALSE;
 		stream->write_function(stream, "INVALID COMMAND!\n");
@@ -1398,7 +1441,7 @@
 		} else {														\
 			mod->_TYPE_##_interface = i;								\
 		}																\
-																		\
+		switch_thread_rwlock_create(&i->rwlock, mod->pool);				\
 		return i; }
 
 
@@ -1459,5 +1502,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c	Mon Aug  4 21:29:58 2008
@@ -48,6 +48,7 @@
 struct switch_log_binding {
 	switch_log_function_t function;
 	switch_log_level_t level;
+	int is_console;
 	struct switch_log_binding *next;
 };
 
@@ -60,6 +61,20 @@
 static switch_queue_t *LOG_RECYCLE_QUEUE = NULL;
 static int8_t THREAD_RUNNING = 0;
 static uint8_t MAX_LEVEL = 0;
+static int mods_loaded = 0;
+static int console_mods_loaded = 0;
+static switch_bool_t COLORIZE = SWITCH_FALSE;
+
+#ifdef WIN32
+static HANDLE hStdout;
+static WORD wOldColorAttrs;
+static CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
+
+static WORD 
+#else
+static const char*
+#endif
+COLORS[] = { SWITCH_SEQ_DEFAULT_COLOR, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN, SWITCH_SEQ_FGREEN, SWITCH_SEQ_FYELLOW };
 
 SWITCH_DECLARE(const char *) switch_log_level2str(switch_log_level_t level)
 {
@@ -116,7 +131,34 @@
 	return level;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(switch_log_function_t function, switch_log_level_t level)
+SWITCH_DECLARE(switch_status_t) switch_log_unbind_logger(switch_log_function_t function)
+{
+	switch_log_binding_t *ptr = NULL, *last = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	switch_mutex_lock(BINDLOCK);
+	for (ptr = BINDINGS; ptr; ptr = ptr->next) {
+		if (ptr->function == function) {
+			if (last) {
+				last->next = ptr->next;
+			} else {
+				BINDINGS = ptr->next;
+			}
+			status = SWITCH_STATUS_SUCCESS;
+			mods_loaded--;
+			if (ptr->is_console) {
+				console_mods_loaded--;
+			}
+			break;
+		}
+		last = ptr;
+	}
+	switch_mutex_unlock(BINDLOCK);
+
+	return status;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(switch_log_function_t function, switch_log_level_t level, switch_bool_t is_console)
 {
 	switch_log_binding_t *binding = NULL, *ptr = NULL;
 	switch_assert(function != NULL);
@@ -131,6 +173,7 @@
 
 	binding->function = function;
 	binding->level = level;
+	binding->is_console = is_console;
 
 	switch_mutex_lock(BINDLOCK);
 	for (ptr = BINDINGS; ptr && ptr->next; ptr = ptr->next);
@@ -140,6 +183,10 @@
 	} else {
 		BINDINGS = binding;
 	}
+	if (is_console) {
+		console_mods_loaded++;
+	}
+	mods_loaded++;
 	switch_mutex_unlock(BINDLOCK);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -186,6 +233,7 @@
 	return NULL;
 }
 
+#define do_mods (LOG_QUEUE && THREAD_RUNNING)
 SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
 									   const char *userdata, switch_log_level_t level, const char *fmt, ...)
 {
@@ -205,6 +253,8 @@
 		return;
 	}
 
+	switch_assert(level < SWITCH_LOG_INVALID);
+
 	va_start(ap, fmt);
 
 	handle = switch_core_data_channel(channel);
@@ -254,8 +304,8 @@
 
 		goto end;
 	}
-
-	if (level == SWITCH_LOG_CONSOLE || !LOG_QUEUE || !THREAD_RUNNING) {
+	
+	if (console_mods_loaded == 0 || !do_mods) {
 		if (handle) {
 			int aok = 1;
 #ifndef WIN32
@@ -276,10 +326,23 @@
 			}
 #endif
 			if (aok) {
-				fprintf(handle, "%s", data);
+				if (COLORIZE) {
+
+#ifdef WIN32
+					SetConsoleTextAttribute(hStdout, COLORS[level]);
+					WriteFile(hStdout, data, (DWORD) strlen(data), NULL, NULL);
+					SetConsoleTextAttribute(hStdout, wOldColorAttrs);
+#else
+					fprintf(handle, "%s%s%s", COLORS[level], data, SWITCH_SEQ_DEFAULT_COLOR);
+#endif
+				} else {
+					fprintf(handle, "%s", data);
+				}
 			}
 		}
-	} else if (level <= MAX_LEVEL) {
+	} 
+
+	if (do_mods && level <= MAX_LEVEL) {
 		switch_log_node_t *node;
 		void *pop = NULL;
 
@@ -318,11 +381,11 @@
 	}
 }
 
-SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool, switch_bool_t colorize)
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr;;
-
+	
 	switch_assert(pool != NULL);
 
 	LOG_POOL = pool;
@@ -340,6 +403,20 @@
 	while (!THREAD_RUNNING) {
 		switch_yield(1000);
 	}
+
+	if (colorize) {
+#ifdef WIN32
+				hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
+				if (switch_core_get_console() == stdout && hStdout != INVALID_HANDLE_VALUE && GetConsoleScreenBufferInfo(hStdout, &csbiInfo)) {
+					wOldColorAttrs = csbiInfo.wAttributes;
+					COLORIZE = SWITCH_TRUE;
+				}
+#else
+				COLORIZE = SWITCH_TRUE;
+#endif
+	}
+
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -375,5 +452,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c	Mon Aug  4 21:29:58 2008
@@ -196,6 +196,9 @@
 	SQLCHAR sql[255] = "";
 	int max_tries = 120;
 
+	SQLRETURN rc;
+	SQLSMALLINT nresultcols;
+
   top:
 
 	if (!handle) {
@@ -219,10 +222,15 @@
 
 	result = SQLExecute(stmt);
 
-	SQLRowCount(stmt, &m);
-	ret = (int) m;
-
-	if (result < 0 || m < 0) {
+	SQLRowCount (stmt, &m);
+	rc = SQLNumResultCols (stmt, &nresultcols);
+	if (rc != SQL_SUCCESS){
+		goto error;
+	}
+	ret = (int) nresultcols;
+	/* determine statement type */
+	if (nresultcols <= 0) {
+		/* statement is not a select statement */
 		goto error;
 	}
 
@@ -453,5 +461,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c	Mon Aug  4 21:29:58 2008
@@ -351,5 +351,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c	Mon Aug  4 21:29:58 2008
@@ -213,5 +213,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_resample.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_resample.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_resample.c	Mon Aug  4 21:29:58 2008
@@ -281,5 +281,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c	Mon Aug  4 21:29:58 2008
@@ -121,7 +121,13 @@
 };
 
 struct switch_rtp {
-	switch_socket_t *sock;
+	/* 
+	 * Two sockets are needed because we might be transcoding protocol families
+	 * (e.g. receive over IPv4 and send over IPv6). In case the protocol
+	 * families are equal, sock_input == sock_output and only one socket is
+	 * used.
+	 */
+	switch_socket_t *sock_input, *sock_output;
 
 	switch_sockaddr_t *local_addr;
 	rtp_msg_t send_msg;
@@ -129,6 +135,9 @@
 	switch_sockaddr_t *remote_addr;
 	rtp_msg_t recv_msg;
 
+
+	switch_sockaddr_t *remote_stun_addr;
+
 	uint32_t autoadj_window;
 	uint32_t autoadj_tally;
 
@@ -163,7 +172,9 @@
 	uint32_t rsamples_per_interval;
 	uint32_t ms_per_packet;
 	uint32_t remote_port;
-	uint8_t stuncount;
+	uint32_t stuncount;
+	uint32_t funny_stun;
+	uint32_t default_stuncount;
 	struct switch_rtp_vad_data vad_data;
 	struct switch_rtp_rfc2833_data dtmf_data;
 	switch_payload_t te;
@@ -182,6 +193,8 @@
 	switch_rtp_crypto_key_t *crypto_keys[SWITCH_RTP_CRYPTO_MAX];
 	int reading;
 	int writing;
+	char *stun_ip;
+	switch_port_t stun_port;
 };
 
 static int global_init = 0;
@@ -189,6 +202,61 @@
 							rtp_msg_t *send_msg, void *data, uint32_t datalen, switch_payload_t payload, uint32_t timestamp, switch_frame_flag_t *flags);
 
 
+static switch_status_t do_stun_ping(switch_rtp_t *rtp_session)
+{
+	uint8_t buf[256] = { 0 };
+	uint8_t *start = buf;
+	switch_stun_packet_t *packet;
+	//unsigned int elapsed;
+	switch_size_t bytes;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+	switch_assert(rtp_session != NULL);
+
+	WRITE_INC(rtp_session);
+
+	if (rtp_session->stuncount != 0) {
+		rtp_session->stuncount--;
+		goto end;
+	}
+
+#if 0
+	if (rtp_session->last_stun) {
+		elapsed = (unsigned int) ((switch_timestamp_now() - rtp_session->last_stun) / 1000);
+		
+		if (elapsed > 30000) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n");
+			status = SWITCH_STATUS_FALSE;
+			goto end;
+		}
+	}
+#endif
+
+	if (rtp_session->funny_stun) {
+		*start++ = 0;
+		*start++ = 0;
+		*start++ = 0x22;
+		*start++ = 0x22;
+	}
+
+	packet = switch_stun_packet_build_header(SWITCH_STUN_BINDING_REQUEST, NULL, start);
+	bytes = switch_stun_packet_length(packet);
+
+	if (rtp_session->funny_stun) {
+		packet = (switch_stun_packet_t *) buf;
+		bytes += 4;
+	}
+
+
+	switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_stun_addr, 0, (void *) packet, &bytes);
+	rtp_session->stuncount = rtp_session->default_stuncount;
+	
+  end:
+	WRITE_DEC(rtp_session);
+
+	return status;
+}
+
 static switch_status_t ice_out(switch_rtp_t *rtp_session)
 {
 	uint8_t buf[256] = { 0 };
@@ -208,7 +276,7 @@
 	}
 
 	if (rtp_session->last_stun) {
-		elapsed = (unsigned int) ((switch_time_now() - rtp_session->last_stun) / 1000);
+		elapsed = (unsigned int) ((switch_timestamp_now() - rtp_session->last_stun) / 1000);
 
 		if (elapsed > 30000) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n");
@@ -220,13 +288,23 @@
 	packet = switch_stun_packet_build_header(SWITCH_STUN_BINDING_REQUEST, NULL, buf);
 	switch_stun_packet_attribute_add_username(packet, rtp_session->ice_user, 32);
 	bytes = switch_stun_packet_length(packet);
-	switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) packet, &bytes);
-	rtp_session->stuncount = 25;
+	switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, (void *) packet, &bytes);
+	rtp_session->stuncount = rtp_session->default_stuncount;
 
   end:
 	WRITE_DEC(rtp_session);
 
-	return SWITCH_STATUS_SUCCESS;
+	return status;
+}
+
+
+static void handle_stun_ping_reply(switch_rtp_t *rtp_session, void *data, switch_size_t len)
+{
+	if (!switch_rtp_ready(rtp_session)) {
+		return;
+	}
+
+	rtp_session->last_stun = switch_timestamp_now();
 }
 
 static void handle_ice(switch_rtp_t *rtp_session, void *data, switch_size_t len)
@@ -262,7 +340,7 @@
 	}
 	end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf));
 
-	rtp_session->last_stun = switch_time_now();
+	rtp_session->last_stun = switch_timestamp_now();
 
 	switch_stun_packet_first_attribute(packet, attr);
 
@@ -296,7 +374,7 @@
 		remote_ip = switch_get_addr(ipbuf, sizeof(ipbuf), rtp_session->from_addr);
 		switch_stun_packet_attribute_add_binded_address(rpacket, (char *) remote_ip, switch_sockaddr_get_port(rtp_session->from_addr));
 		bytes = switch_stun_packet_length(rpacket);
-		switch_socket_sendto(rtp_session->sock, rtp_session->from_addr, 0, (void *) rpacket, &bytes);
+		switch_socket_sendto(rtp_session->sock_output, rtp_session->from_addr, 0, (void *) rpacket, &bytes);
 	}
 
   end:
@@ -440,11 +518,11 @@
 		goto done;
 	}
 
-	if (rtp_session->sock) {
+	if (rtp_session->sock_input) {
 		switch_rtp_kill_socket(rtp_session);
 	}
 
-	if (switch_socket_create(&new_sock, AF_INET, SOCK_DGRAM, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS) {
+	if (switch_socket_create(&new_sock, switch_sockaddr_get_family(rtp_session->local_addr), SOCK_DGRAM, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS) {
 		*err = "Socket Error!";
 		goto done;
 	}
@@ -483,12 +561,12 @@
 
 #endif
 
-	old_sock = rtp_session->sock;
-	rtp_session->sock = new_sock;
+	old_sock = rtp_session->sock_input;
+	rtp_session->sock_input = new_sock;
 	new_sock = NULL;
 
 	if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK)) {
-		switch_socket_opt_set(rtp_session->sock, SWITCH_SO_NONBLOCK, TRUE);
+		switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, TRUE);
 		switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
 	}
 
@@ -522,6 +600,7 @@
 SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, const char **err)
 {
 	switch_sockaddr_t *remote_addr;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	*err = "Success";
 
 	if (switch_sockaddr_info_get(&remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !remote_addr) {
@@ -530,11 +609,32 @@
 	}
 
 	switch_mutex_lock(rtp_session->write_mutex);
+
 	rtp_session->remote_addr = remote_addr;
 	rtp_session->remote_port = port;
+
+	if (rtp_session->sock_input &&
+		switch_sockaddr_get_family(rtp_session->remote_addr) ==
+		switch_sockaddr_get_family(rtp_session->local_addr)) {
+			rtp_session->sock_output = rtp_session->sock_input;
+	}
+	else {
+		if (rtp_session->sock_output &&
+			rtp_session->sock_output != rtp_session->sock_input) {
+				switch_socket_close(rtp_session->sock_output);
+		}
+		if ((status = switch_socket_create(&rtp_session->sock_output,
+			switch_sockaddr_get_family(rtp_session->remote_addr),
+			SOCK_DGRAM, 0, rtp_session->pool)) !=
+			SWITCH_STATUS_SUCCESS)
+		{
+			*err = "Socket Error!";
+		}
+	}
+
 	switch_mutex_unlock(rtp_session->write_mutex);
 
-	return SWITCH_STATUS_SUCCESS;
+	return status;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_session,
@@ -573,6 +673,9 @@
 	case AES_CM_128_HMAC_SHA1_32:
 		crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy->rtp);
 		break;
+	case AES_CM_128_NULL_AUTH:
+		crypto_policy_set_aes_cm_128_null_auth(&policy->rtp);
+		break;
 	default:
 		break;
 	}
@@ -797,6 +900,29 @@
 	rtp_session->cng_pt = pt;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_rtp_activate_stun_ping(switch_rtp_t *rtp_session, const char *stun_ip, switch_port_t stun_port,
+															  uint32_t packet_count, switch_bool_t funny)
+{
+	
+	if (switch_sockaddr_info_get(&rtp_session->remote_stun_addr, stun_ip, SWITCH_UNSPEC, 
+								 stun_port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !rtp_session->remote_stun_addr) {
+		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error resolving stun ping addr\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
+	if (funny) {
+		rtp_session->funny_stun++;
+	}
+
+	rtp_session->stun_port = stun_port;
+
+	rtp_session->default_stuncount = packet_count;
+
+	rtp_session->stun_ip = switch_core_strdup(rtp_session->pool, stun_ip);
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames)
 {
 	rtp_session->jb = stfu_n_init(queue_frames);
@@ -812,6 +938,7 @@
 	switch_snprintf(user_ice, sizeof(user_ice), "%s%s", rlogin, login);
 	rtp_session->ice_user = switch_core_strdup(rtp_session->pool, ice_user);
 	rtp_session->user_ice = switch_core_strdup(rtp_session->pool, user_ice);
+	rtp_session->default_stuncount = 25;
 
 	if (rtp_session->ice_user) {
 		if (ice_out(rtp_session) != SWITCH_STATUS_SUCCESS) {
@@ -829,9 +956,9 @@
 
 	switch_assert(rtp_session != NULL);
 	switch_mutex_lock(rtp_session->flag_mutex);
-	if (rtp_session->sock) {
+	if (rtp_session->sock_input) {
 		switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK);
-		switch_socket_sendto(rtp_session->sock, rtp_session->local_addr, 0, (void *) &o, &len);
+		switch_socket_sendto(rtp_session->sock_input, rtp_session->local_addr, 0, (void *) &o, &len);
 	}
 	switch_mutex_unlock(rtp_session->flag_mutex);
 }
@@ -842,8 +969,11 @@
 	switch_mutex_lock(rtp_session->flag_mutex);
 	if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
 		switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_IO);
-		if (rtp_session->sock) {
-			switch_socket_shutdown(rtp_session->sock, SWITCH_SHUTDOWN_READWRITE);
+		if (rtp_session->sock_input) {
+			switch_socket_shutdown(rtp_session->sock_input, SWITCH_SHUTDOWN_READWRITE);
+		}
+		if (rtp_session->sock_output && rtp_session->sock_output != rtp_session->sock_input) {
+			switch_socket_shutdown(rtp_session->sock_output, SWITCH_SHUTDOWN_READWRITE);
 		}
 	}
 	switch_mutex_unlock(rtp_session->flag_mutex);
@@ -858,7 +988,7 @@
 	}
 
 	switch_mutex_lock(rtp_session->flag_mutex);
-	ret = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) && rtp_session->sock && rtp_session->remote_addr && rtp_session->ready == 2) ? 1 : 0;
+	ret = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) && rtp_session->sock_input && rtp_session->sock_output && rtp_session->remote_addr && rtp_session->ready == 2) ? 1 : 0;
 	switch_mutex_unlock(rtp_session->flag_mutex);
 
 	return ret;
@@ -899,10 +1029,15 @@
 		stfu_n_destroy(&(*rtp_session)->jb);
 	}
 
-	sock = (*rtp_session)->sock;
-	(*rtp_session)->sock = NULL;
+	sock = (*rtp_session)->sock_input;
+	(*rtp_session)->sock_input = NULL;
 	switch_socket_close(sock);
 
+	if ( (*rtp_session)->sock_output != sock ) {
+		sock = (*rtp_session)->sock_output;
+		(*rtp_session)->sock_output = NULL;
+		switch_socket_close(sock);
+	}
 
 	if (switch_test_flag((*rtp_session), SWITCH_RTP_FLAG_VAD)) {
 		switch_rtp_disable_vad(*rtp_session);
@@ -932,7 +1067,7 @@
 
 SWITCH_DECLARE(switch_socket_t *) switch_rtp_get_rtp_socket(switch_rtp_t *rtp_session)
 {
-	return rtp_session->sock;
+	return rtp_session->sock_input;
 }
 
 SWITCH_DECLARE(void) switch_rtp_set_default_samples_per_interval(switch_rtp_t *rtp_session, uint16_t samples_per_interval)
@@ -1096,7 +1231,7 @@
 		int do_cng = 0;
 
 		bytes = sizeof(rtp_msg_t);
-		status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock, 0, (void *) &rtp_session->recv_msg, &bytes);
+		status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes);
 
 		if (bytes < 0) {
 			ret = (int) bytes;
@@ -1115,7 +1250,7 @@
 
 				if (!switch_strlen_zero(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) {
 					if (++rtp_session->autoadj_tally >= 10) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
 										  "Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
 										  switch_sockaddr_get_port(rtp_session->from_addr));
 						switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), &err);
@@ -1179,12 +1314,16 @@
 
 		if (bytes && rtp_session->recv_msg.header.version != 2) {
 			uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
-			if (rtp_session->recv_msg.header.version == 0 && rtp_session->ice_user) {
-				handle_ice(rtp_session, (void *) &rtp_session->recv_msg, bytes);
+			if (rtp_session->recv_msg.header.version == 0) {
+				if (rtp_session->ice_user) {
+					handle_ice(rtp_session, (void *) &rtp_session->recv_msg, bytes);
+				} else if (rtp_session->remote_stun_addr) {
+					handle_stun_ping_reply(rtp_session, (void *) &rtp_session->recv_msg, bytes);
+				}
 			}
 
 			if (rtp_session->invalid_handler) {
-				rtp_session->invalid_handler(rtp_session, rtp_session->sock, (void *) &rtp_session->recv_msg, bytes, rtp_session->from_addr);
+				rtp_session->invalid_handler(rtp_session, rtp_session->sock_input, (void *) &rtp_session->recv_msg, bytes, rtp_session->from_addr);
 			}
 
 			memset(data, 0, 2);
@@ -1783,7 +1922,7 @@
 			bytes = sbytes;
 		}
 
-		if (switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) send_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
+		if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, (void *) send_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
 			rtp_session->seq--;
 			ret = -1;
 			goto end;
@@ -1795,6 +1934,10 @@
 		rtp_session->last_write_ts = this_ts;
 	}
 
+	if (rtp_session->remote_stun_addr) {
+		do_stun_ping(rtp_session);
+	}
+
 	if (rtp_session->ice_user) {
 		if (ice_out(rtp_session) != SWITCH_STATUS_SUCCESS) {
 			ret = -1;
@@ -1889,7 +2032,7 @@
 			return 0;
 		}
 		bytes = frame->packetlen;
-		if (switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, frame->packet, &bytes) != SWITCH_STATUS_SUCCESS) {
+		if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, frame->packet, &bytes) != SWITCH_STATUS_SUCCESS) {
 			return -1;
 		}
 		return (int) bytes;
@@ -1914,6 +2057,9 @@
 		send_msg = frame->packet;
 		len = frame->packetlen;
 		ts = 0;
+		if (frame->codec && frame->codec->agreed_pt == frame->payload) {
+			send_msg->header.pt = payload;
+		}
 	} else {
 		data = frame->data;
 		len = frame->datalen;
@@ -1968,7 +2114,7 @@
 		bytes = sbytes;
 	}
 
-	if (switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) &rtp_session->write_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
+	if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, (void *) &rtp_session->write_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
 		rtp_session->seq--;
 		ret = -1;
 		goto end;
@@ -2008,5 +2154,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_scheduler.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_scheduler.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_scheduler.c	Mon Aug  4 21:29:58 2008
@@ -323,5 +323,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_stun.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_stun.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_stun.c	Mon Aug  4 21:29:58 2008
@@ -433,7 +433,8 @@
 {
 	switch_sockaddr_t *local_addr = NULL, *remote_addr = NULL, *from_addr = NULL;
 	switch_socket_t *sock = NULL;
-	uint8_t buf[256] = { 0 };
+	uint8_t buf[260] = { 0 };
+	uint8_t *start = buf;
 	void *end_buf;
 	switch_stun_packet_t *packet;
 	switch_stun_packet_attribute_t *attr;
@@ -443,6 +444,14 @@
 	uint16_t rport = 0;
 	switch_time_t started = 0;
 	unsigned int elapsed = 0;
+	int funny = 0;
+	int size = sizeof(buf);
+
+	switch_assert(err);
+
+	if (!strcmp(*err, "funny")) {
+		funny = 1;
+	}
 
 	*err = "Success";
 
@@ -468,11 +477,28 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+	if (funny) {
+		*start++ = 0;
+		*start++ = 0;
+		*start++ = 0x22;
+		*start++ = 0x22;
+	}
+
 	switch_socket_opt_set(sock, SWITCH_SO_NONBLOCK, TRUE);
-	packet = switch_stun_packet_build_header(SWITCH_STUN_BINDING_REQUEST, NULL, buf);
+	packet = switch_stun_packet_build_header(SWITCH_STUN_BINDING_REQUEST, NULL, start);
 	switch_stun_random_string(username, 32, NULL);
 	switch_stun_packet_attribute_add_username(packet, username, 32);
 	bytes = switch_stun_packet_length(packet);
+
+	if (funny) {
+		packet = (switch_stun_packet_t *) buf;
+		bytes += 4;
+		buf[bytes++] = 0;
+		buf[bytes++] = 0;
+		buf[bytes++] = 0;
+		buf[bytes++] = 0;
+	}
+	
 	switch_socket_sendto(sock, remote_addr, 0, (void *) packet, &bytes);
 	started = switch_timestamp_now();
 
@@ -496,7 +522,11 @@
 	}
 	switch_socket_close(sock);
 
-	packet = switch_stun_packet_parse(buf, sizeof(buf));
+	if (funny) {
+		size -= 4;
+	}
+
+	packet = switch_stun_packet_parse(start, size);
 	if (!packet) {
 		*err = "Invalid STUN/ICE packet";
 		return SWITCH_STATUS_FALSE;
@@ -508,6 +538,10 @@
 		switch (attr->type) {
 		case SWITCH_STUN_ATTR_MAPPED_ADDRESS:
 			if (attr->type) {
+				if(funny)
+				{
+					((switch_stun_ip_t *) attr->value)->address ^= ntohl(0xabcdabcd);
+				}
 				switch_stun_packet_attribute_get_mapped_address(attr, rip, &rport);
 			}
 			break;
@@ -538,5 +572,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_time.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_time.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_time.c	Mon Aug  4 21:29:58 2008
@@ -473,5 +473,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c	Mon Aug  4 21:29:58 2008
@@ -43,6 +43,7 @@
 	uint32_t mask;
 	uint32_t bits;
 	switch_bool_t ok;
+	char *token;
 	struct switch_network_node *next;
 };
 typedef struct switch_network_node switch_network_node_t;
@@ -77,7 +78,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip(switch_network_list_t *list, uint32_t ip)
+SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_network_list_t *list, uint32_t ip, const char **token)
 {
 	switch_network_node_t *node;
 	switch_bool_t ok = list->default_type;
@@ -90,15 +91,19 @@
 			} else {
 				ok = SWITCH_FALSE;
 			}
+
 			bits = node->bits;
+
+			if (token) {
+				*token = node->token;
+			}
 		}
 	}
 
 	return ok;
 }
 
-
-SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok)
+SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token)
 {
 	uint32_t ip, mask, bits;
 	switch_network_node_t *node;
@@ -114,13 +119,16 @@
 	node->ok = ok;
 	node->bits = bits;
 
+	if (!switch_strlen_zero(token)) {
+		node->token = switch_core_strdup(list->pool, token);
+	}
+	
 	node->next = list->node_head;
 	list->node_head = node;
 
-	return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;	
 }
 
-
 SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network_list_t *list, const char *host, const char *mask_str, switch_bool_t ok)
 {
 	int ip, mask;
@@ -169,7 +177,10 @@
 
 	bits = atoi(bit_str);
 	switch_inet_pton(AF_INET, host, ip);
-	*mask = 0xFFFFFFFF & ~(0xFFFFFFFF << bits);
+	*ip = htonl(*ip);
+
+	*mask = 0xFFFFFFFF & ~(0xFFFFFFFF >> bits);
+
 	*bitp = bits;
 
 	return 0;
@@ -370,7 +381,7 @@
 
 	if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) {
 		if (file) {
-			if ((ifd = open(file, O_RDONLY)) < 1) {
+			if ((ifd = open(file, O_RDONLY | O_BINARY)) < 1) {
 				return SWITCH_FALSE;
 			}
 		}
@@ -463,7 +474,11 @@
 	if (ifd) {
 		close(ifd);
 	}
+#ifdef WIN32
+	switch_snprintf(buf, B64BUFFLEN, "type %s | %s %s %s", filename, runtime.mailer_app, runtime.mailer_app_args, to);
+#else
 	switch_snprintf(buf, B64BUFFLEN, "/bin/cat %s | %s %s %s", filename, runtime.mailer_app, runtime.mailer_app_args, to);
+#endif
 	if (system(buf)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to execute command: %s\n", buf);
 	}
@@ -686,14 +701,15 @@
 		return status;
 	}
 
-	switch_copy_string(buf, "127.0.0.1", len);
-
+	
 	switch (family) {
 	case AF_INET:
+		switch_copy_string(buf, "127.0.0.1", len);
 		base = "82.45.148.209";
 		break;
 	case AF_INET6:
-		base = "52.2d.94.d1";
+		switch_copy_string(buf, "::1", len);
+		base = "2001:503:BA3E::2:30"; // DNS Root server A 
 		break;
 	default:
 		base = "127.0.0.1";
@@ -757,7 +773,7 @@
 				goto doh;
 			}
 
-			switch_copy_string(buf, get_addr(abuf, sizeof(abuf), &iface_out.sin_addr), len);
+			switch_copy_string(buf, get_addr(abuf, sizeof(abuf), (struct sockaddr*)&iface_out, sizeof(iface_out)), len);
 			status = SWITCH_STATUS_SUCCESS;
 		}
 		break;
@@ -768,17 +784,13 @@
 			memset(&remote, 0, sizeof(struct sockaddr_in6));
 
 			remote.sin6_family = AF_INET6;
-			switch_inet_pton(AF_INET6, buf, &remote.sin6_addr);
+			switch_inet_pton(AF_INET6, base, &remote.sin6_addr);
 			remote.sin6_port = htons(4242);
 
 			memset(&iface_out, 0, sizeof(iface_out));
 			tmp_socket = socket(AF_INET6, SOCK_DGRAM, 0);
 
-			if (setsockopt(tmp_socket, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)) == -1) {
-				goto doh;
-			}
-
-			if (connect(tmp_socket, (struct sockaddr *) &remote, sizeof(struct sockaddr_in)) == -1) {
+			if (connect(tmp_socket, (struct sockaddr *) &remote, sizeof(remote)) == -1) {
 				goto doh;
 			}
 
@@ -1054,16 +1066,65 @@
 
 #endif
 
-SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct in_addr *in)
+SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct sockaddr *sa, socklen_t salen)
 {
 	switch_assert(buf);
 	*buf = '\0';
-	if (in) {
-		switch_inet_ntop(AF_INET, in, buf, len);
+	if (sa) {
+		getnameinfo(sa, salen, buf, len, NULL, 0, NI_NUMERICHOST);
 	}
 	return buf;
 }
 
+SWITCH_DECLARE(unsigned short) get_port(struct sockaddr *sa)
+{
+	unsigned short port = 0;
+	if (sa) {
+		switch (sa->sa_family) {
+			case AF_INET:
+				port = ntohs(((struct sockaddr_in*)sa)->sin_port);
+				break;
+			case AF_INET6:
+				port = ntohs(((struct sockaddr_in6*)sa)->sin6_port);
+				break;
+		}
+	}
+	return port;
+}
+
+SWITCH_DECLARE(int) switch_build_uri(char *uri,
+									 switch_size_t size,
+									 const char *scheme,
+									 const char *user,
+									 const switch_sockaddr_t *sa,
+									 int flags)
+{
+	char host[NI_MAXHOST], serv[NI_MAXSERV];
+	struct sockaddr_storage ss;
+	const struct sockaddr *addr;
+	const char *colon;
+
+	if (flags & SWITCH_URI_NO_SCOPE && sa->family == AF_INET6) {
+		memcpy(&ss, &sa->sa, sa->salen);
+		((struct sockaddr_in6*) &ss)->sin6_scope_id = 0;
+		addr = (const struct sockaddr*) &ss;
+	} else {
+		addr = (const struct sockaddr*) &sa->sa;
+	}
+
+	if (getnameinfo(addr, sa->salen, host, sizeof(host), serv, sizeof(serv),
+		((flags & SWITCH_URI_NUMERIC_HOST) ? NI_NUMERICHOST : 0) | ((flags & SWITCH_URI_NUMERIC_PORT) ? NI_NUMERICSERV : 0)) != 0) {
+			return 0;
+	}
+
+	colon = strchr(host, ':');
+
+	return switch_snprintf(uri, size, "%s:%s%s%s%s%s%s%s", scheme,
+		user ? user : "", user ? "@" : "",
+		colon ? "[" : "", host, colon ? "]" : "",
+		serv[0] ? ":" : "", serv[0] ? serv : "");
+}
+
 SWITCH_DECLARE(char) switch_rfc2833_to_char(int event)
 {
 	if (event > -1 && event < (int32_t) sizeof(RFC2833_CHARS)) {
@@ -1454,5 +1515,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj	Mon Aug  4 21:29:58 2008
@@ -481,7 +481,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\switch_xml.cpp"
+				RelativePath="..\..\src\switch_xml.c"
 				>
 				<FileConfiguration
 					Name="Debug|Win32"

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.vcproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.vcproj	Mon Aug  4 21:29:58 2008
@@ -479,7 +479,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\switch_xml.cpp"
+				RelativePath="..\..\src\switch_xml.c"
 				>
 				<FileConfiguration
 					Name="Debug|Win32"

Modified: freeswitch/branches/lukedashjr/syslibs/libs/apr/memory/unix/apr_pools.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/apr/memory/unix/apr_pools.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/apr/memory/unix/apr_pools.c	Mon Aug  4 21:29:58 2008
@@ -1990,7 +1990,12 @@
         }
 
         lastp = &c->next;
-        c = c->next;
+
+		if (c == c->next) {
+			c = NULL;
+		} else {
+			c = c->next;
+		}
     }
 }
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/ldl_compat.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/ldl_compat.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/ldl_compat.h	Mon Aug  4 21:29:58 2008
@@ -70,5 +70,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/libdingaling.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/libdingaling.c	Mon Aug  4 21:29:58 2008
@@ -2312,5 +2312,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/libdingaling.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/libdingaling.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/libdingaling/src/libdingaling.h	Mon Aug  4 21:29:58 2008
@@ -54,6 +54,11 @@
 }
 #endif
 
+#if defined (__SVR4) && defined (__sun)
+#define __EXTENSIONS__ 1
+#include <strings.h>
+#endif
+
 #define LDL_HANDLE_QLEN 2000
 #define LDL_MAX_CANDIDATES 10
 #define LDL_MAX_PAYLOADS 50
@@ -637,5 +642,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/libsndfile/configure.ac
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/libsndfile/configure.ac	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/libsndfile/configure.ac	Mon Aug  4 21:29:58 2008
@@ -7,7 +7,7 @@
 AC_CONFIG_SRCDIR([src/sndfile.c])
 AC_CANONICAL_TARGET([])
 
-AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION)
+AM_INIT_AUTOMAKE
 AC_CONFIG_HEADERS([src/config.h])
 
 AC_LANG([C])

Modified: freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone.h	Mon Aug  4 21:29:58 2008
@@ -131,5 +131,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_detect.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_detect.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_detect.c	Mon Aug  4 21:29:58 2008
@@ -454,5 +454,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_detect.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_detect.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_detect.h	Mon Aug  4 21:29:58 2008
@@ -269,5 +269,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_generate.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_generate.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_generate.c	Mon Aug  4 21:29:58 2008
@@ -496,5 +496,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_generate.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_generate.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/libteletone/src/libteletone_generate.h	Mon Aug  4 21:29:58 2008
@@ -312,5 +312,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/pcre/Makefile.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/pcre/Makefile.in	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/pcre/Makefile.in	Mon Aug  4 21:29:58 2008
@@ -107,7 +107,7 @@
 @ON_WINDOWS at LINK = $(CC) $(LDFLAGS) -I. -I$(top_srcdir) -L.libs
 @NOT_ON_WINDOWS at LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -I. -I$(top_srcdir)
 LINKLIB = $(LIBTOOL) --mode=link $(CC) -export-symbols-regex '^[^_]' $(LDFLAGS) -I. -I$(top_srcdir)
-LINK_FOR_BUILD = $(LIBTOOL) --mode=link $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -I. -I$(top_srcdir)
+LINK_FOR_BUILD = $(LIBTOOL) --mode=link --tag=CC $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -I. -I$(top_srcdir) 
 @ON_WINDOWS at CXXLINK = $(CXX) $(LDFLAGS) -I. -I$(top_srcdir) -L.libs
 @NOT_ON_WINDOWS at CXXLINK = $(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(CXXLDFLAGS) -I. -I$(top_srcdir)
 CXXLINKLIB = $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -I. -I$(top_srcdir)

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/Makefile.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/Makefile.in	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/Makefile.in	Mon Aug  4 21:29:58 2008
@@ -16,7 +16,7 @@
 libdir = @libdir@
 includedir = @includedir@
 CC = @CC@
-CFLAGS = @CFLAGS@ -I$(top_srcdir)/include -I$(top_srcdir)/src/common -I$(top_srcdir)/src/os/unix @DEFS@
+CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src/common -I$(top_srcdir)/src/os/unix @CFLAGS@ @DEFS@
 LIBS = @LIBS@
 AR = @AR@
 RANLIB = @RANLIB@
@@ -56,62 +56,62 @@
 	src/common/pa_trace.o
 
 TESTS = \
-	test/paqa_devs \
-	test/paqa_errs \
-	test/patest1 \
-	test/patest_buffer \
-	test/patest_callbackstop \
-	test/patest_clip \
-	test/patest_dither \
-	test/patest_hang \
-	test/patest_in_overflow \
-	test/patest_latency \
-	test/patest_leftright \
-	test/patest_longsine \
-	test/patest_many \
-	test/patest_maxsines \
-	test/patest_multi_sine \
-	test/patest_out_underflow \
-	test/patest_pink \
-	test/patest_prime \
-	test/patest_read_record \
-	test/patest_read_write_wire \
-	test/patest_record \
-	test/patest_ringmix \
-	test/patest_saw \
-	test/patest_sine8 \
-	test/patest_sine \
-  test/patest_sine_channelmaps \
-	test/patest_sine_formats \
-	test/patest_sine_time \
-	test/patest_start_stop \
-	test/patest_stop \
-	test/patest_stop_playout \
-	test/patest_toomanysines \
-	test/patest_underflow \
-	test/patest_wire \
-	test/patest_write_sine \
-	test/pa_devs \
-	test/pa_fuzz \
-	test/pa_minlat
+	bin/paqa_devs \
+	bin/paqa_errs \
+	bin/patest1 \
+	bin/patest_buffer \
+	bin/patest_callbackstop \
+	bin/patest_clip \
+	bin/patest_dither \
+	bin/patest_hang \
+	bin/patest_in_overflow \
+	bin/patest_latency \
+	bin/patest_leftright \
+	bin/patest_longsine \
+	bin/patest_many \
+	bin/patest_maxsines \
+	bin/patest_multi_sine \
+	bin/patest_out_underflow \
+	bin/patest_pink \
+	bin/patest_prime \
+	bin/patest_read_record \
+	bin/patest_read_write_wire \
+	bin/patest_record \
+	bin/patest_ringmix \
+	bin/patest_saw \
+	bin/patest_sine8 \
+	bin/patest_sine \
+	bin/patest_sine_channelmaps \
+	bin/patest_sine_formats \
+	bin/patest_sine_time \
+	bin/patest_start_stop \
+	bin/patest_stop \
+	bin/patest_stop_playout \
+	bin/patest_toomanysines \
+	bin/patest_underflow \
+	bin/patest_wire \
+	bin/patest_write_sine \
+	bin/pa_devs \
+	bin/pa_fuzz \
+	bin/pa_minlat
 
 # Most of these don't compile yet.  Put them in TESTS, above, if
 # you want to try to compile them...
 ALL_TESTS = \
 	$(TESTS) \
-	test/patest_sync \
-	test/debug_convert \
-	test/debug_dither_calc \
-	test/debug_dual \
-	test/debug_multi_in \
-	test/debug_multi_out \
-	test/debug_record \
-	test/debug_record_reuse \
-	test/debug_sine_amp \
-	test/debug_sine \
-	test/debug_sine_formats \
-	test/debug_srate \
-	test/debug_test1
+	bin/patest_sync \
+	bin/debug_convert \
+	bin/debug_dither_calc \
+	bin/debug_dual \
+	bin/debug_multi_in \
+	bin/debug_multi_out \
+	bin/debug_record \
+	bin/debug_record_reuse \
+	bin/debug_sine_amp \
+	bin/debug_sine \
+	bin/debug_sine_formats \
+	bin/debug_srate \
+	bin/debug_test1
 
 OBJS = $(COMMON_OBJS) $(OTHER_OBJS)
 
@@ -120,7 +120,7 @@
 SUBDIRS =
 @ENABLE_CXX_TRUE at SUBDIRS += bindings/cpp
 
-all: lib/$(PALIB) all-recursive
+all: lib/$(PALIB) all-recursive tests
 
 tests: bin-stamp $(TESTS)
 
@@ -128,8 +128,9 @@
 lib/$(PALIB): lib-stamp $(LTOBJS) $(MAKEFILE) $(PAINC)
 	$(LIBTOOL) --mode=link $(CC) $(PA_LDFLAGS) -o lib/$(PALIB) $(LTOBJS) $(DLL_LIBS)
 
-$(ALL_TESTS): lib/$(PALIB) $(MAKEFILE) $(PAINC)
-	$(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/$@.c lib/$(PALIB) $(LIBS)
+$(ALL_TESTS): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) test/%.c
+	$(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS)
+
 
 install: lib/$(PALIB) portaudio-2.0.pc
 	$(INSTALL) -d $(DESTDIR)$(libdir)
@@ -163,19 +164,16 @@
 distclean: clean
 	rm -f config.log config.status Makefile libtool portaudio-2.0.pc
 
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .cpp
-
-.c.o: $(MAKEFILE) $(PAINC)
+%.o: %.c $(MAKEFILE) $(PAINC)
 	$(CC) -c $(CFLAGS) $< -o $@
 
-.c.lo: $(MAKEFILE) $(PAINC)
+%.lo: %.c $(MAKEFILE) $(PAINC)
 	$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $< -o $@
 
-.cpp.o: $(MAKEFILE) $(PAINC)
+%.o: %.cpp $(MAKEFILE) $(PAINC)
 	$(CXX) -c $(CXXFLAGS) $< -o $@
 
-.asm.o:
+%.o: %.asm
 	$(NASM) $(NASMOPT) -o $@ $<
 
 bin-stamp:
@@ -184,9 +182,21 @@
 
 lib-stamp:
 	-mkdir lib
-	-mkdir -p src/os/win src/os/unix src/os/mac_osx src/common \
-src/hostapi/oss src/hostapi/alsa src/hostapi/jack src/hostapi/asihpi \
-src/hostapi/wmme src/hostapi/wdmks src/hostapi/dsound src/hostapi/wasapi
+	-mkdir -p \
+		src/common \
+		src/hostapi/alsa \
+		src/hostapi/asihpi \
+		src/hostapi/asio \
+		src/hostapi/coreaudio \
+		src/hostapi/dsound \
+		src/hostapi/jack \
+		src/hostapi/oss \
+		src/hostapi/wasapi \
+		src/hostapi/wdmks \
+		src/hostapi/wmme \
+		src/os/mac_osx \
+		src/os/unix \
+		src/os/win
 	touch $@
 
 Makefile: Makefile.in config.status

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/SConstruct
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/SConstruct	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/SConstruct	Mon Aug  4 21:29:58 2008
@@ -64,7 +64,7 @@
 env.SConsignFile(os.path.join(sconsDir, ".sconsign"))
 
 env.SConscriptChdir(False)
-sources, sharedLib, staticLib, tests, portEnv = env.SConscript(os.path.join("src", "SConscript"),
+sources, sharedLib, staticLib, tests, portEnv, hostApis = env.SConscript(os.path.join("src", "SConscript"),
         build_dir=buildDir, duplicate=False, exports=["env"])
 
 if Platform in Posix:
@@ -133,6 +133,7 @@
 
 env.Install(includeDir, os.path.join("include", "portaudio.h"))
 
+
 if env["enableCxx"]:
     env.SConscriptChdir(True)
     cxxEnv = env.Copy()
@@ -145,3 +146,49 @@
         env.Default(sharedLibs)
         env.Install(libDir, sharedLibs)
     env.Install(os.path.join(includeDir, "portaudiocpp"), headers)
+
+# Generate portaudio_config.h header with compile-time definitions of which PA
+# back-ends are available, and which includes back-end extension headers
+
+# Host-specific headers
+hostApiHeaders = {"ALSA": "pa_linux_alsa.h",
+                    "ASIO": "pa_asio.h",
+                    "COREAUDIO": "pa_mac_core.h",
+                    "JACK": "pa_jack.h",
+                    "WMME": "pa_winwmme.h",
+                    }
+
+def buildConfigH(target, source, env):
+    """builder for portaudio_config.h"""
+    global hostApiHeaders, hostApis
+    out = ""
+    for hostApi in hostApis:
+        out += "#define PA_HAVE_%s\n" % hostApi
+
+        hostApiSpecificHeader = hostApiHeaders.get(hostApi, None)
+        if hostApiSpecificHeader:
+            out += "#include \"%s\"\n" % hostApiSpecificHeader
+
+        out += "\n"
+    # Strip the last newline
+    if out[-1] == "\n":
+        out = out[:-1]
+
+    f = file(str(target[0]), 'w')
+    try: f.write(out)
+    finally: f.close()
+    return 0
+
+# Define the builder for the config header
+env.Append(BUILDERS={"portaudioConfig": env.Builder(action=Action(buildConfigH,
+        "generating '$TARGET'"), target_factory=env.fs.File,)})
+
+confH = env.portaudioConfig(File("portaudio_config.h", "include"),
+        File("portaudio.h", "include"))
+env.Default(confH)
+env.Install(os.path.join(includeDir, "portaudio"), confH)
+
+for api in hostApis:
+    if api in hostApiHeaders:
+        env.Install(os.path.join(includeDir, "portaudio"),
+                File(hostApiHeaders[api], "include"))

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/bindings/cpp/configure
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/bindings/cpp/configure	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/bindings/cpp/configure	Mon Aug  4 21:29:58 2008
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for PortAudioCpp 12.
+# Generated by GNU Autoconf 2.60 for PortAudioCpp 12.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -10,8 +10,7 @@
 ## M4sh Initialization.  ##
 ## --------------------- ##
 
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
+# Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
@@ -20,13 +19,10 @@
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 fi
-
-
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
 
 
 # PATH needs CR
@@ -219,7 +215,7 @@
 else
   as_candidate_shells=
     as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
@@ -237,6 +233,7 @@
 	 # Try only shells that exist, to save several forks.
 	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
 		{ ("$as_shell") 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
@@ -245,12 +242,10 @@
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 fi
-
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
 
 :
 _ASEOF
@@ -258,6 +253,7 @@
   CONFIG_SHELL=$as_shell
 	       as_have_required=yes
 	       if { "$as_shell" 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
@@ -266,12 +262,10 @@
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 fi
-
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
 
 :
 (as_func_return () {
@@ -518,28 +512,19 @@
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
+# Find out whether ``test -x'' works.  Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  as_executable_p="test -x"
 else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-        test -d "$1/.";
-      else
-	case $1 in
-        -*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
+  as_executable_p=:
 fi
-as_executable_p=$as_test_x
+rm -f conf$$.file
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -734,36 +719,36 @@
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
+#if HAVE_SYS_TYPES_H
 # include <sys/types.h>
 #endif
-#ifdef HAVE_SYS_STAT_H
+#if HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
-#ifdef STDC_HEADERS
+#if STDC_HEADERS
 # include <stdlib.h>
 # include <stddef.h>
 #else
-# ifdef HAVE_STDLIB_H
+# if HAVE_STDLIB_H
 #  include <stdlib.h>
 # endif
 #endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
 #  include <memory.h>
 # endif
 # include <string.h>
 #endif
-#ifdef HAVE_STRINGS_H
+#if HAVE_STRINGS_H
 # include <strings.h>
 #endif
-#ifdef HAVE_INTTYPES_H
+#if HAVE_INTTYPES_H
 # include <inttypes.h>
 #endif
-#ifdef HAVE_STDINT_H
+#if HAVE_STDINT_H
 # include <stdint.h>
 #endif
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 # include <unistd.h>
 #endif"
 
@@ -885,7 +870,6 @@
 CC
 CFLAGS
 LDFLAGS
-LIBS
 CPPFLAGS
 CXX
 CXXFLAGS
@@ -999,10 +983,10 @@
   -disable-* | --disable-*)
     ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid feature name: $ac_feature" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
     eval enable_$ac_feature=no ;;
 
   -docdir | --docdir | --docdi | --doc | --do)
@@ -1018,10 +1002,10 @@
   -enable-* | --enable-*)
     ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid feature name: $ac_feature" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
     eval enable_$ac_feature=\$ac_optarg ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
@@ -1215,19 +1199,19 @@
   -with-* | --with-*)
     ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid package name: $ac_package" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
     eval with_$ac_package=\$ac_optarg ;;
 
   -without-* | --without-*)
     ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid package name: $ac_package" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
     eval with_$ac_package=no ;;
 
   --x)
@@ -1496,7 +1480,6 @@
   CFLAGS      C compiler flags
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
-  LIBS        libraries to pass to the linker, e.g. -l<library>
   CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CXX         C++ compiler command
@@ -1570,7 +1553,7 @@
 if $ac_init_version; then
   cat <<\_ACEOF
 PortAudioCpp configure 12
-generated by GNU Autoconf 2.61
+generated by GNU Autoconf 2.60
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -1584,7 +1567,7 @@
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by PortAudioCpp $as_me 12, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
+generated by GNU Autoconf 2.60.  Invocation command line was
 
   $ $0 $@
 
@@ -2005,7 +1988,7 @@
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then
 	  if test $ac_prog = install &&
 	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
@@ -2171,7 +2154,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_AWK="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2306,7 +2289,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2346,7 +2329,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_STRIP="strip"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2462,7 +2445,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2502,7 +2485,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="gcc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2559,7 +2542,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2600,7 +2583,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -2658,7 +2641,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2702,7 +2685,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2843,7 +2826,7 @@
 # in a Makefile.  We should not override ac_cv_exeext if it was cached,
 # so that the user can short-circuit this test for compilers unknown to
 # Autoconf.
-for ac_file in $ac_files ''
+for ac_file in $ac_files
 do
   test -f "$ac_file" || continue
   case $ac_file in
@@ -2871,12 +2854,6 @@
 test "$ac_cv_exeext" = no && ac_cv_exeext=
 
 else
-  ac_file=''
-fi
-
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6; }
-if test -z "$ac_file"; then
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
@@ -2888,6 +2865,8 @@
 fi
 
 ac_exeext=$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
 
 # Check that the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
@@ -3065,10 +3044,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -3123,10 +3119,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_prog_cc_g=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -3161,10 +3174,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -3200,10 +3230,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_prog_cc_g=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -3319,10 +3366,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_prog_cc_c89=$ac_arg
 else
   echo "$as_me: failed program was:" >&5
@@ -3561,7 +3625,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3605,7 +3669,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CXX="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3718,10 +3782,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -3776,10 +3857,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_prog_cxx_g=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -3814,10 +3912,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -3853,10 +3968,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_prog_cxx_g=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -4241,7 +4373,7 @@
   for ac_prog in grep ggrep; do
   for ac_exec_ext in '' $ac_executable_extensions; do
     ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+    { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue
     # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -4323,7 +4455,7 @@
   for ac_prog in egrep; do
   for ac_exec_ext in '' $ac_executable_extensions; do
     ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+    { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue
     # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -4804,7 +4936,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 4807 "configure"' > conftest.$ac_ext
+  echo '#line 4939 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -4928,11 +5060,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   lt_cv_cc_needs_belf=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -4941,7 +5089,7 @@
 	lt_cv_cc_needs_belf=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
      ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -4995,7 +5143,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5035,7 +5183,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_DLLTOOL="dlltool"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5091,7 +5239,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_AS="${ac_tool_prefix}as"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5131,7 +5279,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_AS="as"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5187,7 +5335,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5227,7 +5375,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5325,10 +5473,17 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -5362,10 +5517,17 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   # Broken: success on invalid input.
 continue
 else
@@ -5430,10 +5592,17 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -5467,10 +5636,17 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   # Broken: success on invalid input.
 continue
 else
@@ -5541,10 +5717,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_header_stdc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -5720,10 +5913,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
@@ -5786,10 +5996,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -5825,10 +6052,17 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -5940,10 +6174,17 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -5977,10 +6218,17 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   # Broken: success on invalid input.
 continue
 else
@@ -6045,10 +6293,17 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -6082,10 +6337,17 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   # Broken: success on invalid input.
 continue
 else
@@ -6126,7 +6388,7 @@
 ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_f77_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  for ac_prog in g77 f77 xlf frt pgf77 cf77 fort77 fl32 af77 f90 xlf90 pgf90 pghpf epcf90 gfortran g95 f95 fort xlf95 ifort ifc efc pgf95 lf95 ftn
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -6144,7 +6406,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6170,7 +6432,7 @@
 fi
 if test -z "$F77"; then
   ac_ct_F77=$F77
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  for ac_prog in g77 f77 xlf frt pgf77 cf77 fort77 fl32 af77 f90 xlf90 pgf90 pghpf epcf90 gfortran g95 f95 fort xlf95 ifort ifc efc pgf95 lf95 ftn
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -6188,7 +6450,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_F77="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6295,10 +6557,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -6341,10 +6620,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_prog_f77_g=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -6799,7 +7095,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_AR="${ac_tool_prefix}ar"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6839,7 +7135,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_AR="ar"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6895,7 +7191,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6935,7 +7231,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6991,7 +7287,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7031,7 +7327,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_STRIP="strip"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7275,6 +7571,67 @@
 
 test -z "$pic_mode" && pic_mode=default
 
+# Check if we have a version mismatch between libtool.m4 and ltmain.sh.
+#
+# Note:  This should be in AC_LIBTOOL_SETUP, _after_ $ltmain have been defined.
+#        We also should do it _before_ AC_LIBTOOL_LANG_C_CONFIG that actually
+#        calls AC_LIBTOOL_CONFIG and creates libtool.
+#
+{ echo "$as_me:$LINENO: checking for correct ltmain.sh version" >&5
+echo $ECHO_N "checking for correct ltmain.sh version... $ECHO_C" >&6; }
+if test "x$ltmain" = "x" ; then
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+  { { echo "$as_me:$LINENO: error:
+
+*** [Gentoo] sanity check failed! ***
+*** \$ltmain is not defined, please check the patch for consistency! ***
+" >&5
+echo "$as_me: error:
+
+*** [Gentoo] sanity check failed! ***
+*** \$ltmain is not defined, please check the patch for consistency! ***
+" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+gentoo_lt_version="1.5.22"
+gentoo_ltmain_version=`sed -n '/^[ 	]*VERSION=/{s/^[ 	]*VERSION=//;p;q;}' "$ltmain"`
+if test "x$gentoo_lt_version" != "x$gentoo_ltmain_version" ; then
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+  { { echo "$as_me:$LINENO: error:
+
+*** [Gentoo] sanity check failed! ***
+*** libtool.m4 and ltmain.sh have a version mismatch! ***
+*** (libtool.m4 = $gentoo_lt_version, ltmain.sh = $gentoo_ltmain_version) ***
+
+Please run:
+
+  libtoolize --copy --force
+
+if appropriate, please contact the maintainer of this
+package (or your distribution) for help.
+" >&5
+echo "$as_me: error:
+
+*** [Gentoo] sanity check failed! ***
+*** libtool.m4 and ltmain.sh have a version mismatch! ***
+*** (libtool.m4 = $gentoo_lt_version, ltmain.sh = $gentoo_ltmain_version) ***
+
+Please run:
+
+  libtoolize --copy --force
+
+if appropriate, please contact the maintainer of this
+package (or your distribution) for help.
+" >&2;}
+   { (exit 1); exit 1; }; }
+else
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+fi
+
+
 # Use C for the default configuration in the libtool script
 tagname=
 lt_save_CC="$CC"
@@ -7348,11 +7705,11 @@
    -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:7351: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7708: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7355: \$? = $ac_status" >&5
+   echo "$as_me:7712: \$? = $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 other than the usual output.
@@ -7616,11 +7973,11 @@
    -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:7619: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7976: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7623: \$? = $ac_status" >&5
+   echo "$as_me:7980: \$? = $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 other than the usual output.
@@ -7720,11 +8077,11 @@
    -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:7723: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8080: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7727: \$? = $ac_status" >&5
+   echo "$as_me:8084: \$? = $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
@@ -8200,11 +8557,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -8218,7 +8591,7 @@
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -8259,11 +8632,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -8277,7 +8666,7 @@
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -8959,6 +9348,30 @@
     esac
     ;;
 
+  linux*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      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="$archive_cmds"
+      fi
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
   *)
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
     ;;
@@ -9023,7 +9436,14 @@
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -9034,6 +9454,12 @@
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -9525,11 +9951,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_dl_dlopen=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -9538,7 +9980,7 @@
 	ac_cv_lib_dl_dlopen=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
@@ -9614,17 +10056,33 @@
   *) ac_try_echo=$ac_try;;
 esac
 eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); }; }; then
   ac_cv_func_shl_load=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -9633,7 +10091,7 @@
 	ac_cv_func_shl_load=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 fi
 { echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
@@ -9683,11 +10141,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_dld_shl_load=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -9696,7 +10170,7 @@
 	ac_cv_lib_dld_shl_load=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
@@ -9768,11 +10242,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_func_dlopen=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -9781,7 +10271,7 @@
 	ac_cv_func_dlopen=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 fi
 { echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
@@ -9831,11 +10321,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_dl_dlopen=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -9844,7 +10350,7 @@
 	ac_cv_lib_dl_dlopen=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
@@ -9895,11 +10401,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_svld_dlopen=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -9908,7 +10430,7 @@
 	ac_cv_lib_svld_dlopen=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
@@ -9959,11 +10481,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_dld_dld_link=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -9972,7 +10510,7 @@
 	ac_cv_lib_dld_dld_link=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
@@ -10028,7 +10566,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10031 "configure"
+#line 10569 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10128,7 +10666,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 10131 "configure"
+#line 10669 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11215,11 +11753,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -11233,7 +11787,7 @@
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -11275,11 +11829,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -11293,7 +11863,7 @@
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -12464,11 +13034,11 @@
    -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:12467: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13037: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12471: \$? = $ac_status" >&5
+   echo "$as_me:13041: \$? = $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 other than the usual output.
@@ -12568,11 +13138,11 @@
    -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:12571: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13141: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12575: \$? = $ac_status" >&5
+   echo "$as_me:13145: \$? = $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
@@ -12878,6 +13448,30 @@
     esac
     ;;
 
+  linux*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      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="$archive_cmds"
+      fi
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
   *)
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
     ;;
@@ -12942,7 +13536,14 @@
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -12953,6 +13554,12 @@
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -14138,11 +14745,11 @@
    -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:14141: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14748: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14145: \$? = $ac_status" >&5
+   echo "$as_me:14752: \$? = $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 other than the usual output.
@@ -14242,11 +14849,11 @@
    -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:14245: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14852: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14249: \$? = $ac_status" >&5
+   echo "$as_me:14856: \$? = $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
@@ -14712,11 +15319,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -14730,7 +15353,7 @@
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -14761,11 +15384,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -14779,7 +15418,7 @@
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -15461,6 +16100,30 @@
     esac
     ;;
 
+  linux*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      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="$archive_cmds"
+      fi
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
   *)
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
     ;;
@@ -15525,7 +16188,14 @@
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -15536,6 +16206,12 @@
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -16440,11 +17116,11 @@
    -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:16443: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17119: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16447: \$? = $ac_status" >&5
+   echo "$as_me:17123: \$? = $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 other than the usual output.
@@ -16708,11 +17384,11 @@
    -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:16711: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17387: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16715: \$? = $ac_status" >&5
+   echo "$as_me:17391: \$? = $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 other than the usual output.
@@ -16812,11 +17488,11 @@
    -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:16815: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17491: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16819: \$? = $ac_status" >&5
+   echo "$as_me:17495: \$? = $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
@@ -17292,11 +17968,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -17310,7 +18002,7 @@
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -17351,11 +18043,27 @@
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -17369,7 +18077,7 @@
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f core conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -18051,6 +18759,30 @@
     esac
     ;;
 
+  linux*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      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="$archive_cmds"
+      fi
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
   *)
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
     ;;
@@ -18115,7 +18847,14 @@
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -18126,6 +18865,12 @@
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -19661,8 +20406,7 @@
 ## M4sh Initialization.  ##
 ## --------------------- ##
 
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
+# Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
@@ -19671,13 +20415,10 @@
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 fi
-
-
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
 
 
 # PATH needs CR
@@ -19901,28 +20642,19 @@
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
+# Find out whether ``test -x'' works.  Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  as_executable_p="test -x"
 else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-        test -d "$1/.";
-      else
-	case $1 in
-        -*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
+  as_executable_p=:
 fi
-as_executable_p=$as_test_x
+rm -f conf$$.file
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -19938,7 +20670,7 @@
 # values after options handling.
 ac_log="
 This file was extended by PortAudioCpp $as_me 12, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
+generated by GNU Autoconf 2.60.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -19966,7 +20698,7 @@
 Usage: $0 [OPTIONS] [FILE]...
 
   -h, --help       print this help, then exit
-  -V, --version    print version number and configuration settings, then exit
+  -V, --version    print version number, then exit
   -q, --quiet      do not print progress messages
   -d, --debug      don't remove temporary files
       --recheck    update $as_me by reconfiguring in the same conditions
@@ -19985,7 +20717,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
 PortAudioCpp config.status 12
-configured by $0, generated by GNU Autoconf 2.61,
+configured by $0, generated by GNU Autoconf 2.60,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
 Copyright (C) 2006 Free Software Foundation, Inc.

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.2008.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.2008.vcproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.2008.vcproj	Mon Aug  4 21:29:58 2008
@@ -51,8 +51,8 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				InlineFunctionExpansion="0"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_DS"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_DS;PAWIN_USE_WDMKS_DEVICE_INFO"
 				StringPooling="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
@@ -129,8 +129,8 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO"
 				StringPooling="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
@@ -154,6 +154,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
 				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
 				LinkIncremental="1"
 				SuppressStartupBanner="true"
@@ -220,8 +221,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_DS"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_DS;PAWIN_USE_WDMKS_DEVICE_INFO"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -391,8 +392,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -417,6 +418,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
 				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
 				LinkIncremental="2"
 				SuppressStartupBanner="true"
@@ -485,8 +487,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -511,6 +513,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
 				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
 				LinkIncremental="2"
 				SuppressStartupBanner="true"
@@ -579,7 +582,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
 				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
 				StringPooling="true"
 				RuntimeLibrary="2"
@@ -2620,6 +2623,14 @@
 						</FileConfiguration>
 					</File>
 					<File
+						RelativePath="..\..\src\os\win\pa_win_waveformat.c"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\os\win\pa_win_wdmks_utils.c"
+						>
+					</File>
+					<File
 						RelativePath="..\..\src\os\win\pa_x86_plain_converters.c"
 						>
 						<FileConfiguration

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.def
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.def	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.def	Mon Aug  4 21:29:58 2008
@@ -35,9 +35,9 @@
 Pa_GetStreamWriteAvailable          @32
 Pa_GetSampleSize                    @33
 Pa_Sleep                            @34
-;PaAsio_GetAvailableLatencyValues    @50
-;PaAsio_ShowControlPanel             @51
+PaAsio_GetAvailableLatencyValues    @50
+PaAsio_ShowControlPanel             @51
 PaUtil_InitializeX86PlainConverters @52
-;PaAsio_GetInputChannelName          @53
-;PaAsio_GetOutputChannelName         @54
+PaAsio_GetInputChannelName          @53
+PaAsio_GetOutputChannelName         @54
 PaUtil_SetDebugPrintFunction        @55
\ No newline at end of file

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.dsp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.dsp	Mon Aug  4 21:29:58 2008
@@ -43,7 +43,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\src\common" /I "..\..\include" /I ".\\" /D "WIN32" /D "NDEBUG" /D "_USRDLL" /D "PA_ENABLE_DEBUG_OUTPUT" /D "_CRT_SECURE_NO_DEPRECATE" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\src\common" /I "..\..\include" /I ".\\" /I "..\..\src\os\win" /D "WIN32" /D "NDEBUG" /D "_USRDLL" /D "PA_ENABLE_DEBUG_OUTPUT" /D "_CRT_SECURE_NO_DEPRECATE" /D "PAWIN_USE_WDMKS_DEVICE_INFO" /FD /c
 # SUBTRACT CPP /YX /Yc /Yu
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -54,7 +54,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"./Release_x86/portaudio_x86.dll"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /dll /machine:I386 /out:"./Release_x86/portaudio_x86.dll"
 
 !ELSEIF  "$(CFG)" == "portaudio - Win32 Debug"
 
@@ -70,7 +70,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\src\common" /I "..\..\include" /I ".\\" /D "WIN32" /D "_DEBUG" /D "_USRDLL" /D "PA_ENABLE_DEBUG_OUTPUT" /D "_CRT_SECURE_NO_DEPRECATE" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\src\common" /I "..\..\include" /I ".\\" /I "..\..\src\os\win" /D "WIN32" /D "_DEBUG" /D "_USRDLL" /D "PA_ENABLE_DEBUG_OUTPUT" /D "_CRT_SECURE_NO_DEPRECATE" /D "PAWIN_USE_WDMKS_DEVICE_INFO" /FD /GZ /c
 # SUBTRACT CPP /YX /Yc /Yu
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@@ -81,7 +81,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./Debug_x86/portaudio_x86.dll" /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /dll /debug /machine:I386 /out:"./Debug_x86/portaudio_x86.dll" /pdbtype:sept
 
 !ENDIF 
 
@@ -211,6 +211,14 @@
 SOURCE=..\..\src\hostapi\wasapi\pa_win_wasapi.cpp
 # End Source File
 # End Group
+# Begin Group "wdm-ks"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\wdmks\pa_win_wdmks.c
+# End Source File
+# End Group
 # End Group
 # Begin Group "os"
 
@@ -228,6 +236,14 @@
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\src\os\win\pa_win_waveformat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\os\win\pa_win_wdmks_utils.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\src\os\win\pa_x86_plain_converters.c
 # End Source File
 # End Group

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.sln
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.sln	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.sln	Mon Aug  4 21:29:58 2008
@@ -5,28 +5,16 @@
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug DirectSound|Win32 = Debug DirectSound|Win32
-		Debug DirectSound|x64 = Debug DirectSound|x64
 		Debug|Win32 = Debug|Win32
 		Debug|x64 = Debug|x64
-		Release DirectSound|Win32 = Release DirectSound|Win32
-		Release DirectSound|x64 = Release DirectSound|x64
 		Release|Win32 = Release|Win32
 		Release|x64 = Release|x64
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug DirectSound|Win32.ActiveCfg = Debug DirectSound|Win32
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug DirectSound|Win32.Build.0 = Debug DirectSound|Win32
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug DirectSound|x64.ActiveCfg = Debug DirectSound|x64
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug DirectSound|x64.Build.0 = Debug DirectSound|x64
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug|Win32
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|x64
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.Build.0 = Debug|x64
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release DirectSound|Win32.ActiveCfg = Release DirectSound|Win32
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release DirectSound|Win32.Build.0 = Release DirectSound|Win32
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release DirectSound|x64.ActiveCfg = Release DirectSound|x64
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release DirectSound|x64.Build.0 = Release DirectSound|x64
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32
 		{0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|x64

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.vcproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/portaudio.vcproj	Mon Aug  4 21:29:58 2008
@@ -5,6 +5,7 @@
 	Name="portaudio"
 	ProjectGUID="{0A18A071-125E-442F-AFF7-A3F68ABECF99}"
 	RootNamespace="portaudio"
+	TargetFrameworkVersion="131072"
 	>
 	<Platforms>
 		<Platform
@@ -50,8 +51,8 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				InlineFunctionExpansion="0"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_DS"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_DS;PAWIN_USE_WDMKS_DEVICE_INFO"
 				StringPooling="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
@@ -95,10 +96,11 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|Win32"
+			Name="Release|x64"
 			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="4"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
 			UseOfMFC="0"
 			ATLMinimizesCRunTimeLibraryUsage="false"
 			>
@@ -116,66 +118,82 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
+				PreprocessorDefinitions="NDEBUG"
 				MkTypLibCompatible="true"
 				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Debug_x86/portaudio.tlb"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release_x86/portaudio.tlb"
 				HeaderFileName=""
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_DS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/portaudio.pch"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)\portaudio.pch"
 				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
 				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
 				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
 			/>
 			<Tool
 				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
+				PreprocessorDefinitions="NDEBUG"
 				Culture="1033"
 			/>
 			<Tool
 				Name="VCPreLinkEventTool"
 			/>
 			<Tool
-				Name="VCLibrarianTool"
+				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ModuleDefinitionFile=".\portaudio.def"
+				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(PlatformName)\$(ConfigurationName)/portaudio_x64.lib"
+				TargetMachine="17"
 			/>
 			<Tool
 				Name="VCALinkTool"
 			/>
 			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
 				Name="VCXDCMakeTool"
 			/>
 			<Tool
 				Name="VCBscMakeTool"
 				SuppressStartupBanner="true"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio.bsc"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.bsc"
 			/>
 			<Tool
 				Name="VCFxCopTool"
 			/>
 			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug DirectSound|Win32"
-			OutputDirectory="$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
+			Name="Debug|Win32"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
 			UseOfMFC="0"
 			ATLMinimizesCRunTimeLibraryUsage="false"
 			>
@@ -203,8 +221,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PA_NO_ASIO;PA_NO_DS;PAWIN_USE_WDMKS_DEVICE_INFO"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -228,23 +246,12 @@
 				Name="VCPreLinkEventTool"
 			/>
 			<Tool
-				Name="VCLinkerTool"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\portaudio.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.pdb"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x86.lib"
-				TargetMachine="1"
+				Name="VCLibrarianTool"
 			/>
 			<Tool
 				Name="VCALinkTool"
 			/>
 			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
 				Name="VCXDCMakeTool"
 			/>
 			<Tool
@@ -256,20 +263,15 @@
 				Name="VCFxCopTool"
 			/>
 			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release DirectSound|Win32"
-			OutputDirectory="$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
 			UseOfMFC="0"
 			ATLMinimizesCRunTimeLibraryUsage="false"
 			>
@@ -287,35 +289,35 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
+				PreprocessorDefinitions="_DEBUG"
 				MkTypLibCompatible="true"
 				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release_x86/portaudio.tlb"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Debug_x86/portaudio.tlb"
 				HeaderFileName=""
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
+				Optimization="0"
 				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
-				StringPooling="true"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/portaudio.pch"
+				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)\portaudio.pch"
 				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
 				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
 				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
 			/>
 			<Tool
 				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
+				PreprocessorDefinitions="_DEBUG"
 				Culture="1033"
 			/>
 			<Tool
@@ -323,13 +325,16 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
-				LinkIncremental="1"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
+				LinkIncremental="2"
 				SuppressStartupBanner="true"
 				ModuleDefinitionFile=".\portaudio.def"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.pdb"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x86.lib"
-				TargetMachine="1"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x64.lib"
+				TargetMachine="17"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -343,7 +348,7 @@
 			<Tool
 				Name="VCBscMakeTool"
 				SuppressStartupBanner="true"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio.bsc"
+				OutputFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.bsc"
 			/>
 			<Tool
 				Name="VCFxCopTool"
@@ -352,18 +357,14 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			Name="Debug DirectSound|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
 			UseOfMFC="0"
 			ATLMinimizesCRunTimeLibraryUsage="false"
 			>
@@ -381,35 +382,35 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
+				PreprocessorDefinitions="_DEBUG"
 				MkTypLibCompatible="true"
 				SuppressStartupBanner="true"
-				TargetEnvironment="3"
-				TypeLibraryName=".\Release_x86/portaudio.tlb"
+				TargetEnvironment="1"
+				TypeLibraryName=".\Debug_x86/portaudio.tlb"
 				HeaderFileName=""
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
-				StringPooling="true"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)\portaudio.pch"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/portaudio.pch"
 				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
 				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
 				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
 			/>
 			<Tool
 				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
+				PreprocessorDefinitions="_DEBUG"
 				Culture="1033"
 			/>
 			<Tool
@@ -417,13 +418,17 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
-				LinkIncremental="1"
+				AdditionalDependencies="ksuser.lib"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
+				LinkIncremental="2"
 				SuppressStartupBanner="true"
 				ModuleDefinitionFile=".\portaudio.def"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)/portaudio_x64.lib"
-				TargetMachine="17"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x86.lib"
+				TargetMachine="1"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -437,7 +442,7 @@
 			<Tool
 				Name="VCBscMakeTool"
 				SuppressStartupBanner="true"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.bsc"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio.bsc"
 			/>
 			<Tool
 				Name="VCFxCopTool"
@@ -446,14 +451,11 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|x64"
+			Name="Debug DirectSound|x64"
 			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
 			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="2"
@@ -485,8 +487,8 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -511,12 +513,15 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
 				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
 				LinkIncremental="2"
 				SuppressStartupBanner="true"
 				ModuleDefinitionFile=".\portaudio.def"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
 				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x64.lib"
 				TargetMachine="17"
 			/>
@@ -541,18 +546,14 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug DirectSound|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			Name="Release DirectSound|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
 			UseOfMFC="0"
 			ATLMinimizesCRunTimeLibraryUsage="false"
 			>
@@ -570,35 +571,35 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
+				PreprocessorDefinitions="NDEBUG"
 				MkTypLibCompatible="true"
 				SuppressStartupBanner="true"
-				TargetEnvironment="3"
-				TypeLibraryName=".\Debug_x86/portaudio.tlb"
+				TargetEnvironment="1"
+				TypeLibraryName=".\Release_x86/portaudio.tlb"
 				HeaderFileName=""
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)\portaudio.pch"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/portaudio.pch"
 				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
 				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
 				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
 			/>
 			<Tool
 				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
+				PreprocessorDefinitions="NDEBUG"
 				Culture="1033"
 			/>
 			<Tool
@@ -606,14 +607,15 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
-				LinkIncremental="2"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
+				LinkIncremental="1"
 				SuppressStartupBanner="true"
 				ModuleDefinitionFile=".\portaudio.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x64.lib"
-				TargetMachine="17"
+				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x86.lib"
+				TargetMachine="1"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -627,7 +629,7 @@
 			<Tool
 				Name="VCBscMakeTool"
 				SuppressStartupBanner="true"
-				OutputFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.bsc"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio.bsc"
 			/>
 			<Tool
 				Name="VCFxCopTool"
@@ -636,9 +638,6 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
@@ -706,6 +705,8 @@
 				SuppressStartupBanner="true"
 				ModuleDefinitionFile=".\portaudio.def"
 				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
 				ImportLibrary="$(PlatformName)\$(ConfigurationName)/portaudio_x64.lib"
 				TargetMachine="17"
 			/>
@@ -730,9 +731,6 @@
 				Name="VCAppVerifierTool"
 			/>
 			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
@@ -760,7 +758,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|Win32"
+						Name="Release|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -769,7 +767,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|Win32"
+						Name="Debug|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -778,7 +776,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release DirectSound|Win32"
+						Name="Debug|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -787,7 +785,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release|x64"
+						Name="Debug DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -796,7 +794,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|x64"
+						Name="Debug DirectSound|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -805,7 +803,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|x64"
+						Name="Release DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -836,7 +834,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|Win32"
+						Name="Release|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -845,7 +843,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|Win32"
+						Name="Debug|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -854,7 +852,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release DirectSound|Win32"
+						Name="Debug|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -863,7 +861,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release|x64"
+						Name="Debug DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -872,7 +870,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|x64"
+						Name="Debug DirectSound|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -881,7 +879,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|x64"
+						Name="Release DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -912,7 +910,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|Win32"
+						Name="Release|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -921,7 +919,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|Win32"
+						Name="Debug|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -930,7 +928,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release DirectSound|Win32"
+						Name="Debug|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -939,7 +937,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release|x64"
+						Name="Debug DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -948,7 +946,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|x64"
+						Name="Debug DirectSound|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -957,7 +955,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|x64"
+						Name="Release DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -988,7 +986,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|Win32"
+						Name="Release|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -997,7 +995,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|Win32"
+						Name="Debug|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1006,7 +1004,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release DirectSound|Win32"
+						Name="Debug|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1015,7 +1013,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release|x64"
+						Name="Debug DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1024,7 +1022,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|x64"
+						Name="Debug DirectSound|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1033,7 +1031,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|x64"
+						Name="Release DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1064,7 +1062,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|Win32"
+						Name="Release|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1073,7 +1071,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|Win32"
+						Name="Debug|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1082,7 +1080,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release DirectSound|Win32"
+						Name="Debug|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1091,7 +1089,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release|x64"
+						Name="Debug DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1100,7 +1098,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|x64"
+						Name="Debug DirectSound|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1109,7 +1107,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|x64"
+						Name="Release DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1140,7 +1138,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|Win32"
+						Name="Release|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1149,7 +1147,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|Win32"
+						Name="Debug|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1158,7 +1156,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release DirectSound|Win32"
+						Name="Debug|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1167,7 +1165,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release|x64"
+						Name="Debug DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1176,7 +1174,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|x64"
+						Name="Debug DirectSound|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1185,7 +1183,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|x64"
+						Name="Release DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1216,7 +1214,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|Win32"
+						Name="Release|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1225,7 +1223,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|Win32"
+						Name="Debug|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1234,7 +1232,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release DirectSound|Win32"
+						Name="Debug|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1243,7 +1241,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release|x64"
+						Name="Debug DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1252,7 +1250,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|x64"
+						Name="Debug DirectSound|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1261,7 +1259,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|x64"
+						Name="Release DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1292,7 +1290,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|Win32"
+						Name="Release|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1301,7 +1299,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|Win32"
+						Name="Debug|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1310,7 +1308,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release DirectSound|Win32"
+						Name="Debug|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1319,7 +1317,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release|x64"
+						Name="Debug DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1328,7 +1326,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|x64"
+						Name="Debug DirectSound|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1337,7 +1335,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|x64"
+						Name="Release DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1368,7 +1366,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|Win32"
+						Name="Release|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1377,7 +1375,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|Win32"
+						Name="Debug|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1386,7 +1384,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release DirectSound|Win32"
+						Name="Debug|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1395,7 +1393,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release|x64"
+						Name="Debug DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1404,7 +1402,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|x64"
+						Name="Debug DirectSound|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1413,7 +1411,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|x64"
+						Name="Release DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1444,7 +1442,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|Win32"
+						Name="Release|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1453,7 +1451,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|Win32"
+						Name="Debug|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1462,7 +1460,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release DirectSound|Win32"
+						Name="Debug|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1471,7 +1469,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Release|x64"
+						Name="Debug DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1480,7 +1478,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug|x64"
+						Name="Debug DirectSound|x64"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1489,7 +1487,7 @@
 						/>
 					</FileConfiguration>
 					<FileConfiguration
-						Name="Debug DirectSound|x64"
+						Name="Release DirectSound|Win32"
 						>
 						<Tool
 							Name="VCCLCompilerTool"
@@ -1528,8 +1526,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|Win32"
-							ExcludedFromBuild="true"
+							Name="Release|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -1538,7 +1535,8 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|Win32"
+							Name="Debug|Win32"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -1547,7 +1545,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release DirectSound|Win32"
+							Name="Debug|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -1556,7 +1554,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release|x64"
+							Name="Debug DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -1565,7 +1563,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|x64"
+							Name="Debug DirectSound|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -1574,7 +1572,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|x64"
+							Name="Release DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -1609,8 +1607,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|Win32"
-								ExcludedFromBuild="true"
+								Name="Release|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1619,7 +1616,8 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|Win32"
+								Name="Debug|Win32"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1628,7 +1626,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release DirectSound|Win32"
+								Name="Debug|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1637,7 +1635,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release|x64"
+								Name="Debug DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1646,7 +1644,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|x64"
+								Name="Debug DirectSound|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1655,7 +1653,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|x64"
+								Name="Release DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1687,8 +1685,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|Win32"
-								ExcludedFromBuild="true"
+								Name="Release|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1697,7 +1694,8 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|Win32"
+								Name="Debug|Win32"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1706,7 +1704,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release DirectSound|Win32"
+								Name="Debug|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1715,7 +1713,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release|x64"
+								Name="Debug DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1724,7 +1722,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|x64"
+								Name="Debug DirectSound|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1733,7 +1731,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|x64"
+								Name="Release DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1765,8 +1763,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|Win32"
-								ExcludedFromBuild="true"
+								Name="Release|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1775,7 +1772,8 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|Win32"
+								Name="Debug|Win32"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1784,7 +1782,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release DirectSound|Win32"
+								Name="Debug|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1793,7 +1791,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release|x64"
+								Name="Debug DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1802,7 +1800,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|x64"
+								Name="Debug DirectSound|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1811,7 +1809,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|x64"
+								Name="Release DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1843,8 +1841,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|Win32"
-								ExcludedFromBuild="true"
+								Name="Release|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1853,7 +1850,8 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|Win32"
+								Name="Debug|Win32"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1862,7 +1860,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release DirectSound|Win32"
+								Name="Debug|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1871,7 +1869,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release|x64"
+								Name="Debug DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1880,7 +1878,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|x64"
+								Name="Debug DirectSound|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1889,7 +1887,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|x64"
+								Name="Release DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1921,8 +1919,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|Win32"
-								ExcludedFromBuild="true"
+								Name="Release|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1931,7 +1928,8 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|Win32"
+								Name="Debug|Win32"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1940,7 +1938,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release DirectSound|Win32"
+								Name="Debug|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1949,7 +1947,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release|x64"
+								Name="Debug DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1958,7 +1956,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|x64"
+								Name="Debug DirectSound|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1967,7 +1965,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|x64"
+								Name="Release DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -1999,8 +1997,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|Win32"
-								ExcludedFromBuild="true"
+								Name="Release|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2009,7 +2006,8 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|Win32"
+								Name="Debug|Win32"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2018,7 +2016,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release DirectSound|Win32"
+								Name="Debug|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2027,7 +2025,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release|x64"
+								Name="Debug DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2036,7 +2034,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|x64"
+								Name="Debug DirectSound|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2045,7 +2043,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|x64"
+								Name="Release DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2077,8 +2075,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|Win32"
-								ExcludedFromBuild="true"
+								Name="Release|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2087,7 +2084,8 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|Win32"
+								Name="Debug|Win32"
+								ExcludedFromBuild="true"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2096,7 +2094,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release DirectSound|Win32"
+								Name="Debug|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2105,7 +2103,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Release|x64"
+								Name="Debug DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2114,7 +2112,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug|x64"
+								Name="Debug DirectSound|x64"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2123,7 +2121,7 @@
 								/>
 							</FileConfiguration>
 							<FileConfiguration
-								Name="Debug DirectSound|x64"
+								Name="Release DirectSound|Win32"
 								>
 								<Tool
 									Name="VCCLCompilerTool"
@@ -2160,8 +2158,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|Win32"
-							ExcludedFromBuild="true"
+							Name="Release|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2170,7 +2167,8 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|Win32"
+							Name="Debug|Win32"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2179,7 +2177,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release DirectSound|Win32"
+							Name="Debug|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2188,7 +2186,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release|x64"
+							Name="Debug DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2197,7 +2195,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|x64"
+							Name="Debug DirectSound|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2206,7 +2204,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|x64"
+							Name="Release DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2238,8 +2236,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|Win32"
-							ExcludedFromBuild="true"
+							Name="Release|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2248,7 +2245,8 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|Win32"
+							Name="Debug|Win32"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2257,7 +2255,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release DirectSound|Win32"
+							Name="Debug|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2266,7 +2264,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release|x64"
+							Name="Debug DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2275,7 +2273,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|x64"
+							Name="Debug DirectSound|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2284,7 +2282,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|x64"
+							Name="Release DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2319,7 +2317,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|Win32"
+							Name="Release|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2328,7 +2326,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|Win32"
+							Name="Debug|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2337,7 +2335,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release DirectSound|Win32"
+							Name="Debug|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2346,7 +2344,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release|x64"
+							Name="Debug DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2355,7 +2353,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|x64"
+							Name="Debug DirectSound|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2364,7 +2362,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|x64"
+							Name="Release DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2400,8 +2398,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|Win32"
-							ExcludedFromBuild="true"
+							Name="Release|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2410,7 +2407,8 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|Win32"
+							Name="Debug|Win32"
+							ExcludedFromBuild="true"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2419,7 +2417,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release DirectSound|Win32"
+							Name="Debug|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2428,7 +2426,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release|x64"
+							Name="Debug DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2437,7 +2435,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|x64"
+							Name="Debug DirectSound|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2446,7 +2444,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|x64"
+							Name="Release DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2485,7 +2483,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|Win32"
+							Name="Release|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2494,7 +2492,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|Win32"
+							Name="Debug|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2503,7 +2501,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release DirectSound|Win32"
+							Name="Debug|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2512,7 +2510,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release|x64"
+							Name="Debug DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2521,7 +2519,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|x64"
+							Name="Debug DirectSound|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2530,7 +2528,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|x64"
+							Name="Release DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2561,7 +2559,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|Win32"
+							Name="Release|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2570,7 +2568,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|Win32"
+							Name="Debug|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2579,7 +2577,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release DirectSound|Win32"
+							Name="Debug|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2588,7 +2586,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release|x64"
+							Name="Debug DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2597,7 +2595,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|x64"
+							Name="Debug DirectSound|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2606,7 +2604,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|x64"
+							Name="Release DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2625,6 +2623,14 @@
 						</FileConfiguration>
 					</File>
 					<File
+						RelativePath="..\..\src\os\win\pa_win_waveformat.c"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\os\win\pa_win_wdmks_utils.c"
+						>
+					</File>
+					<File
 						RelativePath="..\..\src\os\win\pa_x86_plain_converters.c"
 						>
 						<FileConfiguration
@@ -2637,7 +2643,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|Win32"
+							Name="Release|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2646,7 +2652,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|Win32"
+							Name="Debug|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2655,7 +2661,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release DirectSound|Win32"
+							Name="Debug|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2664,7 +2670,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Release|x64"
+							Name="Debug DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2673,7 +2679,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug|x64"
+							Name="Debug DirectSound|x64"
 							>
 							<Tool
 								Name="VCCLCompilerTool"
@@ -2682,7 +2688,7 @@
 							/>
 						</FileConfiguration>
 						<FileConfiguration
-							Name="Debug DirectSound|x64"
+							Name="Release DirectSound|Win32"
 							>
 							<Tool
 								Name="VCCLCompilerTool"

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/readme.txt
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/readme.txt	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/build/msvc/readme.txt	Mon Aug  4 21:29:58 2008
@@ -15,11 +15,41 @@
   
   You dont need "driver"
   
-
-2)If you have Visual Studio 6.0, 7.0(VC.NET/2001) or 7.1(VC.2003) 
+2)
+  *If you have Visual Studio 6.0*, please make sure you have it updated with the latest (and final)
+  microsoft libraries for it, namely:
+  
+  Service pack 5:         
+     Latest known URL:  
+     http://msdn2.microsoft.com/en-us/vstudio/aa718363.aspx 
+	 Yes there EXISTS a service pack 6 , but the processor pack (below) isnt compatible with it.
+	 
+  Processor Pack(only works with above SP5)
+     Latest known URL:
+     http://msdn2.microsoft.com/en-us/vstudio/Aa718349.aspx
+	 This isnt absolutely required for portaudio, but if you plan on using SSE intrinsics and similar things.
+	 Up to you to decide upon Service pack 5 or 6 depending on your need for intrinsics.
+
+  Platform SDK (Feb 2003) : 
+     Latest known URL:  
+     http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
+	 (This will allow your code base to be x64 friendly, with correct defines 
+	 for LONG_PTR and such)
+	 NOTE A) Yes you have to use IE activex scripts to install that - wont work in Firefox, you 
+	 may have to temporarily change tyour default browser(aint life unfair)
+	 NOTE B) Dont forget to hit "Register PSDK Directories with Visual Studio". 
+	 you can make sure its right in VC6 if you open tools/options/directories/include files and you see SDK 2003 as the FIRST entry
+	 (it must be the same for libs)
+  
+  DirectX 9.0 SDK Update - (Summer 2003)
+    Latest known URL:
+    http://www.microsoft.com/downloads/details.aspx?familyid=9216652f-51e0-402e-b7b5-feb68d00f298&displaylang=en
+    Again register the links in VC6, and check inside vc6 if headers are in second place right after SDk 2003
+	
+  *If you have 7.0(VC.NET/2001) or 7.1(VC.2003) *
   then I suggest you open portaudio.dsp (and convert if needed)
  
-  If you have Visual Studio 2005, I suggest you open the portaudio.sln file
+  *If you have Visual Studio 2005*, I suggest you open the portaudio.sln file
   which contains 4 configurations. Win32/x64 in both Release and Debug variants
 
   hit compile and hope for the best.

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/config.guess
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/config.guess	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/config.guess	Mon Aug  4 21:29:58 2008
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2005-12-13'
+timestamp='2003-02-22'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -17,15 +17,13 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-
 # Originally written by Per Bothner <per at bothner.com>.
 # Please send patches to <config-patches at gnu.org>.  Submit a context
 # diff and a properly formatted ChangeLog entry.
@@ -55,7 +53,7 @@
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
@@ -68,11 +66,11 @@
 while test $# -gt 0 ; do
   case $1 in
     --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
+       echo "$timestamp" ; exit 0 ;;
     --version | -v )
-       echo "$version" ; exit ;;
+       echo "$version" ; exit 0 ;;
     --help | --h* | -h )
-       echo "$usage"; exit ;;
+       echo "$usage"; exit 0 ;;
     -- )     # Stop option processing
        shift; break ;;
     - )	# Use stdin as input.
@@ -108,7 +106,6 @@
 : ${TMPDIR=/tmp} ;
  { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
  { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
 dummy=$tmp/dummy ;
 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
@@ -125,7 +122,7 @@
 	;;
  ,,*)   CC_FOR_BUILD=$CC ;;
  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
+esac ;'
 
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
 # (ghazi at noc.rutgers.edu 1994-08-24)
@@ -198,29 +195,50 @@
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
 	echo "${machine}-${os}${release}"
-	exit ;;
+	exit 0 ;;
+    amiga:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    arc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    hp300:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mac68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    macppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+	echo m88k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvmeppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    pmax:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sgi:OpenBSD:*:*)
+	echo mipseb-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sun3:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    wgrisc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
     *:OpenBSD:*:*)
-	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
-	exit ;;
-    *:ekkoBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
-	exit ;;
-    macppc:MirBSD:*:*)
-	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
-	exit ;;
-    *:MirBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
-	exit ;;
+	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
     alpha:OSF1:*:*)
-	case $UNAME_RELEASE in
-	*4.0)
+	if test $UNAME_RELEASE = "V4.0"; then
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-		;;
-	*5.*)
-	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
-		;;
-	esac
+	fi
 	# According to Compaq, /usr/sbin/psrinfo has been available on
 	# OSF/1 and Tru64 systems produced since 1995.  I hope that
 	# covers most systems running today.  This code pipes the CPU
@@ -258,49 +276,39 @@
 	    "EV7.9 (21364A)")
 		UNAME_MACHINE="alphaev79" ;;
 	esac
-	# A Pn.n version is a patched version.
 	# A Vn.n version is a released version.
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	exit ;;
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit 0 ;;
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# Should we change UNAME_MACHINE based on the output of uname instead
 	# of the specific Alpha model?
 	echo alpha-pc-interix
-	exit ;;
+	exit 0 ;;
     21064:Windows_NT:50:3)
 	echo alpha-dec-winnt3.5
-	exit ;;
+	exit 0 ;;
     Amiga*:UNIX_System_V:4.0:*)
 	echo m68k-unknown-sysv4
-	exit ;;
+	exit 0;;
     *:[Aa]miga[Oo][Ss]:*:*)
 	echo ${UNAME_MACHINE}-unknown-amigaos
-	exit ;;
+	exit 0 ;;
     *:[Mm]orph[Oo][Ss]:*:*)
 	echo ${UNAME_MACHINE}-unknown-morphos
-	exit ;;
+	exit 0 ;;
     *:OS/390:*:*)
 	echo i370-ibm-openedition
-	exit ;;
-    *:z/VM:*:*)
-	echo s390-ibm-zvmoe
-	exit ;;
-    *:OS400:*:*)
-        echo powerpc-ibm-os400
-	exit ;;
+	exit 0 ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
-	exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
-	echo arm-unknown-riscos
-	exit ;;
+	exit 0;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
 	echo hppa1.1-hitachi-hiuxmpp
-	exit ;;
+	exit 0;;
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
 	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
 	if test "`(/bin/universe) 2>/dev/null`" = att ; then
@@ -308,32 +316,29 @@
 	else
 		echo pyramid-pyramid-bsd
 	fi
-	exit ;;
+	exit 0 ;;
     NILE*:*:*:dcosx)
 	echo pyramid-pyramid-svr4
-	exit ;;
-    DRS?6000:unix:4.0:6*)
-	echo sparc-icl-nx6
-	exit ;;
-    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	exit 0 ;;
+    DRS?6000:UNIX_SV:4.2*:7*)
 	case `/usr/bin/uname -p` in
-	    sparc) echo sparc-icl-nx7; exit ;;
+	    sparc) echo sparc-icl-nx7 && exit 0 ;;
 	esac ;;
     sun4H:SunOS:5.*:*)
 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
+	exit 0 ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
+	exit 0 ;;
     i86pc:SunOS:5.*:*)
 	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
+	exit 0 ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
 	# it's likely to be more like Solaris than SunOS4.
 	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
+	exit 0 ;;
     sun4*:SunOS:*:*)
 	case "`/usr/bin/arch -k`" in
 	    Series*|S4*)
@@ -342,10 +347,10 @@
 	esac
 	# Japanese Language versions have a version number like `4.1.3-JL'.
 	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-	exit ;;
+	exit 0 ;;
     sun3*:SunOS:*:*)
 	echo m68k-sun-sunos${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     sun*:*:4.2BSD:*)
 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
 	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
@@ -357,10 +362,10 @@
 		echo sparc-sun-sunos${UNAME_RELEASE}
 		;;
 	esac
-	exit ;;
+	exit 0 ;;
     aushp:SunOS:*:*)
 	echo sparc-auspex-sunos${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
     # "atarist" or "atariste" at least should have a processor
@@ -371,40 +376,37 @@
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
         echo m68k-atari-mint${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
 	echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
+        exit 0 ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
         echo m68k-atari-mint${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
         echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
+        exit 0 ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
         echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
+        exit 0 ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
         echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
-    m68k:machten:*:*)
-	echo m68k-apple-machten${UNAME_RELEASE}
-	exit ;;
+        exit 0 ;;
     powerpc:machten:*:*)
 	echo powerpc-apple-machten${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     RISC*:Mach:*:*)
 	echo mips-dec-mach_bsd4.3
-	exit ;;
+	exit 0 ;;
     RISC*:ULTRIX:*:*)
 	echo mips-dec-ultrix${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     VAX*:ULTRIX*:*:*)
 	echo vax-dec-ultrix${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
 	echo clipper-intergraph-clix${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
@@ -428,33 +430,32 @@
 	  exit (-1);
 	}
 EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c &&
-	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-	  SYSTEM_NAME=`$dummy $dummyarg` &&
-	    { echo "$SYSTEM_NAME"; exit; }
+	$CC_FOR_BUILD -o $dummy $dummy.c \
+	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+	  && exit 0
 	echo mips-mips-riscos${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     Motorola:PowerMAX_OS:*:*)
 	echo powerpc-motorola-powermax
-	exit ;;
+	exit 0 ;;
     Motorola:*:4.3:PL8-*)
 	echo powerpc-harris-powermax
-	exit ;;
+	exit 0 ;;
     Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
 	echo powerpc-harris-powermax
-	exit ;;
+	exit 0 ;;
     Night_Hawk:Power_UNIX:*:*)
 	echo powerpc-harris-powerunix
-	exit ;;
+	exit 0 ;;
     m88k:CX/UX:7*:*)
 	echo m88k-harris-cxux7
-	exit ;;
+	exit 0 ;;
     m88k:*:4*:R4*)
 	echo m88k-motorola-sysv4
-	exit ;;
+	exit 0 ;;
     m88k:*:3*:R3*)
 	echo m88k-motorola-sysv3
-	exit ;;
+	exit 0 ;;
     AViiON:dgux:*:*)
         # DG/UX returns AViiON for all architectures
         UNAME_PROCESSOR=`/usr/bin/uname -p`
@@ -470,29 +471,29 @@
 	else
 	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
- 	exit ;;
+ 	exit 0 ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
-	exit ;;
+	exit 0 ;;
     M88*:*:R3*:*)
 	# Delta 88k system running SVR3
 	echo m88k-motorola-sysv3
-	exit ;;
+	exit 0 ;;
     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
 	echo m88k-tektronix-sysv3
-	exit ;;
+	exit 0 ;;
     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
 	echo m68k-tektronix-bsd
-	exit ;;
+	exit 0 ;;
     *:IRIX*:*:*)
 	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-	exit ;;
+	exit 0 ;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
+	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
     i*86:AIX:*:*)
 	echo i386-ibm-aix
-	exit ;;
+	exit 0 ;;
     ia64:AIX:*:*)
 	if [ -x /usr/bin/oslevel ] ; then
 		IBM_REV=`/usr/bin/oslevel`
@@ -500,7 +501,7 @@
 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
 	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
-	exit ;;
+	exit 0 ;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
 		eval $set_cc_for_build
@@ -515,18 +516,14 @@
 			exit(0);
 			}
 EOF
-		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
-		then
-			echo "$SYSTEM_NAME"
-		else
-			echo rs6000-ibm-aix3.2.5
-		fi
+		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+		echo rs6000-ibm-aix3.2.5
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
 		echo rs6000-ibm-aix3.2.4
 	else
 		echo rs6000-ibm-aix3.2
 	fi
-	exit ;;
+	exit 0 ;;
     *:AIX:*:[45])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
@@ -540,28 +537,28 @@
 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
 	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-	exit ;;
+	exit 0 ;;
     *:AIX:*:*)
 	echo rs6000-ibm-aix
-	exit ;;
+	exit 0 ;;
     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
 	echo romp-ibm-bsd4.4
-	exit ;;
+	exit 0 ;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
 	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-	exit ;;                             # report: romp-ibm BSD 4.3
+	exit 0 ;;                           # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
 	echo rs6000-bull-bosx
-	exit ;;
+	exit 0 ;;
     DPX/2?00:B.O.S.:*:*)
 	echo m68k-bull-sysv3
-	exit ;;
+	exit 0 ;;
     9000/[34]??:4.3bsd:1.*:*)
 	echo m68k-hp-bsd
-	exit ;;
+	exit 0 ;;
     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
 	echo m68k-hp-bsd4.4
-	exit ;;
+	exit 0 ;;
     9000/[34678]??:HP-UX:*:*)
 	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
 	case "${UNAME_MACHINE}" in
@@ -623,19 +620,9 @@
 	esac
 	if [ ${HP_ARCH} = "hppa2.0w" ]
 	then
-	    eval $set_cc_for_build
-
-	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
-	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
-	    # generating 64-bit code.  GNU and HP use different nomenclature:
-	    #
-	    # $ CC_FOR_BUILD=cc ./config.guess
-	    # => hppa2.0w-hp-hpux11.23
-	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
-	    # => hppa64-hp-hpux11.23
-
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-		grep __LP64__ >/dev/null
+	    # avoid double evaluation of $set_cc_for_build
+	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
 	    then
 		HP_ARCH="hppa2.0w"
 	    else
@@ -643,11 +630,11 @@
 	    fi
 	fi
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-	exit ;;
+	exit 0 ;;
     ia64:HP-UX:*:*)
 	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
 	echo ia64-hp-hpux${HPUX_REV}
-	exit ;;
+	exit 0 ;;
     3050*:HI-UX:*:*)
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
@@ -675,166 +662,147 @@
 	  exit (0);
 	}
 EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
-		{ echo "$SYSTEM_NAME"; exit; }
+	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
 	echo unknown-hitachi-hiuxwe2
-	exit ;;
+	exit 0 ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
 	echo hppa1.1-hp-bsd
-	exit ;;
+	exit 0 ;;
     9000/8??:4.3bsd:*:*)
 	echo hppa1.0-hp-bsd
-	exit ;;
+	exit 0 ;;
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
 	echo hppa1.0-hp-mpeix
-	exit ;;
+	exit 0 ;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
 	echo hppa1.1-hp-osf
-	exit ;;
+	exit 0 ;;
     hp8??:OSF1:*:*)
 	echo hppa1.0-hp-osf
-	exit ;;
+	exit 0 ;;
     i*86:OSF1:*:*)
 	if [ -x /usr/sbin/sysversion ] ; then
 	    echo ${UNAME_MACHINE}-unknown-osf1mk
 	else
 	    echo ${UNAME_MACHINE}-unknown-osf1
 	fi
-	exit ;;
+	exit 0 ;;
     parisc*:Lites*:*:*)
 	echo hppa1.1-hp-lites
-	exit ;;
+	exit 0 ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
-        exit ;;
+        exit 0 ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-        exit ;;
+        exit 0 ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
 	echo c34-convex-bsd
-        exit ;;
+        exit 0 ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
 	echo c38-convex-bsd
-        exit ;;
+        exit 0 ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
-        exit ;;
+        exit 0 ;;
     CRAY*Y-MP:*:*:*)
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	exit 0 ;;
     CRAY*[A-Z]90:*:*:*)
 	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
 	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
 	      -e 's/\.[^.]*$/.X/'
-	exit ;;
+	exit 0 ;;
     CRAY*TS:*:*:*)
 	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	exit 0 ;;
     CRAY*T3E:*:*:*)
 	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	exit 0 ;;
     CRAY*SV1:*:*:*)
 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	exit 0 ;;
     *:UNICOS/mp:*:*)
-	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
+	exit 0 ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit ;;
-    5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-	exit ;;
+        exit 0 ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     sparc*:BSD/OS:*:*)
 	echo sparc-unknown-bsdi${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     *:BSD/OS:*:*)
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     *:FreeBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-	exit ;;
+	# Determine whether the default compiler uses glibc.
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#if __GLIBC__ >= 2
+	LIBC=gnu
+	#else
+	LIBC=
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+	exit 0 ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
-	exit ;;
+	exit 0 ;;
     i*:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
-	exit ;;
-    i*:windows32*:*)
-    	# uname -m includes "-pc" on this system.
-    	echo ${UNAME_MACHINE}-mingw32
-	exit ;;
+	exit 0 ;;
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
-	exit ;;
-    x86:Interix*:[345]*)
-	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
-	exit ;;
+	exit 0 ;;
+    x86:Interix*:3*)
+	echo i586-pc-interix3
+	exit 0 ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
-	exit ;;
+	exit 0 ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
 	# UNAME_MACHINE based on the output of uname instead of i386?
 	echo i586-pc-interix
-	exit ;;
+	exit 0 ;;
     i*:UWIN*:*)
 	echo ${UNAME_MACHINE}-pc-uwin
-	exit ;;
-    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-	echo x86_64-unknown-cygwin
-	exit ;;
+	exit 0 ;;
     p*:CYGWIN*:*)
 	echo powerpcle-unknown-cygwin
-	exit ;;
+	exit 0 ;;
     prep*:SunOS:5.*:*)
 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
+	exit 0 ;;
     *:GNU:*:*)
-	# the GNU system
 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-	exit ;;
-    *:GNU/*:*:*)
-	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
-	exit ;;
+	exit 0 ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
-	exit ;;
+	exit 0 ;;
     arm*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    cris:Linux:*:*)
-	echo cris-axis-linux-gnu
-	exit ;;
-    crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
-	exit ;;
-    frv:Linux:*:*)
-    	echo frv-unknown-linux-gnu
-	exit ;;
+	exit 0 ;;
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
+	exit 0 ;;
     m68*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
+	exit 0 ;;
     mips:Linux:*:*)
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
@@ -851,8 +819,8 @@
 	#endif
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
 	;;
     mips64:Linux:*:*)
 	eval $set_cc_for_build
@@ -870,18 +838,15 @@
 	#endif
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
 	;;
-    or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
-	exit ;;
     ppc:Linux:*:*)
 	echo powerpc-unknown-linux-gnu
-	exit ;;
+	exit 0 ;;
     ppc64:Linux:*:*)
 	echo powerpc64-unknown-linux-gnu
-	exit ;;
+	exit 0 ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -895,7 +860,7 @@
 	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
 	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
 	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
-	exit ;;
+	exit 0 ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -903,28 +868,22 @@
 	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
 	  *)    echo hppa-unknown-linux-gnu ;;
 	esac
-	exit ;;
+	exit 0 ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
 	echo hppa64-unknown-linux-gnu
-	exit ;;
+	exit 0 ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
-	exit ;;
-    sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
+	exit 0 ;;
     sh*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
+	exit 0 ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-gnu
-	exit ;;
+	exit 0 ;;
     x86_64:Linux:*:*)
 	echo x86_64-unknown-linux-gnu
-	exit ;;
+	exit 0 ;;
     i*86:Linux:*:*)
 	# The BFD linker knows what the default object file format is, so
 	# first see if it will tell us. cd to the root directory to prevent
@@ -942,15 +901,15 @@
 		;;
 	  a.out-i386-linux)
 		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit ;;
+		exit 0 ;;
 	  coff-i386)
 		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-		exit ;;
+		exit 0 ;;
 	  "")
 		# Either a pre-BFD a.out linker (linux-gnuoldld) or
 		# one that does not give us useful --help.
 		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-		exit ;;
+		exit 0 ;;
 	esac
 	# Determine whether the default compiler is a.out or elf
 	eval $set_cc_for_build
@@ -967,29 +926,23 @@
 	LIBC=gnulibc1
 	# endif
 	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI)
+	#ifdef __INTEL_COMPILER
 	LIBC=gnu
 	#else
 	LIBC=gnuaout
 	#endif
 	#endif
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`"
-	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-		exit
-	}
-	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
 	;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# earlier versions are messed up and put the nodename in both
 	# sysname and nodename.
 	echo i386-sequent-sysv4
-	exit ;;
+	exit 0 ;;
     i*86:UNIX_SV:4.2MP:2.*)
         # Unixware is an offshoot of SVR4, but it has its own version
         # number series starting with 2...
@@ -997,27 +950,24 @@
 	# I just have to hope.  -- rms.
         # Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-	exit ;;
+	exit 0 ;;
     i*86:OS/2:*:*)
 	# If we were able to find `uname', then EMX Unix compatibility
 	# is probably installed.
 	echo ${UNAME_MACHINE}-pc-os2-emx
-	exit ;;
+	exit 0 ;;
     i*86:XTS-300:*:STOP)
 	echo ${UNAME_MACHINE}-unknown-stop
-	exit ;;
+	exit 0 ;;
     i*86:atheos:*:*)
 	echo ${UNAME_MACHINE}-unknown-atheos
-	exit ;;
-    i*86:syllable:*:*)
-	echo ${UNAME_MACHINE}-pc-syllable
-	exit ;;
+	exit 0 ;;
     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     i*86:*DOS:*:*)
 	echo ${UNAME_MACHINE}-pc-msdosdjgpp
-	exit ;;
+	exit 0 ;;
     i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
 	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
@@ -1025,16 +975,15 @@
 	else
 		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
 	fi
-	exit ;;
-    i*86:*:5:[678]*)
-    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	exit 0 ;;
+    i*86:*:5:[78]*)
 	case `/bin/uname -X | grep "^Machine"` in
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
 	esac
 	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
-	exit ;;
+	exit 0 ;;
     i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
@@ -1052,73 +1001,73 @@
 	else
 		echo ${UNAME_MACHINE}-pc-sysv32
 	fi
-	exit ;;
+	exit 0 ;;
     pc:*:*:*)
 	# Left here for compatibility:
         # uname -m prints for DJGPP always 'pc', but it prints nothing about
         # the processor, so we play safe by assuming i386.
 	echo i386-pc-msdosdjgpp
-        exit ;;
+        exit 0 ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
-	exit ;;
+	exit 0 ;;
     paragon:*:*:*)
 	echo i860-intel-osf1
-	exit ;;
+	exit 0 ;;
     i860:*:4.*:*) # i860-SVR4
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
 	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
 	else # Add other i860-SVR4 vendors below as they are discovered.
 	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
 	fi
-	exit ;;
+	exit 0 ;;
     mini*:CTIX:SYS*5:*)
 	# "miniframe"
 	echo m68010-convergent-sysv
-	exit ;;
+	exit 0 ;;
     mc68k:UNIX:SYSTEM5:3.51m)
 	echo m68k-convergent-sysv
-	exit ;;
+	exit 0 ;;
     M680?0:D-NIX:5.3:*)
 	echo m68k-diab-dnix
-	exit ;;
-    M68*:*:R3V[5678]*:*)
-	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
-    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	exit 0 ;;
+    M68*:*:R3V[567]*:*)
+	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
 	OS_REL=''
 	test -r /etc/.relid \
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
+          && echo i486-ncr-sysv4 && exit 0 ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
 	echo m68k-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
-	exit ;;
+	exit 0 ;;
     TSUNAMI:LynxOS:2.*:*)
 	echo sparc-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     rs6000:LynxOS:2.*:*)
 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
 	echo powerpc-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     SM[BE]S:UNIX_SV:*:*)
 	echo mips-dde-sysv${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     RM*:ReliantUNIX-*:*:*)
 	echo mips-sni-sysv4
-	exit ;;
+	exit 0 ;;
     RM*:SINIX-*:*:*)
 	echo mips-sni-sysv4
-	exit ;;
+	exit 0 ;;
     *:SINIX-*:*:*)
 	if uname -p 2>/dev/null >/dev/null ; then
 		UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -1126,72 +1075,68 @@
 	else
 		echo ns32k-sni-sysv
 	fi
-	exit ;;
+	exit 0 ;;
     PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
                       # says <Richard.M.Bartel at ccMail.Census.GOV>
         echo i586-unisys-sysv4
-        exit ;;
+        exit 0 ;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes at openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
 	echo hppa1.1-stratus-sysv4
-	exit ;;
+	exit 0 ;;
     *:*:*:FTX*)
 	# From seanf at swdc.stratus.com.
 	echo i860-stratus-sysv4
-	exit ;;
-    i*86:VOS:*:*)
-	# From Paul.Green at stratus.com.
-	echo ${UNAME_MACHINE}-stratus-vos
-	exit ;;
+	exit 0 ;;
     *:VOS:*:*)
 	# From Paul.Green at stratus.com.
 	echo hppa1.1-stratus-vos
-	exit ;;
+	exit 0 ;;
     mc68*:A/UX:*:*)
 	echo m68k-apple-aux${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     news*:NEWS-OS:6*:*)
 	echo mips-sony-newsos6
-	exit ;;
+	exit 0 ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
 	        echo mips-nec-sysv${UNAME_RELEASE}
 	else
 	        echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
-        exit ;;
+        exit 0 ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
 	echo powerpc-be-beos
-	exit ;;
+	exit 0 ;;
     BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
 	echo powerpc-apple-beos
-	exit ;;
+	exit 0 ;;
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
 	echo i586-pc-beos
-	exit ;;
+	exit 0 ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     SX-5:SUPER-UX:*:*)
 	echo sx5-nec-superux${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     SX-6:SUPER-UX:*:*)
 	echo sx6-nec-superux${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     *:Rhapsody:*:*)
 	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     *:Darwin:*:*)
-	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	case $UNAME_PROCESSOR in
-	    unknown) UNAME_PROCESSOR=powerpc ;;
+	case `uname -p` in
+	    *86) UNAME_PROCESSOR=i686 ;;
+	    powerpc) UNAME_PROCESSOR=powerpc ;;
 	esac
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 	UNAME_PROCESSOR=`uname -p`
 	if test "$UNAME_PROCESSOR" = "x86"; then
@@ -1199,25 +1144,22 @@
 		UNAME_MACHINE=pc
 	fi
 	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     *:QNX:*:4*)
 	echo i386-pc-qnx
-	exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
-	echo nse-tandem-nsk${UNAME_RELEASE}
-	exit ;;
-    NSR-?:NONSTOP_KERNEL:*:*)
+	exit 0 ;;
+    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
 	echo nsr-tandem-nsk${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     *:NonStop-UX:*:*)
 	echo mips-compaq-nonstopux
-	exit ;;
+	exit 0 ;;
     BS2000:POSIX*:*:*)
 	echo bs2000-siemens-sysv
-	exit ;;
+	exit 0 ;;
     DS/*:UNIX_System_V:*:*)
 	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
-	exit ;;
+	exit 0 ;;
     *:Plan9:*:*)
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# is converted to i386 for consistency with other x86
@@ -1228,47 +1170,25 @@
 	    UNAME_MACHINE="$cputype"
 	fi
 	echo ${UNAME_MACHINE}-unknown-plan9
-	exit ;;
+	exit 0 ;;
     *:TOPS-10:*:*)
 	echo pdp10-unknown-tops10
-	exit ;;
+	exit 0 ;;
     *:TENEX:*:*)
 	echo pdp10-unknown-tenex
-	exit ;;
+	exit 0 ;;
     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
 	echo pdp10-dec-tops20
-	exit ;;
+	exit 0 ;;
     XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
 	echo pdp10-xkl-tops20
-	exit ;;
+	exit 0 ;;
     *:TOPS-20:*:*)
 	echo pdp10-unknown-tops20
-	exit ;;
+	exit 0 ;;
     *:ITS:*:*)
 	echo pdp10-unknown-its
-	exit ;;
-    SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
-	exit ;;
-    *:DragonFly:*:*)
-	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-	exit ;;
-    *:*VMS:*:*)
-    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
-	case "${UNAME_MACHINE}" in
-	    A*) echo alpha-dec-vms ; exit ;;
-	    I*) echo ia64-dec-vms ; exit ;;
-	    V*) echo vax-dec-vms ; exit ;;
-	esac ;;
-    *:XENIX:*:SysV)
-	echo i386-pc-xenix
-	exit ;;
-    i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
-	exit ;;
-    i*86:rdos:*:*)
-	echo ${UNAME_MACHINE}-pc-rdos
-	exit ;;
+	exit 0 ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1300,7 +1220,7 @@
 #endif
 
 #if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
+  printf ("arm-acorn-riscix"); exit (0);
 #endif
 
 #if defined (hp300) && !defined (hpux)
@@ -1389,12 +1309,11 @@
 }
 EOF
 
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-	{ echo "$SYSTEM_NAME"; exit; }
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
 
 # Apollos put the system type in the environment.
 
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
 
 # Convex versions that predate uname can use getsysinfo(1)
 
@@ -1403,22 +1322,22 @@
     case `getsysinfo -f cpu_type` in
     c1*)
 	echo c1-convex-bsd
-	exit ;;
+	exit 0 ;;
     c2*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-	exit ;;
+	exit 0 ;;
     c34*)
 	echo c34-convex-bsd
-	exit ;;
+	exit 0 ;;
     c38*)
 	echo c38-convex-bsd
-	exit ;;
+	exit 0 ;;
     c4*)
 	echo c4-convex-bsd
-	exit ;;
+	exit 0 ;;
     esac
 fi
 
@@ -1429,9 +1348,7 @@
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
-and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+    ftp://ftp.gnu.org/pub/gnu/config/
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/config.sub
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/config.sub	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/config.sub	Mon Aug  4 21:29:58 2008
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2005-12-11'
+timestamp='2003-02-22'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -21,15 +21,14 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-
 # Please send patches to <config-patches at gnu.org>.  Submit a context
 # diff and a properly formatted ChangeLog entry.
 #
@@ -71,7 +70,7 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
@@ -84,11 +83,11 @@
 while test $# -gt 0 ; do
   case $1 in
     --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
+       echo "$timestamp" ; exit 0 ;;
     --version | -v )
-       echo "$version" ; exit ;;
+       echo "$version" ; exit 0 ;;
     --help | --h* | -h )
-       echo "$usage"; exit ;;
+       echo "$usage"; exit 0 ;;
     -- )     # Stop option processing
        shift; break ;;
     - )	# Use stdin as input.
@@ -100,7 +99,7 @@
     *local*)
        # First pass through any local machine types.
        echo $1
-       exit ;;
+       exit 0;;
 
     * )
        break ;;
@@ -119,9 +118,7 @@
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
-  storm-chaos* | os2-emx* | rtmk-nova*)
+  nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -147,7 +144,7 @@
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray)
+	-apple | -axis)
 		os=
 		basic_machine=$1
 		;;
@@ -172,10 +169,6 @@
 	-hiux*)
 		os=-hiuxwe2
 		;;
-	-sco6)
-		os=-sco5v6
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
 	-sco5)
 		os=-sco3.2v5
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -192,10 +185,6 @@
 		# Don't forget version if it is 3.2v4 or newer.
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
-	-sco5v6*)
-		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
 	-sco*)
 		os=-sco3.2v2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -239,16 +228,14 @@
 	| a29k \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
-	| am33_2.0 \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-	| bfin \
-	| c4x | clipper \
+	| clipper \
 	| d10v | d30v | dlx | dsp16xx \
 	| fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
-	| ip2k | iq2000 \
-	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+	| ip2k \
+	| m32r | m68000 | m68k | m88k | mcore \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -257,37 +244,30 @@
 	| mips64vr4100 | mips64vr4100el \
 	| mips64vr4300 | mips64vr4300el \
 	| mips64vr5000 | mips64vr5000el \
-	| mips64vr5900 | mips64vr5900el \
 	| mipsisa32 | mipsisa32el \
 	| mipsisa32r2 | mipsisa32r2el \
 	| mipsisa64 | mipsisa64el \
-	| mipsisa64r2 | mipsisa64r2el \
 	| mipsisa64sb1 | mipsisa64sb1el \
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
-	| mt \
 	| msp430 \
 	| ns16k | ns32k \
-	| or32 \
+	| openrisc | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
-	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
-	| sparcv8 | sparcv9 | sparcv9b \
+	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
 	| strongarm \
-	| tahoe | thumb | tic4x | tic80 | tron \
+	| tahoe | thumb | tic80 | tron \
 	| v850 | v850e \
 	| we32k \
-	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| x86 | xscale | xstormy16 | xtensa \
 	| z8k)
 		basic_machine=$basic_machine-unknown
 		;;
-	m32c)
-		basic_machine=$basic_machine-unknown
-		;;
 	m6811 | m68hc11 | m6812 | m68hc12)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
@@ -295,9 +275,6 @@
 		;;
 	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
 		;;
-	ms1)
-		basic_machine=mt-unknown
-		;;
 
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
@@ -318,19 +295,19 @@
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* \
-	| bfin-* | bs2000-* \
+	| bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
-	| clipper-* | craynv-* | cydra-* \
+	| clipper-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
 	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
-	| ip2k-* | iq2000-* \
-	| m32r-* | m32rle-* \
+	| ip2k-* \
+	| m32r-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| m88110-* | m88k-* | mcore-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -339,40 +316,33 @@
 	| mips64vr4100-* | mips64vr4100el-* \
 	| mips64vr4300-* | mips64vr4300el-* \
 	| mips64vr5000-* | mips64vr5000el-* \
-	| mips64vr5900-* | mips64vr5900el-* \
 	| mipsisa32-* | mipsisa32el-* \
 	| mipsisa32r2-* | mipsisa32r2el-* \
 	| mipsisa64-* | mipsisa64el-* \
-	| mipsisa64r2-* | mipsisa64r2el-* \
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
 	| mipstx39-* | mipstx39el-* \
-	| mmix-* \
-	| mt-* \
 	| msp430-* \
-	| none-* | np1-* | ns16k-* | ns32k-* \
+	| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
 	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
-	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tron-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+	| xtensa-* \
 	| ymp-* \
 	| z8k-*)
 		;;
-	m32c-*)
-		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
@@ -389,9 +359,6 @@
 		basic_machine=a29k-amd
 		os=-udi
 		;;
-    	abacus)
-		basic_machine=abacus-unknown
-		;;
 	adobe68k)
 		basic_machine=m68010-adobe
 		os=-scout
@@ -406,12 +373,6 @@
 		basic_machine=a29k-none
 		os=-bsd
 		;;
-	amd64)
-		basic_machine=x86_64-pc
-		;;
-	amd64-*)
-		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
 	amdahl)
 		basic_machine=580-amdahl
 		os=-sysv
@@ -471,27 +432,12 @@
 		basic_machine=j90-cray
 		os=-unicos
 		;;
-	craynv)
-		basic_machine=craynv-cray
-		os=-unicosmp
-		;;
-	cr16c)
-		basic_machine=cr16c-unknown
-		os=-elf
-		;;
 	crds | unos)
 		basic_machine=m68k-crds
 		;;
-	crisv32 | crisv32-* | etraxfs*)
-		basic_machine=crisv32-axis
-		;;
 	cris | cris-* | etrax*)
 		basic_machine=cris-axis
 		;;
-	crx)
-		basic_machine=crx-unknown
-		os=-elf
-		;;
 	da30 | da30-*)
 		basic_machine=m68k-da30
 		;;
@@ -514,10 +460,6 @@
 		basic_machine=m88k-motorola
 		os=-sysv3
 		;;
-	djgpp)
-		basic_machine=i586-pc
-		os=-msdosdjgpp
-		;;
 	dpx20 | dpx20-*)
 		basic_machine=rs6000-bull
 		os=-bosx
@@ -696,6 +638,10 @@
 	mips3*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
 		;;
+	mmix*)
+		basic_machine=mmix-knuth
+		os=-mmixware
+		;;
 	monitor)
 		basic_machine=m68k-rom68k
 		os=-coff
@@ -708,9 +654,6 @@
 		basic_machine=i386-pc
 		os=-msdos
 		;;
-	ms1-*)
-		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
-		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
@@ -779,6 +722,10 @@
 	np1)
 		basic_machine=np1-gould
 		;;
+	nv1)
+		basic_machine=nv1-cray
+		os=-unicosmp
+		;;
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
@@ -786,12 +733,9 @@
 		basic_machine=hppa1.1-oki
 		os=-proelf
 		;;
-	openrisc | openrisc-*)
+	or32 | or32-*)
 		basic_machine=or32-unknown
-		;;
-	os400)
-		basic_machine=powerpc-ibm
-		os=-os400
+		os=-coff
 		;;
 	OSE68000 | ose68000)
 		basic_machine=m68000-ericsson
@@ -824,24 +768,18 @@
 	pentiumpro | p6 | 6x86 | athlon | athlon_*)
 		basic_machine=i686-pc
 		;;
-	pentiumii | pentium2 | pentiumiii | pentium3)
+	pentiumii | pentium2)
 		basic_machine=i686-pc
 		;;
-	pentium4)
-		basic_machine=i786-pc
-		;;
 	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+	pentiumii-* | pentium2-*)
 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
-	pentium4-*)
-		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
 	pn)
 		basic_machine=pn-gould
 		;;
@@ -874,10 +812,6 @@
 		basic_machine=i586-unknown
 		os=-pw32
 		;;
-	rdos)
-		basic_machine=i386-pc
-		os=-rdos
-		;;
 	rom68k)
 		basic_machine=m68k-rom68k
 		os=-coff
@@ -904,10 +838,6 @@
 	sb1el)
 		basic_machine=mipsisa64sb1el-unknown
 		;;
-	sei)
-		basic_machine=mips-sei
-		os=-seiux
-		;;
 	sequent)
 		basic_machine=i386-sequent
 		;;
@@ -915,9 +845,6 @@
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
-	sh64)
-		basic_machine=sh64-unknown
-		;;
 	sparclite-wrs | simso-wrs)
 		basic_machine=sparclite-wrs
 		os=-vxworks
@@ -992,6 +919,10 @@
 		basic_machine=t90-cray
 		os=-unicos
 		;;
+        tic4x | c4x*)
+		basic_machine=tic4x-unknown
+		os=-coff
+		;;
 	tic54x | c54x*)
 		basic_machine=tic54x-unknown
 		os=-coff
@@ -1017,10 +948,6 @@
 	tower | tower-32)
 		basic_machine=m68k-ncr
 		;;
-	tpf)
-		basic_machine=s390x-ibm
-		os=-tpf
-		;;
 	udi29k)
 		basic_machine=a29k-amd
 		os=-udi
@@ -1064,10 +991,6 @@
 		basic_machine=hppa1.1-winbond
 		os=-proelf
 		;;
-	xbox)
-		basic_machine=i686-pc
-		os=-mingw32
-		;;
 	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
@@ -1098,9 +1021,6 @@
 	romp)
 		basic_machine=romp-ibm
 		;;
-	mmix)
-		basic_machine=mmix-knuth
-		;;
 	rs6000)
 		basic_machine=rs6000-ibm
 		;;
@@ -1117,10 +1037,13 @@
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b)
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparc | sparcv9 | sparcv9b)
 		basic_machine=sparc-sun
 		;;
 	cydra)
@@ -1193,22 +1116,19 @@
 	      | -aos* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
-	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
-	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
-	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos*)
+	      | -powermax* | -dnix*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1226,15 +1146,12 @@
 		os=`echo $os | sed -e 's|nto|nto-qnx|'`
 		;;
 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
 	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
 		;;
 	-mac*)
 		os=`echo $os | sed -e 's|mac|macos|'`
 		;;
-	-linux-dietlibc)
-		os=-linux-dietlibc
-		;;
 	-linux*)
 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
@@ -1247,9 +1164,6 @@
 	-opened*)
 		os=-openedition
 		;;
-        -os400*)
-		os=-os400
-		;;
 	-wince*)
 		os=-wince
 		;;
@@ -1271,9 +1185,6 @@
 	-atheos*)
 		os=-atheos
 		;;
-	-syllable*)
-		os=-syllable
-		;;
 	-386bsd)
 		os=-bsd
 		;;
@@ -1296,9 +1207,6 @@
 	-sinix*)
 		os=-sysv4
 		;;
-        -tpf*)
-		os=-tpf
-		;;
 	-triton*)
 		os=-sysv3
 		;;
@@ -1335,9 +1243,6 @@
 	-kaos*)
 		os=-kaos
 		;;
-	-zvmoe)
-		os=-zvmoe
-		;;
 	-none)
 		;;
 	*)
@@ -1369,9 +1274,6 @@
 	arm*-semi)
 		os=-aout
 		;;
-    c4x-* | tic4x-*)
-        os=-coff
-        ;;
 	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
@@ -1415,15 +1317,9 @@
 	*-be)
 		os=-beos
 		;;
-	*-haiku)
-		os=-haiku
-		;;
 	*-ibm)
 		os=-aix
 		;;
-    	*-knuth)
-		os=-mmixware
-		;;
 	*-wec)
 		os=-proelf
 		;;
@@ -1556,15 +1452,9 @@
 			-mvs* | -opened*)
 				vendor=ibm
 				;;
-			-os400*)
-				vendor=ibm
-				;;
 			-ptx*)
 				vendor=sequent
 				;;
-			-tpf*)
-				vendor=ibm
-				;;
 			-vxsim* | -vxworks* | -windiss*)
 				vendor=wrs
 				;;
@@ -1589,7 +1479,7 @@
 esac
 
 echo $basic_machine$os
-exit
+exit 0
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/configure
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/configure	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/configure	Mon Aug  4 21:29:58 2008
@@ -1,54 +1,25 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61.
+# Generated by GNU Autoconf 2.59.
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 ## --------------------- ##
 ## M4sh Initialization.  ##
 ## --------------------- ##
 
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
+# Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
   # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
 fi
+DUALCASE=1; export DUALCASE # for MKS sh
 
 # Support unset when possible.
 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -58,43 +29,8 @@
 fi
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" ""	$as_nl"
-
-# Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
-fi
-
 # Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
+$as_unset ENV MAIL MAILPATH
 PS1='$ '
 PS2='> '
 PS4='+ '
@@ -108,19 +44,18 @@
   if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+    $as_unset $as_var
   fi
 done
 
 # Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
   as_expr=expr
 else
   as_expr=false
 fi
 
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
   as_basename=basename
 else
   as_basename=false
@@ -128,388 +63,157 @@
 
 
 # Name of the executable.
-as_me=`$as_basename -- "$0" ||
+as_me=`$as_basename "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
 echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-
-# CDPATH.
-$as_unset CDPATH
-
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
 
-if test "x$CONFIG_SHELL" = x; then
-  if (eval ":") 2>/dev/null; then
-  as_have_required=yes
-else
-  as_have_required=no
-fi
-
-  if test $as_have_required = yes && 	 (eval ":
-(as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
 
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
 fi
 
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
 
-test \$exitcode = 0) || { (exit 1); exit 1; }
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
 
-(
-  as_lineno_1=\$LINENO
-  as_lineno_2=\$LINENO
-  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
-  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
-  :
-else
-  as_candidate_shells=
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
     as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  case $as_dir in
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
 	 /*)
-	   for as_base in sh bash ksh sh5; do
-	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
-	   done;;
-       esac
-done
-IFS=$as_save_IFS
-
-
-      for as_shell in $as_candidate_shells $SHELL; do
-	 # Try only shells that exist, to save several forks.
-	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-		{ ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-_ASEOF
-}; then
-  CONFIG_SHELL=$as_shell
-	       as_have_required=yes
-	       if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-(as_func_return () {
-  (exit $1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
-  break
-fi
-
-fi
-
-      done
-
-      if test "x$CONFIG_SHELL" != x; then
-  for as_var in BASH_ENV ENV
-        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-        done
-        export CONFIG_SHELL
-        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
-    if test $as_have_required = no; then
-  echo This script requires a shell more modern than all the
-      echo shells that I found on your system.  Please install a
-      echo modern shell, or manually run the script under such a
-      echo shell if you do have one.
-      { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
-  echo No shell found that supports shell functions.
-  echo Please tell autoconf at gnu.org about your system,
-  echo including any error possibly output before this
-  echo message
-}
-
-
-
+	   if ("$as_dir/$as_base" -c '
   as_lineno_1=$LINENO
   as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
   test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
   # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
   # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
     sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
       N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
       t loop
-      s/-\n.*//
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
     ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
+  chmod +x $as_me.lineno ||
     { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
    { (exit 1); exit 1; }; }
 
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
   # Exit status is that of the last command.
   exit
 }
 
 
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
 esac
 
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
   as_expr=expr
 else
   as_expr=false
 fi
 
 rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
 echo >conf$$.file
 if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... but there are two gotchas:
-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-  # In both cases, we have to default to `cp -p'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
     as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
 elif ln conf$$.file conf$$ 2>/dev/null; then
   as_ln_s=ln
 else
   as_ln_s='cp -p'
 fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
+rm -f conf$$ conf$$.exe conf$$.file
 
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
@@ -518,28 +222,7 @@
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-        test -d "$1/.";
-      else
-	case $1 in
-        -*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_executable_p="test -f"
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -548,6 +231,15 @@
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
 
 
 # Check that we are running under the correct shell.
@@ -703,26 +395,29 @@
 
 tagnames=${tagnames+${tagnames},}F77
 
-exec 7<&0 </dev/null 6>&1
-
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
 # so uname gets run too.
 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
+exec 6>&1
+
 #
 # Initializations.
 #
 ac_default_prefix=/usr/local
-ac_clean_files=
 ac_config_libobj_dir=.
-LIBOBJS=
 cross_compiling=no
 subdirs=
 MFLAGS=
 MAKEFLAGS=
 SHELL=${CONFIG_SHELL-/bin/sh}
 
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
 # Identity of this package.
 PACKAGE_NAME=
 PACKAGE_TARNAME=
@@ -734,151 +429,43 @@
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
+#if HAVE_SYS_TYPES_H
 # include <sys/types.h>
 #endif
-#ifdef HAVE_SYS_STAT_H
+#if HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
-#ifdef STDC_HEADERS
+#if STDC_HEADERS
 # include <stdlib.h>
 # include <stddef.h>
 #else
-# ifdef HAVE_STDLIB_H
+# if HAVE_STDLIB_H
 #  include <stdlib.h>
 # endif
 #endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
 #  include <memory.h>
 # endif
 # include <string.h>
 #endif
-#ifdef HAVE_STRINGS_H
+#if HAVE_STRINGS_H
 # include <strings.h>
 #endif
-#ifdef HAVE_INTTYPES_H
+#if HAVE_INTTYPES_H
 # include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
 #endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL
-PATH_SEPARATOR
-PACKAGE_NAME
-PACKAGE_TARNAME
-PACKAGE_VERSION
-PACKAGE_STRING
-PACKAGE_BUGREPORT
-exec_prefix
-prefix
-program_transform_name
-bindir
-sbindir
-libexecdir
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-CPPFLAGS
-ac_ct_CC
-EXEEXT
-OBJEXT
-build
-build_cpu
-build_vendor
-build_os
-host
-host_cpu
-host_vendor
-host_os
-GREP
-EGREP
-LN_S
-ECHO
-AR
-RANLIB
-STRIP
-DLLTOOL
-AS
-OBJDUMP
-CPP
-CXX
-CXXFLAGS
-ac_ct_CXX
-CXXCPP
-F77
-FFLAGS
-ac_ct_F77
-LIBTOOL
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-PKG_CONFIG
-JACK_CFLAGS
-JACK_LIBS
-LT_CURRENT
-LT_REVISION
-LT_AGE
-OTHER_OBJS
-PADLL
-SHARED_FLAGS
-THREAD_CFLAGS
-DLL_LIBS
-NASM
-NASMOPT
-subdirs
-ENABLE_CXX_TRUE
-ENABLE_CXX_FALSE
-LIBOBJS
-LTLIBOBJS'
+ac_subdirs_all="$ac_subdirs_all bindings/cpp"
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CPP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PKG_CONFIG ac_pt_PKG_CONFIG JACK_CFLAGS JACK_LIBS LT_CURRENT LT_REVISION LT_AGE OTHER_OBJS PADLL SHARED_FLAGS THREAD_CFLAGS DLL_LIBS NASM NASMOPT subdirs ENABLE_CXX_TRUE ENABLE_CXX_FALSE LIBOBJS LTLIBOBJS'
 ac_subst_files=''
-      ac_precious_vars='build_alias
-host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-CPP
-CXX
-CXXFLAGS
-CCC
-CXXCPP
-F77
-FFLAGS
-PKG_CONFIG
-JACK_CFLAGS
-JACK_LIBS'
-ac_subdirs_all='bindings/cpp'
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -905,48 +492,34 @@
 # and all the variables that are supposed to be based on exec_prefix
 # by default will actually change.
 # Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
+datadir='${prefix}/share'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
 
 ac_prev=
-ac_dashdash=
 for ac_option
 do
   # If the previous option needs an argument, assign it.
   if test -n "$ac_prev"; then
-    eval $ac_prev=\$ac_option
+    eval "$ac_prev=\$ac_option"
     ac_prev=
     continue
   fi
 
-  case $ac_option in
-  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-  *)	ac_optarg=yes ;;
-  esac
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
 
-  case $ac_dashdash$ac_option in
-  --)
-    ac_dashdash=yes ;;
+  case $ac_option in
 
   -bindir | --bindir | --bindi | --bind | --bin | --bi)
     ac_prev=bindir ;;
@@ -968,45 +541,33 @@
   --config-cache | -C)
     cache_file=config.cache ;;
 
-  -datadir | --datadir | --datadi | --datad)
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
     ac_prev=datadir ;;
-  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
     datadir=$ac_optarg ;;
 
-  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
-  | --dataroo | --dataro | --datar)
-    ac_prev=datarootdir ;;
-  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
-  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
-    datarootdir=$ac_optarg ;;
-
   -disable-* | --disable-*)
     ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid feature name: $ac_feature" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
-    eval enable_$ac_feature=no ;;
-
-  -docdir | --docdir | --docdi | --doc | --do)
-    ac_prev=docdir ;;
-  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
-    docdir=$ac_optarg ;;
-
-  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
-    ac_prev=dvidir ;;
-  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
-    dvidir=$ac_optarg ;;
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
 
   -enable-* | --enable-*)
     ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid feature name: $ac_feature" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
-    eval enable_$ac_feature=\$ac_optarg ;;
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$ac_optarg'" ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -1033,12 +594,6 @@
   -host=* | --host=* | --hos=* | --ho=*)
     host_alias=$ac_optarg ;;
 
-  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
-    ac_prev=htmldir ;;
-  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
-  | --ht=*)
-    htmldir=$ac_optarg ;;
-
   -includedir | --includedir | --includedi | --included | --include \
   | --includ | --inclu | --incl | --inc)
     ac_prev=includedir ;;
@@ -1063,16 +618,13 @@
   | --libexe=* | --libex=* | --libe=*)
     libexecdir=$ac_optarg ;;
 
-  -localedir | --localedir | --localedi | --localed | --locale)
-    ac_prev=localedir ;;
-  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
-    localedir=$ac_optarg ;;
-
   -localstatedir | --localstatedir | --localstatedi | --localstated \
-  | --localstate | --localstat | --localsta | --localst | --locals)
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
     ac_prev=localstatedir ;;
   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
     localstatedir=$ac_optarg ;;
 
   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
@@ -1137,16 +689,6 @@
   | --progr-tra=* | --program-tr=* | --program-t=*)
     program_transform_name=$ac_optarg ;;
 
-  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
-    ac_prev=pdfdir ;;
-  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
-    pdfdir=$ac_optarg ;;
-
-  -psdir | --psdir | --psdi | --psd | --ps)
-    ac_prev=psdir ;;
-  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
-    psdir=$ac_optarg ;;
-
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
@@ -1199,20 +741,24 @@
   -with-* | --with-*)
     ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid package name: $ac_package" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
-    eval with_$ac_package=\$ac_optarg ;;
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
 
   -without-* | --without-*)
     ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid package name: $ac_package" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
-    eval with_$ac_package=no ;;
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
 
   --x)
     # Obsolete; use --with-x.
@@ -1243,7 +789,8 @@
     expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
    { (exit 1); exit 1; }; }
-    eval $ac_envvar=\$ac_optarg
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
     export $ac_envvar ;;
 
   *)
@@ -1263,19 +810,27 @@
    { (exit 1); exit 1; }; }
 fi
 
-# Be sure to have absolute directory names.
-for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
-		datadir sysconfdir sharedstatedir localstatedir includedir \
-		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
 do
-  eval ac_val=\$$ac_var
+  eval ac_val=$`echo $ac_var`
   case $ac_val in
-    [\\/$]* | ?:[\\/]* )  continue;;
-    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+	      localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
   esac
-  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; }
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -1302,76 +857,106 @@
 test "$silent" = yes && exec 6>/dev/null
 
 
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  { echo "$as_me: error: Working directory cannot be determined" >&2
-   { (exit 1); exit 1; }; }
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  { echo "$as_me: error: pwd does not report name of working directory" >&2
-   { (exit 1); exit 1; }; }
-
-
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
-  # Try the directory containing this script, then the parent directory.
-  ac_confdir=`$as_dirname -- "$0" ||
+  # Try the directory containing this script, then its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
 $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$0" : 'X\(//\)[^/]' \| \
 	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+	 X"$0" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
 echo X"$0" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
   srcdir=$ac_confdir
-  if test ! -r "$srcdir/$ac_unique_file"; then
+  if test ! -r $srcdir/$ac_unique_file; then
     srcdir=..
   fi
 else
   ac_srcdir_defaulted=no
 fi
-if test ! -r "$srcdir/$ac_unique_file"; then
-  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
    { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
 fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
    { (exit 1); exit 1; }; }
-	pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
-  srcdir=.
-fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
-  eval ac_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_env_${ac_var}_value=\$${ac_var}
-  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_cv_env_${ac_var}_value=\$${ac_var}
-done
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+ac_env_CXX_set=${CXX+set}
+ac_env_CXX_value=$CXX
+ac_cv_env_CXX_set=${CXX+set}
+ac_cv_env_CXX_value=$CXX
+ac_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_env_CXXFLAGS_value=$CXXFLAGS
+ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_cv_env_CXXFLAGS_value=$CXXFLAGS
+ac_env_CXXCPP_set=${CXXCPP+set}
+ac_env_CXXCPP_value=$CXXCPP
+ac_cv_env_CXXCPP_set=${CXXCPP+set}
+ac_cv_env_CXXCPP_value=$CXXCPP
+ac_env_F77_set=${F77+set}
+ac_env_F77_value=$F77
+ac_cv_env_F77_set=${F77+set}
+ac_cv_env_F77_value=$F77
+ac_env_FFLAGS_set=${FFLAGS+set}
+ac_env_FFLAGS_value=$FFLAGS
+ac_cv_env_FFLAGS_set=${FFLAGS+set}
+ac_cv_env_FFLAGS_value=$FFLAGS
+ac_env_PKG_CONFIG_set=${PKG_CONFIG+set}
+ac_env_PKG_CONFIG_value=$PKG_CONFIG
+ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set}
+ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG
+ac_env_JACK_CFLAGS_set=${JACK_CFLAGS+set}
+ac_env_JACK_CFLAGS_value=$JACK_CFLAGS
+ac_cv_env_JACK_CFLAGS_set=${JACK_CFLAGS+set}
+ac_cv_env_JACK_CFLAGS_value=$JACK_CFLAGS
+ac_env_JACK_LIBS_set=${JACK_LIBS+set}
+ac_env_JACK_LIBS_value=$JACK_LIBS
+ac_cv_env_JACK_LIBS_set=${JACK_LIBS+set}
+ac_cv_env_JACK_LIBS_value=$JACK_LIBS
 
 #
 # Report the --help message.
@@ -1400,6 +985,9 @@
   -n, --no-create         do not create output files
       --srcdir=DIR        find the sources in DIR [configure dir or \`..']
 
+_ACEOF
+
+  cat <<_ACEOF
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
 			  [$ac_default_prefix]
@@ -1417,22 +1005,15 @@
   --bindir=DIR           user executables [EPREFIX/bin]
   --sbindir=DIR          system admin executables [EPREFIX/sbin]
   --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
   --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
   --libdir=DIR           object code libraries [EPREFIX/lib]
   --includedir=DIR       C header files [PREFIX/include]
   --oldincludedir=DIR    C header files for non-gcc [/usr/include]
-  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
-  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
-  --infodir=DIR          info documentation [DATAROOTDIR/info]
-  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
-  --mandir=DIR           man documentation [DATAROOTDIR/man]
-  --docdir=DIR           documentation root [DATAROOTDIR/doc/PACKAGE]
-  --htmldir=DIR          html documentation [DOCDIR]
-  --dvidir=DIR           dvi documentation [DOCDIR]
-  --pdfdir=DIR           pdf documentation [DOCDIR]
-  --psdir=DIR            ps documentation [DOCDIR]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
 _ACEOF
 
   cat <<\_ACEOF
@@ -1452,8 +1033,10 @@
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-debug-output
   --enable-cxx (default=no)
-  --enable-shared[=PKGS]  build shared libraries [default=yes]
-  --enable-static[=PKGS]  build static libraries [default=yes]
+  --enable-shared[=PKGS]
+                          build shared libraries [default=yes]
+  --enable-static[=PKGS]
+                          build static libraries [default=yes]
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
@@ -1473,16 +1056,16 @@
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
-  --with-tags[=TAGS]      include additional configurations [automatic]
+  --with-tags[=TAGS]
+                          include additional configurations [automatic]
 
 Some influential environment variables:
   CC          C compiler command
   CFLAGS      C compiler flags
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
-  LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
-              you have headers in a nonstandard directory <include dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
   CPP         C preprocessor
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
@@ -1497,86 +1080,118 @@
 it to find libraries and programs with nonstandard names/locations.
 
 _ACEOF
-ac_status=$?
 fi
 
 if test "$ac_init_help" = "recursive"; then
   # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
   for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d "$ac_dir" || continue
+    test -d $ac_dir || continue
     ac_builddir=.
 
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
+if test "$ac_dir" != .; then
   ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
 
 case $srcdir in
-  .)  # We are building in place.
+  .)  # No --srcdir option.  We are building in place.
     ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
     ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
 esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
 
-    cd "$ac_dir" || { ac_status=$?; continue; }
-    # Check for guested configure.
-    if test -f "$ac_srcdir/configure.gnu"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
-    elif test -f "$ac_srcdir/configure"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure" --help=recursive
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+	   test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
     else
       echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-    fi || ac_status=$?
-    cd "$ac_pwd" || { ac_status=$?; break; }
+    fi
+    cd $ac_popdir
   done
 fi
 
-test -n "$ac_init_help" && exit $ac_status
+test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-configure
-generated by GNU Autoconf 2.61
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+Copyright (C) 2003 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
-  exit
+  exit 0
 fi
-cat >config.log <<_ACEOF
+exec 5>config.log
+cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
+generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
 
 _ACEOF
-exec 5>>config.log
 {
 cat <<_ASUNAME
 ## --------- ##
@@ -1595,7 +1210,7 @@
 /bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
 /usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
 /bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
 /bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
@@ -1609,7 +1224,6 @@
   test -z "$as_dir" && as_dir=.
   echo "PATH: $as_dir"
 done
-IFS=$as_save_IFS
 
 } >&5
 
@@ -1631,6 +1245,7 @@
 ac_configure_args=
 ac_configure_args0=
 ac_configure_args1=
+ac_sep=
 ac_must_keep_next=false
 for ac_pass in 1 2
 do
@@ -1641,7 +1256,7 @@
     -q | -quiet | --quiet | --quie | --qui | --qu | --q \
     | -silent | --silent | --silen | --sile | --sil)
       continue ;;
-    *\'*)
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
       ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     case $ac_pass in
@@ -1663,7 +1278,9 @@
 	  -* ) ac_must_keep_next=true ;;
 	esac
       fi
-      ac_configure_args="$ac_configure_args '$ac_arg'"
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
       ;;
     esac
   done
@@ -1674,8 +1291,8 @@
 # When interrupted or exit'd, cleanup temporary files, and complete
 # config.log.  We remove comments because anyway the quotes in there
 # would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
 trap 'exit_status=$?
   # Save into config.log some information that might help in debugging.
   {
@@ -1688,34 +1305,20 @@
 _ASBOX
     echo
     # The following way of writing the cache mishandles newlines in values,
-(
-  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      *) $as_unset $ac_var ;;
-      esac ;;
-    esac
-  done
+{
   (set) 2>&1 |
-    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
       sed -n \
-	"s/'\''/'\''\\\\'\'''\''/g;
-	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
-      ;; #(
+	"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
     *)
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
       ;;
-    esac |
-    sort
-)
+    esac;
+}
     echo
 
     cat <<\_ASBOX
@@ -1726,28 +1329,22 @@
     echo
     for ac_var in $ac_subst_vars
     do
-      eval ac_val=\$$ac_var
-      case $ac_val in
-      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-      esac
-      echo "$ac_var='\''$ac_val'\''"
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
     done | sort
     echo
 
     if test -n "$ac_subst_files"; then
       cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
+## ------------- ##
+## Output files. ##
+## ------------- ##
 _ASBOX
       echo
       for ac_var in $ac_subst_files
       do
-	eval ac_val=\$$ac_var
-	case $ac_val in
-	*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-	esac
-	echo "$ac_var='\''$ac_val'\''"
+	eval ac_val=$`echo $ac_var`
+	echo "$ac_var='"'"'$ac_val'"'"'"
       done | sort
       echo
     fi
@@ -1759,24 +1356,26 @@
 ## ----------- ##
 _ASBOX
       echo
-      cat confdefs.h
+      sed "/^$/d" confdefs.h | sort
       echo
     fi
     test "$ac_signal" != 0 &&
       echo "$as_me: caught signal $ac_signal"
     echo "$as_me: exit $exit_status"
   } >&5
-  rm -f core *.core core.conftest.* &&
-    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
     exit $exit_status
-' 0
+     ' 0
 for ac_signal in 1 2 13 15; do
   trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
 done
 ac_signal=0
 
 # confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
 
 # Predefined preprocessor variables.
 
@@ -1807,17 +1406,14 @@
 
 # Let the site file select an alternate cache file if it wants to.
 # Prefer explicitly selected file to automatically selected ones.
-if test -n "$CONFIG_SITE"; then
-  set x "$CONFIG_SITE"
-elif test "x$prefix" != xNONE; then
-  set x "$prefix/share/config.site" "$prefix/etc/config.site"
-else
-  set x "$ac_default_prefix/share/config.site" \
-	"$ac_default_prefix/etc/config.site"
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
 fi
-shift
-for ac_site_file
-do
+for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
     { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
 echo "$as_me: loading site script $ac_site_file" >&6;}
@@ -1833,8 +1429,8 @@
     { echo "$as_me:$LINENO: loading cache $cache_file" >&5
 echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
-      [\\/]* | ?:[\\/]* ) . "$cache_file";;
-      *)                      . "./$cache_file";;
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
     esac
   fi
 else
@@ -1846,11 +1442,12 @@
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
+for ac_var in `(set) 2>&1 |
+	       sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
   eval ac_old_set=\$ac_cv_env_${ac_var}_set
   eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val=\$ac_cv_env_${ac_var}_value
-  eval ac_new_val=\$ac_env_${ac_var}_value
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
   case $ac_old_set,$ac_new_set in
     set,)
       { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
@@ -1875,7 +1472,8 @@
   # Pass precious variables to config.status.
   if test "$ac_new_set" = set; then
     case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
     *) ac_arg=$ac_var=$ac_new_val ;;
     esac
     case " $ac_configure_args " in
@@ -1892,6 +1490,11 @@
    { (exit 1); exit 1; }; }
 fi
 
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
@@ -1908,97 +1511,94 @@
 
 
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
 
 
-# Check whether --with-alsa was given.
+
+# Check whether --with-alsa or --without-alsa was given.
 if test "${with_alsa+set}" = set; then
-  withval=$with_alsa; with_alsa=$withval
+  withval="$with_alsa"
+  with_alsa=$withval
 else
   with_alsa="yes"
-fi
+fi;
 
 
-
-# Check whether --with-jack was given.
+# Check whether --with-jack or --without-jack was given.
 if test "${with_jack+set}" = set; then
-  withval=$with_jack; with_jack=$withval
+  withval="$with_jack"
+  with_jack=$withval
 else
   with_jack="yes"
-fi
+fi;
 
 
-
-# Check whether --with-oss was given.
+# Check whether --with-oss or --without-oss was given.
 if test "${with_oss+set}" = set; then
-  withval=$with_oss; with_oss=$withval
+  withval="$with_oss"
+  with_oss=$withval
 else
   with_oss="yes"
-fi
+fi;
 
 
-
-# Check whether --with-asihpi was given.
+# Check whether --with-asihpi or --without-asihpi was given.
 if test "${with_asihpi+set}" = set; then
-  withval=$with_asihpi; with_asihpi=$withval
+  withval="$with_asihpi"
+  with_asihpi=$withval
 else
   with_asihpi="yes"
-fi
+fi;
 
 
-
-# Check whether --with-host_os was given.
+# Check whether --with-host_os or --without-host_os was given.
 if test "${with_host_os+set}" = set; then
-  withval=$with_host_os; host_os=$withval
-fi
+  withval="$with_host_os"
+  host_os=$withval
+fi;
 
 
-
-# Check whether --with-winapi was given.
+# Check whether --with-winapi or --without-winapi was given.
 if test "${with_winapi+set}" = set; then
-  withval=$with_winapi; with_winapi=$withval
+  withval="$with_winapi"
+  with_winapi=$withval
 else
   with_winapi="wmme"
-fi
+fi;
 
 
-
-# Check whether --with-macapi was given.
+# Check whether --with-macapi or --without-macapi was given.
 if test "${with_macapi+set}" = set; then
-  withval=$with_macapi; with_macapi=$withval
+  withval="$with_macapi"
+  with_macapi=$withval
 else
   with_macapi="core"
-fi
+fi;
 
 
-
-# Check whether --with-asiodir was given.
+# Check whether --with-asiodir or --without-asiodir was given.
 if test "${with_asiodir+set}" = set; then
-  withval=$with_asiodir; with_asiodir=$withval
+  withval="$with_asiodir"
+  with_asiodir=$withval
 else
   with_asiodir="/usr/local/asiosdk2"
-fi
+fi;
 
 
-
-# Check whether --with-dxdir was given.
+# Check whether --with-dxdir or --without-dxdir was given.
 if test "${with_dxdir+set}" = set; then
-  withval=$with_dxdir; with_dxdir=$withval
+  withval="$with_dxdir"
+  with_dxdir=$withval
 else
   with_dxdir="/usr/local/dx7sdk"
-fi
+fi;
 
-
-# Check whether --enable-debug-output was given.
+# Check whether --enable-debug-output or --disable-debug-output was given.
 if test "${enable_debug_output+set}" = set; then
-  enableval=$enable_debug_output; if test x$enableval != xno ; then
+  enableval="$enable_debug_output"
+  if test x$enableval != xno ; then
 
 cat >>confdefs.h <<\_ACEOF
 #define PA_ENABLE_DEBUG_OUTPUT
@@ -2006,16 +1606,15 @@
 
           fi
 
-fi
-
+fi;
 
-# Check whether --enable-cxx was given.
+# Check whether --enable-cxx or --disable-cxx was given.
 if test "${enable_cxx+set}" = set; then
-  enableval=$enable_cxx; enable_cxx=$enableval
+  enableval="$enable_cxx"
+  enable_cxx=$enableval
 else
   enable_cxx="no"
-fi
-
+fi;
 
 
 ac_ext=c
@@ -2026,8 +1625,8 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2040,34 +1639,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
 fi
 if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2080,51 +1677,36 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
+  CC=$ac_ct_CC
 else
   CC="$ac_cv_prog_CC"
 fi
 
 if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2137,34 +1719,74 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
   fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
 fi
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2178,7 +1800,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -2189,7 +1811,6 @@
   fi
 done
 done
-IFS=$as_save_IFS
 
 if test $ac_prog_rejected = yes; then
   # We found a bogon in the path, so make sure we never use it.
@@ -2207,23 +1828,22 @@
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
 fi
 if test -z "$CC"; then
   if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl.exe
+  for ac_prog in cl
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2236,38 +1856,36 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
     test -n "$CC" && break
   done
 fi
 if test -z "$CC"; then
   ac_ct_CC=$CC
-  for ac_prog in cl.exe
+  for ac_prog in cl
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2280,45 +1898,29 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
   test -n "$ac_ct_CC" && break
 done
 
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
+  CC=$ac_ct_CC
 fi
 
 fi
@@ -2331,35 +1933,21 @@
    { (exit 1); exit 1; }; }
 
 # Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C compiler version" >&5
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
@@ -2384,77 +1972,47 @@
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-#
-# List of possible output files, starting from the most likely.
-# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
-# only as a last resort.  b.out is created by i960 compilers.
-ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
-#
-# The IRIX 6 linker writes into existing files which may not be
-# executable, retaining their permissions.  Remove them first so a
-# subsequent execution test works.
-ac_rmfiles=
-for ac_file in $ac_files
-do
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
-    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
-  esac
-done
-rm -f $ac_rmfiles
-
-if { (ac_try="$ac_link_default"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link_default") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile.  We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
 do
   test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+	;;
+    conftest.$ac_ext )
+	# This is the source file.
 	;;
     [ab].out )
 	# We found the default executable, but exeext='' is most
 	# certainly right.
 	break;;
     *.* )
-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
-	then :; else
-	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	fi
-	# We set ac_cv_exeext here because the later test for it is not
-	# safe: cross compilers may not add the suffix if given an `-o'
-	# argument, so we may need to know it at that point already.
-	# Even if this section looks crufty: it has the advantage of
-	# actually working.
+	ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	# FIXME: I believe we export ac_cv_exeext for Libtool,
+	# but it would be cool to find out if it's true.  Does anybody
+	# maintain Libtool? --akim.
+	export ac_cv_exeext
 	break;;
     * )
 	break;;
   esac
 done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
 else
-  ac_file=''
-fi
-
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6; }
-if test -z "$ac_file"; then
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
@@ -2466,21 +2024,19 @@
 fi
 
 ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
 
-# Check that the compiler produces executables we can run.  If not, either
+# Check the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
 # If not cross compiling, check that we can run a simple program.
 if test "$cross_compiling" != yes; then
   if { ac_try='./$ac_file'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -2499,27 +2055,22 @@
     fi
   fi
 fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
 
 rm -f a.out a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run.  If not, either
+# Check the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6; }
-
-{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
@@ -2530,8 +2081,9 @@
 for ac_file in conftest.exe conftest conftest.*; do
   test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
     *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  export ac_cv_exeext
 	  break;;
     * ) break;;
   esac
@@ -2545,14 +2097,14 @@
 fi
 
 rm -f conftest$ac_cv_exeext
-{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
 if test "${ac_cv_objext+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2572,20 +2124,14 @@
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>&5
+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
-  for ac_file in conftest.o conftest.obj conftest.*; do
-  test -f "$ac_file" || continue;
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
     *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
        break;;
   esac
@@ -2603,12 +2149,12 @@
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
 if test "${ac_cv_c_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2631,49 +2177,50 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_compiler_gnu=no
+ac_compiler_gnu=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
 GCC=`test $ac_compiler_gnu = yes && echo yes`
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
 if test "${ac_cv_prog_cc_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2689,118 +2236,38 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_c_werror_flag=$ac_save_c_werror_flag
-	 CFLAGS="-g"
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); }; }; then
   ac_cv_prog_cc_g=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_prog_cc_g=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
@@ -2816,12 +2283,12 @@
     CFLAGS=
   fi
 fi
-{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_prog_cc_c89=no
+  ac_cv_prog_cc_stdc=no
 ac_save_CC=$CC
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -2855,17 +2322,12 @@
 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
    function prototypes and stuff, but not '\xHH' hex character constants.
    These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
+   as 'x'.  The following induces an error, until -std1 is added to get
    proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
    array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
+   that's true only with -std1.  */
 int osf4_cc_array ['\x00' == 0 ? 1 : -1];
 
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
 int test (int i, double x);
 struct s1 {int (*f) (int a);};
 struct s2 {int (*f) (double a);};
@@ -2880,92 +2342,241 @@
   return 0;
 }
 _ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX			-qlanglvl=ansi
+# Ultrix and OSF/1	-std1
+# HP-UX 10.20 and later	-Ae
+# HP-UX older versions	-Aa -D_HPUX_SOURCE
+# SVR4			-Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
 do
   CC="$ac_save_CC $ac_arg"
   rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_c89=$ac_arg
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
+rm -f conftest.err conftest.$ac_objext
 done
-rm -f conftest.$ac_ext
+rm -f conftest.$ac_ext conftest.$ac_objext
 CC=$ac_save_CC
 
 fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6; } ;;
-  xno)
-    { echo "$as_me:$LINENO: result: unsupported" >&5
-echo "${ECHO_T}unsupported" >&6; } ;;
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
   *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
 esac
 
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-# Check whether --enable-shared was given.
-if test "${enable_shared+set}" = set; then
-  enableval=$enable_shared; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
-    *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
 else
-  enable_shared=yes
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 
 
-# Check whether --enable-static was given.
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi;
+
+# Check whether --enable-static or --disable-static was given.
 if test "${enable_static+set}" = set; then
-  enableval=$enable_static; p=${PACKAGE-default}
+  enableval="$enable_static"
+  p=${PACKAGE-default}
     case $enableval in
     yes) enable_static=yes ;;
     no) enable_static=no ;;
@@ -2984,12 +2595,12 @@
     esac
 else
   enable_static=yes
-fi
-
+fi;
 
-# Check whether --enable-fast-install was given.
+# Check whether --enable-fast-install or --disable-fast-install was given.
 if test "${enable_fast_install+set}" = set; then
-  enableval=$enable_fast_install; p=${PACKAGE-default}
+  enableval="$enable_fast_install"
+  p=${PACKAGE-default}
     case $enableval in
     yes) enable_fast_install=yes ;;
     no) enable_fast_install=no ;;
@@ -3008,125 +2619,89 @@
     esac
 else
   enable_fast_install=yes
-fi
-
+fi;
 
 ac_aux_dir=
-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-  if test -f "$ac_dir/install-sh"; then
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
     ac_aux_dir=$ac_dir
     ac_install_sh="$ac_aux_dir/install-sh -c"
     break
-  elif test -f "$ac_dir/install.sh"; then
+  elif test -f $ac_dir/install.sh; then
     ac_aux_dir=$ac_dir
     ac_install_sh="$ac_aux_dir/install.sh -c"
     break
-  elif test -f "$ac_dir/shtool"; then
+  elif test -f $ac_dir/shtool; then
     ac_aux_dir=$ac_dir
     ac_install_sh="$ac_aux_dir/shtool install -c"
     break
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
-echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
    { (exit 1); exit 1; }; }
 fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
-
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 
 # Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
    { (exit 1); exit 1; }; }
 
-{ echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
 if test "${ac_cv_build+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
   { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
 echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
    { (exit 1); exit 1; }; }
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-echo "$as_me: error: invalid value of canonical build" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
 build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
 
-{ echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
 if test "${ac_cv_host+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if test "x$host_alias" = x; then
-  ac_cv_host=$ac_cv_build
-else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
    { (exit 1); exit 1; }; }
-fi
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-echo "$as_me: error: invalid value of canonical host" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
 host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
 
-{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
-echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6
 if test "${lt_cv_path_SED+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3179,184 +2754,37 @@
 fi
 
 SED=$lt_cv_path_SED
-{ echo "$as_me:$LINENO: result: $SED" >&5
-echo "${ECHO_T}$SED" >&6; }
-
-{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  # Extract the first word of "grep ggrep" to use in msg output
-if test -z "$GREP"; then
-set dummy grep ggrep; ac_prog_name=$2
-if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_path_GREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in grep ggrep; do
-  for ac_exec_ext in '' $ac_executable_extensions; do
-    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
-    # Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
-    $ac_path_GREP_found && break 3
-  done
-done
-
-done
-IFS=$as_save_IFS
-
-
-fi
-
-GREP="$ac_cv_path_GREP"
-if test -z "$GREP"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
+echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
 
-{ echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     # Extract the first word of "egrep" to use in msg output
-if test -z "$EGREP"; then
-set dummy egrep; ac_prog_name=$2
-if test "${ac_cv_path_EGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_path_EGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in egrep; do
-  for ac_exec_ext in '' $ac_executable_extensions; do
-    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
-    # Check for GNU ac_path_EGREP and select it if it is found.
-  # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
     fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
-    $ac_path_EGREP_found && break 3
-  done
-done
-
-done
-IFS=$as_save_IFS
-
-
-fi
-
-EGREP="$ac_cv_path_EGREP"
-if test -z "$EGREP"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-else
-  ac_cv_path_EGREP=$EGREP
-fi
-
-
-   fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
 
 
 
-# Check whether --with-gnu-ld was given.
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
 if test "${with_gnu_ld+set}" = set; then
-  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
 else
   with_gnu_ld=no
-fi
-
+fi;
 ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
-  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -3385,11 +2813,11 @@
     ;;
   esac
 elif test "$with_gnu_ld" = yes; then
-  { echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
 else
-  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
 fi
 if test "${lt_cv_path_LD+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3422,17 +2850,17 @@
 
 LD="$lt_cv_path_LD"
 if test -n "$LD"; then
-  { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
+  echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
    { (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
 if test "${lt_cv_prog_gnu_ld+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3446,20 +2874,20 @@
   ;;
 esac
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
 with_gnu_ld=$lt_cv_prog_gnu_ld
 
 
-{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
-echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
 if test "${lt_cv_ld_reload_flag+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   lt_cv_ld_reload_flag='-r'
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
-echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
 reload_flag=$lt_cv_ld_reload_flag
 case $reload_flag in
 "" | " "*) ;;
@@ -3476,8 +2904,8 @@
     ;;
 esac
 
-{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
-echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6
 if test "${lt_cv_path_NM+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3525,23 +2953,23 @@
   test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
 fi
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
-echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6
 NM="$lt_cv_path_NM"
 
-{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
 LN_S=$as_ln_s
 if test "$LN_S" = "ln -s"; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
 else
-  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6; }
+  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
 fi
 
-{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
-echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
+echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6
 if test "${lt_cv_deplibs_check_method+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3716,8 +3144,8 @@
 esac
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
-echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -3735,11 +3163,11 @@
 compiler=$CC
 
 
-# Check whether --enable-libtool-lock was given.
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then
-  enableval=$enable_libtool_lock;
-fi
+  enableval="$enable_libtool_lock"
 
+fi;
 test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
 
 # Some flags need to be propagated to the compiler or linker for good
@@ -3766,7 +3194,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 3769 "configure"' > conftest.$ac_ext
+  echo '#line 3197 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -3851,8 +3279,8 @@
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
-  { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
-echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
 if test "${lt_cv_cc_needs_belf+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3878,32 +3306,35 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   lt_cv_cc_needs_belf=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	lt_cv_cc_needs_belf=no
+lt_cv_cc_needs_belf=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
      ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -3912,8 +3343,8 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
-echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
     CFLAGS="$SAVE_CFLAGS"
@@ -3943,8 +3374,8 @@
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
 set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_DLLTOOL+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3957,34 +3388,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 DLLTOOL=$ac_cv_prog_DLLTOOL
 if test -n "$DLLTOOL"; then
-  { echo "$as_me:$LINENO: result: $DLLTOOL" >&5
-echo "${ECHO_T}$DLLTOOL" >&6; }
+  echo "$as_me:$LINENO: result: $DLLTOOL" >&5
+echo "${ECHO_T}$DLLTOOL" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
 fi
 if test -z "$ac_cv_prog_DLLTOOL"; then
   ac_ct_DLLTOOL=$DLLTOOL
   # Extract the first word of "dlltool", so it can be a program name with args.
 set dummy dlltool; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3997,41 +3426,27 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DLLTOOL="dlltool"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
+  test -z "$ac_cv_prog_ac_ct_DLLTOOL" && ac_cv_prog_ac_ct_DLLTOOL="false"
 fi
 fi
 ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
 if test -n "$ac_ct_DLLTOOL"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
-echo "${ECHO_T}$ac_ct_DLLTOOL" >&6; }
+  echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
+echo "${ECHO_T}$ac_ct_DLLTOOL" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-  if test "x$ac_ct_DLLTOOL" = x; then
-    DLLTOOL="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    DLLTOOL=$ac_ct_DLLTOOL
-  fi
+  DLLTOOL=$ac_ct_DLLTOOL
 else
   DLLTOOL="$ac_cv_prog_DLLTOOL"
 fi
@@ -4039,8 +3454,8 @@
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
 set dummy ${ac_tool_prefix}as; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_AS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4053,34 +3468,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AS="${ac_tool_prefix}as"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 AS=$ac_cv_prog_AS
 if test -n "$AS"; then
-  { echo "$as_me:$LINENO: result: $AS" >&5
-echo "${ECHO_T}$AS" >&6; }
+  echo "$as_me:$LINENO: result: $AS" >&5
+echo "${ECHO_T}$AS" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
 fi
 if test -z "$ac_cv_prog_AS"; then
   ac_ct_AS=$AS
   # Extract the first word of "as", so it can be a program name with args.
 set dummy as; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_AS+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4093,41 +3506,27 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_AS="as"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
+  test -z "$ac_cv_prog_ac_ct_AS" && ac_cv_prog_ac_ct_AS="false"
 fi
 fi
 ac_ct_AS=$ac_cv_prog_ac_ct_AS
 if test -n "$ac_ct_AS"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
-echo "${ECHO_T}$ac_ct_AS" >&6; }
+  echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
+echo "${ECHO_T}$ac_ct_AS" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-  if test "x$ac_ct_AS" = x; then
-    AS="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    AS=$ac_ct_AS
-  fi
+  AS=$ac_ct_AS
 else
   AS="$ac_cv_prog_AS"
 fi
@@ -4135,8 +3534,8 @@
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
 set dummy ${ac_tool_prefix}objdump; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_OBJDUMP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4149,34 +3548,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 OBJDUMP=$ac_cv_prog_OBJDUMP
 if test -n "$OBJDUMP"; then
-  { echo "$as_me:$LINENO: result: $OBJDUMP" >&5
-echo "${ECHO_T}$OBJDUMP" >&6; }
+  echo "$as_me:$LINENO: result: $OBJDUMP" >&5
+echo "${ECHO_T}$OBJDUMP" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
 fi
 if test -z "$ac_cv_prog_OBJDUMP"; then
   ac_ct_OBJDUMP=$OBJDUMP
   # Extract the first word of "objdump", so it can be a program name with args.
 set dummy objdump; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4189,41 +3586,27 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
+  test -z "$ac_cv_prog_ac_ct_OBJDUMP" && ac_cv_prog_ac_ct_OBJDUMP="false"
 fi
 fi
 ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
 if test -n "$ac_ct_OBJDUMP"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
-echo "${ECHO_T}$ac_ct_OBJDUMP" >&6; }
+  echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
+echo "${ECHO_T}$ac_ct_OBJDUMP" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-  if test "x$ac_ct_OBJDUMP" = x; then
-    OBJDUMP="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    OBJDUMP=$ac_ct_OBJDUMP
-  fi
+  OBJDUMP=$ac_ct_OBJDUMP
 else
   OBJDUMP="$ac_cv_prog_OBJDUMP"
 fi
@@ -4240,8 +3623,8 @@
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -4275,22 +3658,24 @@
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -4299,10 +3684,9 @@
   # Broken: fails on valid input.
 continue
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
+  # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -4312,22 +3696,24 @@
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   # Broken: success on invalid input.
 continue
 else
@@ -4338,7 +3724,6 @@
 ac_preproc_ok=:
 break
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -4356,8 +3741,8 @@
 else
   ac_cv_prog_CPP=$CPP
 fi
-{ echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6; }
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
 do
@@ -4380,22 +3765,24 @@
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -4404,10 +3791,9 @@
   # Broken: fails on valid input.
 continue
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
+  # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -4417,22 +3803,24 @@
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   # Broken: success on invalid input.
 continue
 else
@@ -4443,7 +3831,6 @@
 ac_preproc_ok=:
 break
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -4466,8 +3853,8 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
 if test "${ac_cv_header_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4491,31 +3878,35 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_header_stdc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_header_stdc=no
+ac_cv_header_stdc=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
@@ -4571,7 +3962,6 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <ctype.h>
-#include <stdlib.h>
 #if ((' ' & 0x0FF) == 0x020)
 # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
@@ -4591,27 +3981,18 @@
   for (i = 0; i < 256; i++)
     if (XOR (islower (i), ISLOWER (i))
 	|| toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
+      exit(2);
+  exit (0);
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -4624,14 +4005,12 @@
 ( exit $ac_status )
 ac_cv_header_stdc=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
-
 fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
 if test $ac_cv_header_stdc = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -4654,9 +4033,9 @@
 		  inttypes.h stdint.h unistd.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -4670,35 +4049,38 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	eval "$as_ac_Header=no"
+eval "$as_ac_Header=no"
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -4713,19 +4095,18 @@
 for ac_header in dlfcn.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -4736,37 +4117,41 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
+ac_header_compiler=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -4775,22 +4160,24 @@
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -4798,10 +4185,9 @@
 
   ac_header_preproc=no
 fi
-
 rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -4825,19 +4211,25 @@
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -4849,22 +4241,18 @@
 
 done
 
-ac_ext=cpp
+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'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-if test -z "$CXX"; then
-  if test -n "$CCC"; then
-    CXX=$CCC
-  else
-    if test -n "$ac_tool_prefix"; then
-  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4877,38 +4265,36 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 CXX=$ac_cv_prog_CXX
 if test -n "$CXX"; then
-  { echo "$as_me:$LINENO: result: $CXX" >&5
-echo "${ECHO_T}$CXX" >&6; }
+  echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
     test -n "$CXX" && break
   done
 fi
 if test -z "$CXX"; then
   ac_ct_CXX=$CXX
-  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4921,85 +4307,55 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CXX="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
 if test -n "$ac_ct_CXX"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
-echo "${ECHO_T}$ac_ct_CXX" >&6; }
+  echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
   test -n "$ac_ct_CXX" && break
 done
+test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
 
-  if test "x$ac_ct_CXX" = x; then
-    CXX="g++"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CXX=$ac_ct_CXX
-  fi
+  CXX=$ac_ct_CXX
 fi
 
-  fi
-fi
+
 # Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+echo "$as_me:$LINENO:" \
+     "checking for C++ compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
 
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5022,49 +4378,50 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_compiler_gnu=no
+ac_compiler_gnu=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
 GXX=`test $ac_compiler_gnu = yes && echo yes`
 ac_test_CXXFLAGS=${CXXFLAGS+set}
 ac_save_CXXFLAGS=$CXXFLAGS
-{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
-echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
+CXXFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
 if test "${ac_cv_prog_cxx_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
-   ac_cxx_werror_flag=yes
-   ac_cv_prog_cxx_g=no
-   CXXFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5080,134 +4437,160 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_prog_cxx_g=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	CXXFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
+ac_cv_prog_cxx_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-
+$ac_declaration
+#include <stdlib.h>
 int
 main ()
 {
-
+exit (42);
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   :
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-	 CXXFLAGS="-g"
-	 cat >conftest.$ac_ext <<_ACEOF
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-
+$ac_declaration
 int
 main ()
 {
-
+exit (42);
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cxx_g=yes
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
-if test "$ac_test_CXXFLAGS" = set; then
-  CXXFLAGS=$ac_save_CXXFLAGS
-elif test $ac_cv_prog_cxx_g = yes; then
-  if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
-  else
-    CXXFLAGS="-g"
-  fi
-else
-  if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
-  else
-    CXXFLAGS=
-  fi
-fi
-ac_ext=cpp
+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'
@@ -5218,13 +4601,13 @@
 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=cpp
+  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'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
-echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6
 if test -z "$CXXCPP"; then
   if test "${ac_cv_prog_CXXCPP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5254,22 +4637,24 @@
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -5278,10 +4663,9 @@
   # Broken: fails on valid input.
 continue
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
+  # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -5291,22 +4675,24 @@
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   # Broken: success on invalid input.
 continue
 else
@@ -5317,7 +4703,6 @@
 ac_preproc_ok=:
 break
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -5335,8 +4720,8 @@
 else
   ac_cv_prog_CXXCPP=$CXXCPP
 fi
-{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
-echo "${ECHO_T}$CXXCPP" >&6; }
+echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6
 ac_preproc_ok=false
 for ac_cxx_preproc_warn_flag in '' yes
 do
@@ -5359,22 +4744,24 @@
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -5383,10 +4770,9 @@
   # Broken: fails on valid input.
 continue
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
+  # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -5396,22 +4782,24 @@
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_cxx_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   # Broken: success on invalid input.
 continue
 else
@@ -5422,7 +4810,6 @@
 ac_preproc_ok=:
 break
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -5438,7 +4825,7 @@
    { (exit 1); exit 1; }; }
 fi
 
-ac_ext=cpp
+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'
@@ -5452,12 +4839,12 @@
 ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_f77_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_F77+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5470,38 +4857,36 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 F77=$ac_cv_prog_F77
 if test -n "$F77"; then
-  { echo "$as_me:$LINENO: result: $F77" >&5
-echo "${ECHO_T}$F77" >&6; }
+  echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
     test -n "$F77" && break
   done
 fi
 if test -z "$F77"; then
   ac_ct_F77=$F77
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5514,78 +4899,48 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_F77="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_F77=$ac_cv_prog_ac_ct_F77
 if test -n "$ac_ct_F77"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
-echo "${ECHO_T}$ac_ct_F77" >&6; }
+  echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+echo "${ECHO_T}$ac_ct_F77" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
   test -n "$ac_ct_F77" && break
 done
 
-  if test "x$ac_ct_F77" = x; then
-    F77=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    F77=$ac_ct_F77
-  fi
+  F77=$ac_ct_F77
 fi
 
 
 # Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
+echo "$as_me:4929:" \
+     "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
@@ -5595,8 +4950,8 @@
 # input file.  (Note that this only needs to work for GNU compilers.)
 ac_save_ext=$ac_ext
 ac_ext=F
-{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6
 if test "${ac_cv_f77_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5609,42 +4964,46 @@
       end
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_f77_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_compiler_gnu=no
+ac_compiler_gnu=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_f77_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6
 ac_ext=$ac_save_ext
 ac_test_FFLAGS=${FFLAGS+set}
 ac_save_FFLAGS=$FFLAGS
 FFLAGS=
-{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
-echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6
 if test "${ac_cv_prog_f77_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5655,35 +5014,39 @@
       end
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_f77_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_prog_f77_g=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_prog_f77_g=no
+ac_cv_prog_f77_g=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
-echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6
 if test "$ac_test_FFLAGS" = set; then
   FFLAGS=$ac_save_FFLAGS
 elif test $ac_cv_prog_f77_g = yes; then
@@ -5712,8 +5075,8 @@
 # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
 
 # find the maximum length of command line arguments
-{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
-echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6
 if test "${lt_cv_sys_max_cmd_len+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5821,19 +5184,19 @@
 fi
 
 if test -n $lt_cv_sys_max_cmd_len ; then
-  { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
-echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+  echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6
 else
-  { echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6; }
+  echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
 fi
 
 
 
 
 # Check for command to grab the raw symbol name followed by C symbol from nm.
-{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
-echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6
 if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6037,15 +5400,15 @@
   lt_cv_sys_global_symbol_to_cdecl=
 fi
 if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  { echo "$as_me:$LINENO: result: failed" >&5
-echo "${ECHO_T}failed" >&6; }
+  echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6
 else
-  { echo "$as_me:$LINENO: result: ok" >&5
-echo "${ECHO_T}ok" >&6; }
+  echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6
 fi
 
-{ echo "$as_me:$LINENO: checking for objdir" >&5
-echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6
 if test "${lt_cv_objdir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6059,8 +5422,8 @@
 fi
 rmdir .libs 2>/dev/null
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
-echo "${ECHO_T}$lt_cv_objdir" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6
 objdir=$lt_cv_objdir
 
 
@@ -6111,8 +5474,8 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6125,34 +5488,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AR="${ac_tool_prefix}ar"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 AR=$ac_cv_prog_AR
 if test -n "$AR"; then
-  { echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6; }
+  echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
 fi
 if test -z "$ac_cv_prog_AR"; then
   ac_ct_AR=$AR
   # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6165,41 +5526,27 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_AR="ar"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
+  test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false"
 fi
 fi
 ac_ct_AR=$ac_cv_prog_ac_ct_AR
 if test -n "$ac_ct_AR"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6; }
+  echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-  if test "x$ac_ct_AR" = x; then
-    AR="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    AR=$ac_ct_AR
-  fi
+  AR=$ac_ct_AR
 else
   AR="$ac_cv_prog_AR"
 fi
@@ -6207,8 +5554,8 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_RANLIB+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6221,34 +5568,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 RANLIB=$ac_cv_prog_RANLIB
 if test -n "$RANLIB"; then
-  { echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6; }
+  echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
 fi
 if test -z "$ac_cv_prog_RANLIB"; then
   ac_ct_RANLIB=$RANLIB
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6261,41 +5606,27 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
+  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
 fi
 fi
 ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
 if test -n "$ac_ct_RANLIB"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-  if test "x$ac_ct_RANLIB" = x; then
-    RANLIB=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    RANLIB=$ac_ct_RANLIB
-  fi
+  RANLIB=$ac_ct_RANLIB
 else
   RANLIB="$ac_cv_prog_RANLIB"
 fi
@@ -6303,8 +5634,8 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_STRIP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6317,34 +5648,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
 fi
 fi
 STRIP=$ac_cv_prog_STRIP
 if test -n "$STRIP"; then
-  { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
 fi
 if test -z "$ac_cv_prog_STRIP"; then
   ac_ct_STRIP=$STRIP
   # Extract the first word of "strip", so it can be a program name with args.
 set dummy strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6357,41 +5686,27 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
 fi
 fi
 ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
 if test -n "$ac_ct_STRIP"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    STRIP=$ac_ct_STRIP
-  fi
+  STRIP=$ac_ct_STRIP
 else
   STRIP="$ac_cv_prog_STRIP"
 fi
@@ -6450,8 +5765,8 @@
 case $deplibs_check_method in
 file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
-echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+    echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6503,17 +5818,17 @@
 
 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
 if test -n "$MAGIC_CMD"; then
-  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
+  echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
 if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
-    { echo "$as_me:$LINENO: checking for file" >&5
-echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+    echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6
 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6565,11 +5880,11 @@
 
 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
 if test -n "$MAGIC_CMD"; then
-  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
+  echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
   else
@@ -6584,22 +5899,83 @@
 enable_dlopen=no
 enable_win32_dll=yes
 
-# Check whether --enable-libtool-lock was given.
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then
-  enableval=$enable_libtool_lock;
-fi
+  enableval="$enable_libtool_lock"
 
+fi;
 test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
 
 
-# Check whether --with-pic was given.
+# Check whether --with-pic or --without-pic was given.
 if test "${with_pic+set}" = set; then
-  withval=$with_pic; pic_mode="$withval"
+  withval="$with_pic"
+  pic_mode="$withval"
 else
   pic_mode=default
+fi;
+test -z "$pic_mode" && pic_mode=default
+
+# Check if we have a version mismatch between libtool.m4 and ltmain.sh.
+#
+# Note:  This should be in AC_LIBTOOL_SETUP, _after_ $ltmain have been defined.
+#        We also should do it _before_ AC_LIBTOOL_LANG_C_CONFIG that actually
+#        calls AC_LIBTOOL_CONFIG and creates libtool.
+#
+echo "$as_me:$LINENO: checking for correct ltmain.sh version" >&5
+echo $ECHO_N "checking for correct ltmain.sh version... $ECHO_C" >&6
+if test "x$ltmain" = "x" ; then
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  { { echo "$as_me:$LINENO: error:
+
+*** [Gentoo] sanity check failed! ***
+*** \$ltmain is not defined, please check the patch for consistency! ***
+" >&5
+echo "$as_me: error:
+
+*** [Gentoo] sanity check failed! ***
+*** \$ltmain is not defined, please check the patch for consistency! ***
+" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+gentoo_lt_version="1.5.22"
+gentoo_ltmain_version=`sed -n '/^[ 	]*VERSION=/{s/^[ 	]*VERSION=//;p;q;}' "$ltmain"`
+if test "x$gentoo_lt_version" != "x$gentoo_ltmain_version" ; then
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  { { echo "$as_me:$LINENO: error:
+
+*** [Gentoo] sanity check failed! ***
+*** libtool.m4 and ltmain.sh have a version mismatch! ***
+*** (libtool.m4 = $gentoo_lt_version, ltmain.sh = $gentoo_ltmain_version) ***
+
+Please run:
+
+  libtoolize --copy --force
+
+if appropriate, please contact the maintainer of this
+package (or your distribution) for help.
+" >&5
+echo "$as_me: error:
+
+*** [Gentoo] sanity check failed! ***
+*** libtool.m4 and ltmain.sh have a version mismatch! ***
+*** (libtool.m4 = $gentoo_lt_version, ltmain.sh = $gentoo_ltmain_version) ***
+
+Please run:
+
+  libtoolize --copy --force
+
+if appropriate, please contact the maintainer of this
+package (or your distribution) for help.
+" >&2;}
+   { (exit 1); exit 1; }; }
+else
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
 fi
 
-test -z "$pic_mode" && pic_mode=default
 
 # Use C for the default configuration in the libtool script
 tagname=
@@ -6656,8 +6032,8 @@
   lt_prog_compiler_no_builtin_flag=' -fno-builtin'
 
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6674,11 +6050,11 @@
    -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:6677: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6053: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6681: \$? = $ac_status" >&5
+   echo "$as_me:6057: \$? = $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 other than the usual output.
@@ -6691,8 +6067,8 @@
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
 
 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
     lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
@@ -6706,8 +6082,8 @@
 lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl='-Wl,'
@@ -6916,16 +6292,16 @@
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6
 
 #
 # Check to make sure the PIC flag actually works.
 #
 if test -n "$lt_prog_compiler_pic"; then
 
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6
 if test "${lt_prog_compiler_pic_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6942,11 +6318,11 @@
    -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:6945: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6321: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6949: \$? = $ac_status" >&5
+   echo "$as_me:6325: \$? = $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 other than the usual output.
@@ -6959,8 +6335,8 @@
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6
 
 if test x"$lt_prog_compiler_pic_works" = xyes; then
     case $lt_prog_compiler_pic in
@@ -6987,8 +6363,8 @@
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
 if test "${lt_prog_compiler_static_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -7015,8 +6391,8 @@
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6
 
 if test x"$lt_prog_compiler_static_works" = xyes; then
     :
@@ -7025,8 +6401,8 @@
 fi
 
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
 if test "${lt_cv_prog_compiler_c_o+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -7046,11 +6422,11 @@
    -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:7049: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6425: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7053: \$? = $ac_status" >&5
+   echo "$as_me:6429: \$? = $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
@@ -7072,23 +6448,23 @@
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
 
 
 hard_links="nottested"
 if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
   hard_links=yes
   $rm conftest*
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   touch conftest.a
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
   if test "$hard_links" = no; then
     { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
@@ -7098,8 +6474,8 @@
   need_locks=no
 fi
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
 
   runpath_var=
   allow_undefined_flag=
@@ -7514,23 +6890,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -7541,10 +6921,8 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -7573,23 +6951,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -7600,10 +6982,8 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -8052,8 +7432,8 @@
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
-echo "${ECHO_T}$ld_shlibs" >&6; }
+echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6
 test "$ld_shlibs" = no && can_build_shared=no
 
 #
@@ -8073,8 +7453,8 @@
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
       $rm conftest*
       printf "$lt_simple_compile_test_code" > conftest.$ac_ext
 
@@ -8111,16 +7491,16 @@
         cat conftest.err 1>&5
       fi
       $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
-echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6
       ;;
     esac
   fi
   ;;
 esac
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -8285,6 +7665,30 @@
     esac
     ;;
 
+  linux*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      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="$archive_cmds"
+      fi
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
   *)
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
     ;;
@@ -8349,7 +7753,14 @@
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -8360,6 +7771,12 @@
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -8707,8 +8124,8 @@
   dynamic_linker=no
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
 test "$dynamic_linker" = no && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -8716,8 +8133,8 @@
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+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" || \
@@ -8741,8 +8158,8 @@
   # directories.
   hardcode_action=unsupported
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
-echo "${ECHO_T}$hardcode_action" >&6; }
+echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6
 
 if test "$hardcode_action" = relink; then
   # Fast installation is not supported
@@ -8755,29 +8172,29 @@
 
 striplib=
 old_striplib=
-{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
 else
 # FIXME - insert some real tests, host_os isn't really good enough
   case $host_os in
    darwin*)
        if test -n "$STRIP" ; then
          striplib="$STRIP -x"
-         { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+         echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
        else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
        ;;
    *)
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
     ;;
   esac
 fi
@@ -8809,8 +8226,8 @@
 
   darwin*)
   # if libdl is installed we need to link against it
-    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+    echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
 if test "${ac_cv_lib_dl_dlopen+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -8823,53 +8240,56 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char dlopen ();
 int
 main ()
 {
-return dlopen ();
+dlopen ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_dl_dlopen=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_dl_dlopen=no
+ac_cv_lib_dl_dlopen=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
 if test $ac_cv_lib_dl_dlopen = yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
@@ -8883,8 +8303,8 @@
    ;;
 
   *)
-    { echo "$as_me:$LINENO: checking for shl_load" >&5
-echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+    echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
 if test "${ac_cv_func_shl_load+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -8911,64 +8331,73 @@
 
 #undef shl_load
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
+{
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char shl_load ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined __stub_shl_load || defined __stub___shl_load
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
 choke me
+#else
+char (*f) () = shl_load;
+#endif
+#ifdef __cplusplus
+}
 #endif
 
 int
 main ()
 {
-return shl_load ();
+return f != shl_load;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_func_shl_load=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_func_shl_load=no
+ac_cv_func_shl_load=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6
 if test $ac_cv_func_shl_load = yes; then
   lt_cv_dlopen="shl_load"
 else
-  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
 if test "${ac_cv_lib_dld_shl_load+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -8981,58 +8410,61 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char shl_load ();
 int
 main ()
 {
-return shl_load ();
+shl_load ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_dld_shl_load=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_dld_shl_load=no
+ac_cv_lib_dld_shl_load=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
 if test $ac_cv_lib_dld_shl_load = yes; then
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
 else
-  { echo "$as_me:$LINENO: checking for dlopen" >&5
-echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
 if test "${ac_cv_func_dlopen+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9059,64 +8491,73 @@
 
 #undef dlopen
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
+{
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char dlopen ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined __stub_dlopen || defined __stub___dlopen
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
 choke me
+#else
+char (*f) () = dlopen;
+#endif
+#ifdef __cplusplus
+}
 #endif
 
 int
 main ()
 {
-return dlopen ();
+return f != dlopen;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_func_dlopen=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_func_dlopen=no
+ac_cv_func_dlopen=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
 if test $ac_cv_func_dlopen = yes; then
   lt_cv_dlopen="dlopen"
 else
-  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
 if test "${ac_cv_lib_dl_dlopen+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9129,58 +8570,61 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char dlopen ();
 int
 main ()
 {
-return dlopen ();
+dlopen ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_dl_dlopen=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_dl_dlopen=no
+ac_cv_lib_dl_dlopen=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
 if test $ac_cv_lib_dl_dlopen = yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
-  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
 if test "${ac_cv_lib_svld_dlopen+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9193,58 +8637,61 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char dlopen ();
 int
 main ()
 {
-return dlopen ();
+dlopen ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_svld_dlopen=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_svld_dlopen=no
+ac_cv_lib_svld_dlopen=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
 if test $ac_cv_lib_svld_dlopen = yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
 else
-  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
 if test "${ac_cv_lib_dld_dld_link+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9257,53 +8704,56 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char dld_link ();
 int
 main ()
 {
-return dld_link ();
+dld_link ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_dld_dld_link=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_dld_dld_link=no
+ac_cv_lib_dld_dld_link=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
 if test $ac_cv_lib_dld_dld_link = yes; then
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
 fi
@@ -9343,8 +8793,8 @@
     save_LIBS="$LIBS"
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
-    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
-echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+    echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
 if test "${lt_cv_dlopen_self+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9354,7 +8804,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9357 "configure"
+#line 8807 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9438,13 +8888,13 @@
 
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6
 
     if test "x$lt_cv_dlopen_self" = xyes; then
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
-      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
-echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+      echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
 if test "${lt_cv_dlopen_self_static+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9454,7 +8904,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9457 "configure"
+#line 8907 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9538,8 +8988,8 @@
 
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
     fi
 
     CPPFLAGS="$save_CPPFLAGS"
@@ -9561,13 +9011,13 @@
 
 
 # Report which library types will actually be built
-{ 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
-echo "${ECHO_T}$can_build_shared" >&6; }
+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
+echo "${ECHO_T}$can_build_shared" >&6
 
-{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
 test "$can_build_shared" = "no" && enable_shared=no
 
 # On AIX, shared libraries and static libraries use the same namespace, and
@@ -9587,15 +9037,15 @@
   fi
     ;;
 esac
-{ echo "$as_me:$LINENO: result: $enable_shared" >&5
-echo "${ECHO_T}$enable_shared" >&6; }
+echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6
 
-{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
 # Make sure either enable_shared or enable_static is yes.
 test "$enable_shared" = yes || enable_static=yes
-{ echo "$as_me:$LINENO: result: $enable_static" >&5
-echo "${ECHO_T}$enable_static" >&6; }
+echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6
 
 # The else clause should only fire when bootstrapping the
 # libtool distribution, otherwise you forgot to ship ltmain.sh
@@ -10087,11 +9537,11 @@
 CC="$lt_save_CC"
 
 
-# Check whether --with-tags was given.
+# Check whether --with-tags or --without-tags was given.
 if test "${with_tags+set}" = set; then
-  withval=$with_tags; tagnames="$withval"
-fi
-
+  withval="$with_tags"
+  tagnames="$withval"
+fi;
 
 if test -f "$ltmain" && test -n "$tagnames"; then
   if test ! -f "${ofile}"; then
@@ -10145,7 +9595,7 @@
 	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=cpp
+	  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'
@@ -10264,18 +9714,18 @@
   # Set up default GNU C++ configuration
 
 
-# Check whether --with-gnu-ld was given.
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
 if test "${with_gnu_ld+set}" = set; then
-  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
 else
   with_gnu_ld=no
-fi
-
+fi;
 ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
-  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -10304,11 +9754,11 @@
     ;;
   esac
 elif test "$with_gnu_ld" = yes; then
-  { echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
 else
-  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
 fi
 if test "${lt_cv_path_LD+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -10341,17 +9791,17 @@
 
 LD="$lt_cv_path_LD"
 if test -n "$LD"; then
-  { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
+  echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
 echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
    { (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
 if test "${lt_cv_prog_gnu_ld+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -10365,8 +9815,8 @@
   ;;
 esac
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
 with_gnu_ld=$lt_cv_prog_gnu_ld
 
 
@@ -10416,8 +9866,8 @@
 fi
 
 # PORTME: fill in a description of your system's C++ link characteristics
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
 ld_shlibs_CXX=yes
 case $host_os in
   aix3*)
@@ -10529,23 +9979,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -10556,10 +10010,8 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -10589,23 +10041,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -10616,10 +10072,8 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -11350,8 +10804,8 @@
     ld_shlibs_CXX=no
     ;;
 esac
-{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
-echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6
 test "$ld_shlibs_CXX" = no && can_build_shared=no
 
 GCC_CXX="$GXX"
@@ -11490,8 +10944,8 @@
 lt_prog_compiler_pic_CXX=
 lt_prog_compiler_static_CXX=
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
 
   # C++ specific cases for pic, static, wl, etc.
   if test "$GXX" = yes; then
@@ -11764,16 +11218,16 @@
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6
 
 #
 # Check to make sure the PIC flag actually works.
 #
 if test -n "$lt_prog_compiler_pic_CXX"; then
 
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6
 if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -11790,11 +11244,11 @@
    -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:11793: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11247: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11797: \$? = $ac_status" >&5
+   echo "$as_me:11251: \$? = $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 other than the usual output.
@@ -11807,8 +11261,8 @@
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6
 
 if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
     case $lt_prog_compiler_pic_CXX in
@@ -11835,8 +11289,8 @@
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
 if test "${lt_prog_compiler_static_works_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -11863,8 +11317,8 @@
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6
 
 if test x"$lt_prog_compiler_static_works_CXX" = xyes; then
     :
@@ -11873,8 +11327,8 @@
 fi
 
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
 if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -11894,11 +11348,11 @@
    -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:11897: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11351: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:11901: \$? = $ac_status" >&5
+   echo "$as_me:11355: \$? = $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
@@ -11920,23 +11374,23 @@
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6
 
 
 hard_links="nottested"
 if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
   hard_links=yes
   $rm conftest*
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   touch conftest.a
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
   if test "$hard_links" = no; then
     { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
@@ -11946,8 +11400,8 @@
   need_locks=no
 fi
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
 
   export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   case $host_os in
@@ -11971,8 +11425,8 @@
   ;;
   esac
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
-echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6
 test "$ld_shlibs_CXX" = no && can_build_shared=no
 
 #
@@ -11992,8 +11446,8 @@
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
       $rm conftest*
       printf "$lt_simple_compile_test_code" > conftest.$ac_ext
 
@@ -12030,16 +11484,16 @@
         cat conftest.err 1>&5
       fi
       $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; }
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6
       ;;
     esac
   fi
   ;;
 esac
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -12204,6 +11658,30 @@
     esac
     ;;
 
+  linux*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      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="$archive_cmds"
+      fi
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
   *)
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
     ;;
@@ -12268,7 +11746,14 @@
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -12279,6 +11764,12 @@
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -12626,8 +12117,8 @@
   dynamic_linker=no
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
 test "$dynamic_linker" = no && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -12635,8 +12126,8 @@
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+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" || \
@@ -12660,8 +12151,8 @@
   # directories.
   hardcode_action_CXX=unsupported
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
-echo "${ECHO_T}$hardcode_action_CXX" >&6; }
+echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6
 
 if test "$hardcode_action_CXX" = relink; then
   # Fast installation is not supported
@@ -13186,13 +12677,13 @@
 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
-echo "${ECHO_T}$can_build_shared" >&6; }
+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
+echo "${ECHO_T}$can_build_shared" >&6
 
-{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
 test "$can_build_shared" = "no" && enable_shared=no
 
 # On AIX, shared libraries and static libraries use the same namespace, and
@@ -13211,15 +12702,15 @@
   fi
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $enable_shared" >&5
-echo "${ECHO_T}$enable_shared" >&6; }
+echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6
 
-{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
 # Make sure either enable_shared or enable_static is yes.
 test "$enable_shared" = yes || enable_static=yes
-{ echo "$as_me:$LINENO: result: $enable_static" >&5
-echo "${ECHO_T}$enable_static" >&6; }
+echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6
 
 GCC_F77="$G77"
 LD_F77="$LD"
@@ -13228,8 +12719,8 @@
 lt_prog_compiler_pic_F77=
 lt_prog_compiler_static_F77=
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl_F77='-Wl,'
@@ -13438,16 +12929,16 @@
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6
 
 #
 # Check to make sure the PIC flag actually works.
 #
 if test -n "$lt_prog_compiler_pic_F77"; then
 
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6
 if test "${lt_prog_compiler_pic_works_F77+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -13464,11 +12955,11 @@
    -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:13467: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12958: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13471: \$? = $ac_status" >&5
+   echo "$as_me:12962: \$? = $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 other than the usual output.
@@ -13481,8 +12972,8 @@
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6
 
 if test x"$lt_prog_compiler_pic_works_F77" = xyes; then
     case $lt_prog_compiler_pic_F77 in
@@ -13509,8 +13000,8 @@
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
 if test "${lt_prog_compiler_static_works_F77+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -13537,8 +13028,8 @@
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6
 
 if test x"$lt_prog_compiler_static_works_F77" = xyes; then
     :
@@ -13547,8 +13038,8 @@
 fi
 
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
 if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -13568,11 +13059,11 @@
    -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:13571: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13062: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13575: \$? = $ac_status" >&5
+   echo "$as_me:13066: \$? = $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
@@ -13594,23 +13085,23 @@
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6
 
 
 hard_links="nottested"
 if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
   hard_links=yes
   $rm conftest*
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   touch conftest.a
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
   if test "$hard_links" = no; then
     { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
@@ -13620,8 +13111,8 @@
   need_locks=no
 fi
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
 
   runpath_var=
   allow_undefined_flag_F77=
@@ -14026,23 +13517,27 @@
       end
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_f77_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -14053,10 +13548,8 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -14075,23 +13568,27 @@
       end
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_f77_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -14102,10 +13599,8 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -14554,8 +14049,8 @@
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
-echo "${ECHO_T}$ld_shlibs_F77" >&6; }
+echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+echo "${ECHO_T}$ld_shlibs_F77" >&6
 test "$ld_shlibs_F77" = no && can_build_shared=no
 
 #
@@ -14575,8 +14070,8 @@
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
       $rm conftest*
       printf "$lt_simple_compile_test_code" > conftest.$ac_ext
 
@@ -14613,16 +14108,16 @@
         cat conftest.err 1>&5
       fi
       $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; }
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6
       ;;
     esac
   fi
   ;;
 esac
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -14787,6 +14282,30 @@
     esac
     ;;
 
+  linux*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      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="$archive_cmds"
+      fi
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
   *)
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
     ;;
@@ -14851,7 +14370,14 @@
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -14862,6 +14388,12 @@
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -15209,8 +14741,8 @@
   dynamic_linker=no
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
 test "$dynamic_linker" = no && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -15218,8 +14750,8 @@
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+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" || \
@@ -15243,8 +14775,8 @@
   # directories.
   hardcode_action_F77=unsupported
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
-echo "${ECHO_T}$hardcode_action_F77" >&6; }
+echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+echo "${ECHO_T}$hardcode_action_F77" >&6
 
 if test "$hardcode_action_F77" = relink; then
   # Fast installation is not supported
@@ -15681,6 +15213,7 @@
 	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
 
 
+
 # Source file extension for Java test sources.
 ac_ext=java
 
@@ -15748,8 +15281,8 @@
   lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
 
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -15766,11 +15299,11 @@
    -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:15769: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15302: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:15773: \$? = $ac_status" >&5
+   echo "$as_me:15306: \$? = $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 other than the usual output.
@@ -15783,8 +15316,8 @@
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
 
 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
     lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
@@ -15798,8 +15331,8 @@
 lt_prog_compiler_pic_GCJ=
 lt_prog_compiler_static_GCJ=
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl_GCJ='-Wl,'
@@ -16008,16 +15541,16 @@
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6
 
 #
 # Check to make sure the PIC flag actually works.
 #
 if test -n "$lt_prog_compiler_pic_GCJ"; then
 
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6
 if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -16034,11 +15567,11 @@
    -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:16037: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15570: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16041: \$? = $ac_status" >&5
+   echo "$as_me:15574: \$? = $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 other than the usual output.
@@ -16051,8 +15584,8 @@
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6
 
 if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
     case $lt_prog_compiler_pic_GCJ in
@@ -16079,8 +15612,8 @@
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
 if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -16107,8 +15640,8 @@
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6
 
 if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then
     :
@@ -16117,8 +15650,8 @@
 fi
 
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
 if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -16138,11 +15671,11 @@
    -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:16141: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15674: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16145: \$? = $ac_status" >&5
+   echo "$as_me:15678: \$? = $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
@@ -16164,23 +15697,23 @@
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6
 
 
 hard_links="nottested"
 if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
   hard_links=yes
   $rm conftest*
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   touch conftest.a
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
+  echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
   if test "$hard_links" = no; then
     { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
 echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
@@ -16190,8 +15723,8 @@
   need_locks=no
 fi
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
 
   runpath_var=
   allow_undefined_flag_GCJ=
@@ -16606,23 +16139,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -16633,10 +16170,8 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -16665,23 +16200,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -16692,10 +16231,8 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
@@ -17144,8 +16681,8 @@
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
-echo "${ECHO_T}$ld_shlibs_GCJ" >&6; }
+echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+echo "${ECHO_T}$ld_shlibs_GCJ" >&6
 test "$ld_shlibs_GCJ" = no && can_build_shared=no
 
 #
@@ -17165,8 +16702,8 @@
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
       $rm conftest*
       printf "$lt_simple_compile_test_code" > conftest.$ac_ext
 
@@ -17203,16 +16740,16 @@
         cat conftest.err 1>&5
       fi
       $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; }
+      echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6
       ;;
     esac
   fi
   ;;
 esac
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -17377,6 +16914,30 @@
     esac
     ;;
 
+  linux*)
+    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      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="$archive_cmds"
+      fi
+    else
+      ld_shlibs=no
+    fi
+    ;;
+
   *)
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
     ;;
@@ -17441,7 +17002,14 @@
     *) objformat=elf ;;
     esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+    gentoo)
+      version_type=linux ;;
+    *)
+      version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
     freebsd-elf*)
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
@@ -17452,6 +17020,12 @@
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
       need_version=yes
       ;;
+    linux)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+      soname_spec='${libname}${release}${shared_ext}$major'
+      need_lib_prefix=no
+      need_version=no
+      ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -17799,8 +17373,8 @@
   dynamic_linker=no
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
 test "$dynamic_linker" = no && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -17808,8 +17382,8 @@
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+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" || \
@@ -17833,8 +17407,8 @@
   # directories.
   hardcode_action_GCJ=unsupported
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
-echo "${ECHO_T}$hardcode_action_GCJ" >&6; }
+echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+echo "${ECHO_T}$hardcode_action_GCJ" >&6
 
 if test "$hardcode_action_GCJ" = relink; then
   # Fast installation is not supported
@@ -18270,6 +17844,7 @@
       RC)
 
 
+
 # Source file extension for RC test sources.
 ac_ext=rc
 
@@ -18813,8 +18388,8 @@
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # OS/2's system install, which has a completely different semantic
 # ./install, which can be erroneously created by make from ./install.sh.
-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -18836,7 +18411,7 @@
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
 	  if test $ac_prog = install &&
 	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
@@ -18855,22 +18430,21 @@
     ;;
 esac
 done
-IFS=$as_save_IFS
 
 
 fi
   if test "${ac_cv_path_install+set}" = set; then
     INSTALL=$ac_cv_path_install
   else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for INSTALL within a source directory, because that will
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
     # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
+    # removed, or if the path is relative.
     INSTALL=$ac_install_sh
   fi
 fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
 # It thinks the first close brace ends the variable substitution.
@@ -18880,21 +18454,21 @@
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
 LN_S=$as_ln_s
 if test "$LN_S" = "ln -s"; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
 else
-  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6; }
+  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
 fi
 
 # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -18909,37 +18483,36 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
   test -z "$ac_cv_path_AR" && ac_cv_path_AR="no"
   ;;
 esac
 fi
 AR=$ac_cv_path_AR
+
 if test -n "$AR"; then
-  { echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6; }
+  echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
 if [ $AR = "no" ] ; then
     { { echo "$as_me:$LINENO: error: \"Could not find ar - needed to create a library\"" >&5
 echo "$as_me: error: \"Could not find ar - needed to create a library\"" >&2;}
    { (exit 1); exit 1; }; };
 fi
 
-{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
-echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
 if test "${ac_cv_c_bigendian+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -18956,8 +18529,7 @@
 int
 main ()
 {
-#if  ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
-	&& BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
  bogus endian macros
 #endif
 
@@ -18966,22 +18538,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -19004,36 +18581,40 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_c_bigendian=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_c_bigendian=no
+ac_cv_c_bigendian=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	# It does not; compile a test program.
+# It does not; compile a test program.
 if test "$cross_compiling" = yes; then
   # try to guess the endianness by grepping values into an object file
   ac_cv_c_bigendian=unknown
@@ -19043,11 +18624,11 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
-short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
 void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
-short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
-short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
 void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
 int
 main ()
@@ -19058,22 +18639,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
   ac_cv_c_bigendian=yes
 fi
@@ -19089,10 +18675,8 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -19100,41 +18684,27 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
 int
 main ()
 {
-
   /* Are we little or big endian?  From Harbison&Steele.  */
   union
   {
-    long int l;
-    char c[sizeof (long int)];
+    long l;
+    char c[sizeof (long)];
   } u;
   u.l = 1;
-  return u.c[sizeof (long int) - 1] == 1;
-
-  ;
-  return 0;
+  exit (u.c[sizeof (long) - 1] == 1);
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -19147,16 +18717,13 @@
 ( exit $ac_status )
 ac_cv_c_bigendian=yes
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
-echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6
 case $ac_cv_c_bigendian in
   yes)
 
@@ -19176,8 +18743,8 @@
 
 
 
-{ echo "$as_me:$LINENO: checking for snd_pcm_open in -lasound" >&5
-echo $ECHO_N "checking for snd_pcm_open in -lasound... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for snd_pcm_open in -lasound" >&5
+echo $ECHO_N "checking for snd_pcm_open in -lasound... $ECHO_C" >&6
 if test "${ac_cv_lib_asound_snd_pcm_open+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -19190,61 +18757,64 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char snd_pcm_open ();
 int
 main ()
 {
-return snd_pcm_open ();
+snd_pcm_open ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_asound_snd_pcm_open=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_asound_snd_pcm_open=no
+ac_cv_lib_asound_snd_pcm_open=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_open" >&5
-echo "${ECHO_T}$ac_cv_lib_asound_snd_pcm_open" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_open" >&5
+echo "${ECHO_T}$ac_cv_lib_asound_snd_pcm_open" >&6
 if test $ac_cv_lib_asound_snd_pcm_open = yes; then
   have_alsa=yes
 else
   have_alsa=no
 fi
 
-{ echo "$as_me:$LINENO: checking for HPI_SubSysCreate in -lhpi" >&5
-echo $ECHO_N "checking for HPI_SubSysCreate in -lhpi... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for HPI_SubSysCreate in -lhpi" >&5
+echo $ECHO_N "checking for HPI_SubSysCreate in -lhpi... $ECHO_C" >&6
 if test "${ac_cv_lib_hpi_HPI_SubSysCreate+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -19257,53 +18827,56 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char HPI_SubSysCreate ();
 int
 main ()
 {
-return HPI_SubSysCreate ();
+HPI_SubSysCreate ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_hpi_HPI_SubSysCreate=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_hpi_HPI_SubSysCreate=no
+ac_cv_lib_hpi_HPI_SubSysCreate=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_hpi_HPI_SubSysCreate" >&5
-echo "${ECHO_T}$ac_cv_lib_hpi_HPI_SubSysCreate" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_hpi_HPI_SubSysCreate" >&5
+echo "${ECHO_T}$ac_cv_lib_hpi_HPI_SubSysCreate" >&6
 if test $ac_cv_lib_hpi_HPI_SubSysCreate = yes; then
   have_asihpi=yes
 else
@@ -19318,8 +18891,8 @@
 	if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -19334,35 +18907,34 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
   ;;
 esac
 fi
 PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+
 if test -n "$PKG_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
-echo "${ECHO_T}$PKG_CONFIG" >&6; }
+  echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+echo "${ECHO_T}$PKG_CONFIG" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-
 fi
 if test -z "$ac_cv_path_PKG_CONFIG"; then
   ac_pt_PKG_CONFIG=$PKG_CONFIG
   # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -19377,42 +18949,28 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
-IFS=$as_save_IFS
 
   ;;
 esac
 fi
 ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+
 if test -n "$ac_pt_PKG_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
-echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; }
+  echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
+echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-  if test "x$ac_pt_PKG_CONFIG" = x; then
-    PKG_CONFIG=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    PKG_CONFIG=$ac_pt_PKG_CONFIG
-  fi
+  PKG_CONFIG=$ac_pt_PKG_CONFIG
 else
   PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
 fi
@@ -19420,22 +18978,22 @@
 fi
 if test -n "$PKG_CONFIG"; then
 	_pkg_min_version=0.9.0
-	{ echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
-echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; }
+	echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
+echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6
 	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-		{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+		echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
 	else
-		{ echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+		echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 		PKG_CONFIG=""
 	fi
 
 fi
 
 pkg_failed=no
-{ echo "$as_me:$LINENO: checking for JACK" >&5
-echo $ECHO_N "checking for JACK... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for JACK" >&5
+echo $ECHO_N "checking for JACK... $ECHO_C" >&6
 
 if test -n "$PKG_CONFIG"; then
     if test -n "$JACK_CFLAGS"; then
@@ -19491,16 +19049,14 @@
 	# Put the nasty error message in config.log where it belongs
 	echo "$JACK_PKG_ERRORS" >&5
 
-	{ echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-                have_jack=no
+	have_jack=no
 elif test $pkg_failed = untried; then
 	have_jack=no
 else
 	JACK_CFLAGS=$pkg_cv_JACK_CFLAGS
 	JACK_LIBS=$pkg_cv_JACK_LIBS
-        { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+        echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
 	have_jack=yes
 fi
 
@@ -19510,19 +19066,18 @@
 for ac_header in sys/soundcard.h linux/soundcard.h machine/soundcard.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -19533,37 +19088,41 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
+ac_header_compiler=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -19572,22 +19131,24 @@
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -19595,10 +19156,9 @@
 
   ac_header_preproc=no
 fi
-
 rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -19622,19 +19182,25 @@
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -19648,8 +19214,8 @@
 
 
 
-{ echo "$as_me:$LINENO: checking for short" >&5
-echo $ECHO_N "checking for short... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for short" >&5
+echo $ECHO_N "checking for short... $ECHO_C" >&6
 if test "${ac_cv_type_short+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -19660,57 +19226,61 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-typedef short ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
+if ((short *) 0)
   return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (short))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_short=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_short=no
+ac_cv_type_short=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5
-echo "${ECHO_T}$ac_cv_type_short" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5
+echo "${ECHO_T}$ac_cv_type_short" >&6
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of short" >&5
-echo $ECHO_N "checking size of short... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking size of short" >&5
+echo $ECHO_N "checking size of short... $ECHO_C" >&6
 if test "${ac_cv_sizeof_short+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
+  if test "$ac_cv_type_short" = yes; then
+  # The cast to unsigned long works around a bug in the HP C Compiler
+  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+  # This bug is HP SR number 8606223364.
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
 cat >conftest.$ac_ext <<_ACEOF
@@ -19720,11 +19290,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef short ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -19732,22 +19301,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_lo=0 ac_mid=0
   while :; do
     cat >conftest.$ac_ext <<_ACEOF
@@ -19757,11 +19331,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef short ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -19769,53 +19342,56 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_hi=$ac_mid; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+ac_lo=`expr $ac_mid + 1`
+		    if test $ac_lo -le $ac_mid; then
+		      ac_lo= ac_hi=
+		      break
+		    fi
+		    ac_mid=`expr 2 '*' $ac_mid + 1`
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef short ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)];
 test_array [0] = 0
 
   ;
@@ -19823,22 +19399,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_hi=-1 ac_mid=-1
   while :; do
     cat >conftest.$ac_ext <<_ACEOF
@@ -19848,11 +19429,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef short ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -19860,48 +19440,50 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_lo=$ac_mid; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+ac_hi=`expr '(' $ac_mid ')' - 1`
+		       if test $ac_mid -le $ac_hi; then
+			 ac_lo= ac_hi=
+			 break
+		       fi
+		       ac_mid=`expr 2 '*' $ac_mid`
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo= ac_hi=
+ac_lo= ac_hi=
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 # Binary search between lo and hi bounds.
 while test "x$ac_lo" != "x$ac_hi"; do
   ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
@@ -19912,11 +19494,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef short ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -19924,45 +19505,52 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_hi=$ac_mid
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
+ac_lo=`expr '(' $ac_mid ')' + 1`
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_short=$ac_lo;;
-'') if test "$ac_cv_type_short" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (short)
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (short)
+echo "$as_me: error: cannot compute sizeof (short), 77
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_short=0
-   fi ;;
+   { (exit 1); exit 1; }; } ;;
 esac
 else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -19970,9 +19558,8 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef short ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+long longval () { return (long) (sizeof (short)); }
+unsigned long ulongval () { return (long) (sizeof (short)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -19981,44 +19568,35 @@
 
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
-    return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    exit (1);
+  if (((long) (sizeof (short))) < 0)
     {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
+      long i = longval ();
+      if (i != ((long) (sizeof (short))))
+	exit (1);
       fprintf (f, "%ld\n", i);
     }
   else
     {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
+      unsigned long i = ulongval ();
+      if (i != ((long) (sizeof (short))))
+	exit (1);
       fprintf (f, "%lu\n", i);
     }
-  return ferror (f) || fclose (f) != 0;
+  exit (ferror (f) || fclose (f) != 0);
 
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -20029,32 +19607,29 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-if test "$ac_cv_type_short" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (short)
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (short)
+echo "$as_me: error: cannot compute sizeof (short), 77
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_short=0
-   fi
+   { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
+else
+  ac_cv_sizeof_short=0
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
-echo "${ECHO_T}$ac_cv_sizeof_short" >&6; }
-
-
-
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
+echo "${ECHO_T}$ac_cv_sizeof_short" >&6
 cat >>confdefs.h <<_ACEOF
 #define SIZEOF_SHORT $ac_cv_sizeof_short
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking for int" >&5
-echo $ECHO_N "checking for int... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for int" >&5
+echo $ECHO_N "checking for int... $ECHO_C" >&6
 if test "${ac_cv_type_int+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -20065,57 +19640,61 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-typedef int ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
+if ((int *) 0)
   return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (int))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_int=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_int=no
+ac_cv_type_int=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
-echo "${ECHO_T}$ac_cv_type_int" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
+echo "${ECHO_T}$ac_cv_type_int" >&6
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of int" >&5
-echo $ECHO_N "checking size of int... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking size of int" >&5
+echo $ECHO_N "checking size of int... $ECHO_C" >&6
 if test "${ac_cv_sizeof_int+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
+  if test "$ac_cv_type_int" = yes; then
+  # The cast to unsigned long works around a bug in the HP C Compiler
+  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+  # This bug is HP SR number 8606223364.
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
 cat >conftest.$ac_ext <<_ACEOF
@@ -20125,11 +19704,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -20137,22 +19715,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_lo=0 ac_mid=0
   while :; do
     cat >conftest.$ac_ext <<_ACEOF
@@ -20162,11 +19745,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -20174,53 +19756,56 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_hi=$ac_mid; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+ac_lo=`expr $ac_mid + 1`
+		    if test $ac_lo -le $ac_mid; then
+		      ac_lo= ac_hi=
+		      break
+		    fi
+		    ac_mid=`expr 2 '*' $ac_mid + 1`
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)];
 test_array [0] = 0
 
   ;
@@ -20228,22 +19813,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_hi=-1 ac_mid=-1
   while :; do
     cat >conftest.$ac_ext <<_ACEOF
@@ -20253,11 +19843,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -20265,48 +19854,50 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_lo=$ac_mid; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+ac_hi=`expr '(' $ac_mid ')' - 1`
+		       if test $ac_mid -le $ac_hi; then
+			 ac_lo= ac_hi=
+			 break
+		       fi
+		       ac_mid=`expr 2 '*' $ac_mid`
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo= ac_hi=
+ac_lo= ac_hi=
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 # Binary search between lo and hi bounds.
 while test "x$ac_lo" != "x$ac_hi"; do
   ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
@@ -20317,11 +19908,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -20329,45 +19919,52 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_hi=$ac_mid
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
+ac_lo=`expr '(' $ac_mid ')' + 1`
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_int=$ac_lo;;
-'') if test "$ac_cv_type_int" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (int)
+echo "$as_me: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_int=0
-   fi ;;
+   { (exit 1); exit 1; }; } ;;
 esac
 else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -20375,9 +19972,8 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+long longval () { return (long) (sizeof (int)); }
+unsigned long ulongval () { return (long) (sizeof (int)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -20386,44 +19982,35 @@
 
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
-    return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    exit (1);
+  if (((long) (sizeof (int))) < 0)
     {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
+      long i = longval ();
+      if (i != ((long) (sizeof (int))))
+	exit (1);
       fprintf (f, "%ld\n", i);
     }
   else
     {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
+      unsigned long i = ulongval ();
+      if (i != ((long) (sizeof (int))))
+	exit (1);
       fprintf (f, "%lu\n", i);
     }
-  return ferror (f) || fclose (f) != 0;
+  exit (ferror (f) || fclose (f) != 0);
 
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -20434,32 +20021,29 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-if test "$ac_cv_type_int" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (int)
+echo "$as_me: error: cannot compute sizeof (int), 77
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_int=0
-   fi
+   { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
+else
+  ac_cv_sizeof_int=0
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
-echo "${ECHO_T}$ac_cv_sizeof_int" >&6; }
-
-
-
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+echo "${ECHO_T}$ac_cv_sizeof_int" >&6
 cat >>confdefs.h <<_ACEOF
 #define SIZEOF_INT $ac_cv_sizeof_int
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking for long" >&5
-echo $ECHO_N "checking for long... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for long" >&5
+echo $ECHO_N "checking for long... $ECHO_C" >&6
 if test "${ac_cv_type_long+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -20470,57 +20054,61 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-typedef long ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
+if ((long *) 0)
   return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (long))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_long=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_long=no
+ac_cv_type_long=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
-echo "${ECHO_T}$ac_cv_type_long" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
+echo "${ECHO_T}$ac_cv_type_long" >&6
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of long" >&5
-echo $ECHO_N "checking size of long... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking size of long" >&5
+echo $ECHO_N "checking size of long... $ECHO_C" >&6
 if test "${ac_cv_sizeof_long+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
+  if test "$ac_cv_type_long" = yes; then
+  # The cast to unsigned long works around a bug in the HP C Compiler
+  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+  # This bug is HP SR number 8606223364.
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
 cat >conftest.$ac_ext <<_ACEOF
@@ -20530,11 +20118,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -20542,22 +20129,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_lo=0 ac_mid=0
   while :; do
     cat >conftest.$ac_ext <<_ACEOF
@@ -20567,11 +20159,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -20579,53 +20170,56 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_hi=$ac_mid; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+ac_lo=`expr $ac_mid + 1`
+		    if test $ac_lo -le $ac_mid; then
+		      ac_lo= ac_hi=
+		      break
+		    fi
+		    ac_mid=`expr 2 '*' $ac_mid + 1`
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)];
 test_array [0] = 0
 
   ;
@@ -20633,22 +20227,27 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_hi=-1 ac_mid=-1
   while :; do
     cat >conftest.$ac_ext <<_ACEOF
@@ -20658,11 +20257,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -20670,48 +20268,50 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_lo=$ac_mid; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+ac_hi=`expr '(' $ac_mid ')' - 1`
+		       if test $ac_mid -le $ac_hi; then
+			 ac_lo= ac_hi=
+			 break
+		       fi
+		       ac_mid=`expr 2 '*' $ac_mid`
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo= ac_hi=
+ac_lo= ac_hi=
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 # Binary search between lo and hi bounds.
 while test "x$ac_lo" != "x$ac_hi"; do
   ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
@@ -20722,11 +20322,10 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -20734,45 +20333,52 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_hi=$ac_mid
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
+ac_lo=`expr '(' $ac_mid ')' + 1`
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 case $ac_lo in
 ?*) ac_cv_sizeof_long=$ac_lo;;
-'') if test "$ac_cv_type_long" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long)
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long)
+echo "$as_me: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi ;;
+   { (exit 1); exit 1; }; } ;;
 esac
 else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -20780,9 +20386,8 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+long longval () { return (long) (sizeof (long)); }
+unsigned long ulongval () { return (long) (sizeof (long)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -20791,44 +20396,35 @@
 
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
-    return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    exit (1);
+  if (((long) (sizeof (long))) < 0)
     {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
+      long i = longval ();
+      if (i != ((long) (sizeof (long))))
+	exit (1);
       fprintf (f, "%ld\n", i);
     }
   else
     {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
+      unsigned long i = ulongval ();
+      if (i != ((long) (sizeof (long))))
+	exit (1);
       fprintf (f, "%lu\n", i);
     }
-  return ferror (f) || fclose (f) != 0;
+  exit (ferror (f) || fclose (f) != 0);
 
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -20839,25 +20435,22 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-if test "$ac_cv_type_long" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long)
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long)
+echo "$as_me: error: cannot compute sizeof (long), 77
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi
+   { (exit 1); exit 1; }; }
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
+else
+  ac_cv_sizeof_long=0
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
-echo "${ECHO_T}$ac_cv_sizeof_long" >&6; }
-
-
-
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long" >&6
 cat >>confdefs.h <<_ACEOF
 #define SIZEOF_LONG $ac_cv_sizeof_long
 _ACEOF
@@ -20865,8 +20458,8 @@
 
 
 save_LIBS="${LIBS}"
-{ echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5
-echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5
+echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6
 if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -20879,53 +20472,56 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char clock_gettime ();
 int
 main ()
 {
-return clock_gettime ();
+clock_gettime ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_rt_clock_gettime=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_rt_clock_gettime=no
+ac_cv_lib_rt_clock_gettime=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5
-echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5
+echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6
 if test $ac_cv_lib_rt_clock_gettime = yes; then
   rt_libs=" -lrt"
 fi
@@ -20937,9 +20533,9 @@
 for ac_func in clock_gettime nanosleep
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -20965,60 +20561,68 @@
 
 #undef $ac_func
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
+{
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
 #endif
 
 int
 main ()
 {
-return $ac_func ();
+return f != $ac_func;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	eval "$as_ac_var=no"
+eval "$as_ac_var=no"
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -21061,11 +20665,16 @@
 #define PA_USE_COREAUDIO 1
 _ACEOF
 
-	CFLAGS="$CFLAGS -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3";
-	OTHER_OBJS="src/os/mac_osx/pa_mac_hostapis.o src/os/unix/pa_unix_util.o src/hostapi/coreaudio/pa_mac_core.o src/hostapi/coreaudio/pa_mac_core_utilities.o src/hostapi/coreaudio/pa_mac_core_blocking.o";
+	if [ -d /Developer/SDKs/MacOSX10.5.sdk ] ; then
+		SHARED_FLAGS="-Werror -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon -dynamiclib -arch x86_64 -arch ppc64 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.3";
+		CFLAGS="-Werror $CFLAGS -arch x86_64 -arch ppc64 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.3";
+	else
+		SHARED_FLAGS="-Werror -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon -dynamiclib  -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3";
+		CFLAGS="-Werror $CFLAGS -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3";
+	fi
+	OTHER_OBJS="src/os/mac_osx/pa_mac_hostapis.o src/os/unix/pa_unix_util.o src/hostapi/coreaudio/pa_mac_core.o src/hostapi/coreaudio/pa_mac_core_utilities.o src/hostapi/coreaudio/pa_mac_core_blocking.o src/common/pa_ringbuffer.o";
 	LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon";
 	PADLL="libportaudio.dylib";
-	SHARED_FLAGS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon -dynamiclib  -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3";
         if [ $with_macapi = "asio" ] ; then
             if [ $with_asiodir ] ; then
               ASIODIR="$with_asiodir";
@@ -21155,8 +20764,8 @@
 
   irix* )
 
-{ echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5
-echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5
+echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6
 if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -21169,53 +20778,56 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char pthread_create ();
 int
 main ()
 {
-return pthread_create ();
+pthread_create ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_pthread_pthread_create=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_pthread_pthread_create=no
+ac_cv_lib_pthread_pthread_create=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5
-echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6
 if test $ac_cv_lib_pthread_pthread_create = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBPTHREAD 1
@@ -21230,8 +20842,8 @@
 fi
 
 
-{ echo "$as_me:$LINENO: checking for alOpenPort in -laudio" >&5
-echo $ECHO_N "checking for alOpenPort in -laudio... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for alOpenPort in -laudio" >&5
+echo $ECHO_N "checking for alOpenPort in -laudio... $ECHO_C" >&6
 if test "${ac_cv_lib_audio_alOpenPort+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -21244,53 +20856,56 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char alOpenPort ();
 int
 main ()
 {
-return alOpenPort ();
+alOpenPort ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_audio_alOpenPort=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_audio_alOpenPort=no
+ac_cv_lib_audio_alOpenPort=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_audio_alOpenPort" >&5
-echo "${ECHO_T}$ac_cv_lib_audio_alOpenPort" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_audio_alOpenPort" >&5
+echo "${ECHO_T}$ac_cv_lib_audio_alOpenPort" >&6
 if test $ac_cv_lib_audio_alOpenPort = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBAUDIO 1
@@ -21305,8 +20920,8 @@
 fi
 
 
-{ echo "$as_me:$LINENO: checking for dmGetUST in -ldmedia" >&5
-echo $ECHO_N "checking for dmGetUST in -ldmedia... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for dmGetUST in -ldmedia" >&5
+echo $ECHO_N "checking for dmGetUST in -ldmedia... $ECHO_C" >&6
 if test "${ac_cv_lib_dmedia_dmGetUST+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -21319,53 +20934,56 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char dmGetUST ();
 int
 main ()
 {
-return dmGetUST ();
+dmGetUST ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_dmedia_dmGetUST=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_dmedia_dmGetUST=no
+ac_cv_lib_dmedia_dmGetUST=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dmedia_dmGetUST" >&5
-echo "${ECHO_T}$ac_cv_lib_dmedia_dmGetUST" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dmedia_dmGetUST" >&5
+echo "${ECHO_T}$ac_cv_lib_dmedia_dmGetUST" >&6
 if test $ac_cv_lib_dmedia_dmGetUST = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBDMEDIA 1
@@ -21396,8 +21014,8 @@
 
   *)
 
-   { echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5
-echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; }
+   echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5
+echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6
 if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -21410,53 +21028,56 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 #endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
 char pthread_create ();
 int
 main ()
 {
-return pthread_create ();
+pthread_create ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_lib_pthread_pthread_create=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_pthread_pthread_create=no
+ac_cv_lib_pthread_pthread_create=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5
-echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6
 if test $ac_cv_lib_pthread_pthread_create = yes; then
   have_pthread="yes"
 
@@ -21515,7 +21136,9 @@
 CFLAGS="$CFLAGS $THREAD_CFLAGS"
 
 if test "$enable_cxx" = "yes"; then
-   subdirs="$subdirs bindings/cpp"
+
+
+subdirs="$subdirs bindings/cpp"
 
    ENABLE_CXX_TRUE=""
    ENABLE_CXX_FALE="#"
@@ -21526,150 +21149,7 @@
 
 
 
-#check for some headers
-
-for ac_header in libkern/OSAtomic.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-ac_config_files="$ac_config_files Makefile portaudio-2.0.pc"
-
+                    ac_config_files="$ac_config_files Makefile portaudio-2.0.pc"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -21688,58 +21168,39 @@
 
 # The following way of writing the cache mishandles newlines in values,
 # but we know of no workaround that is simple, portable, and efficient.
-# So, we kill variables containing newlines.
+# So, don't put newlines in cache variables' values.
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
-(
-  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      *) $as_unset $ac_var ;;
-      esac ;;
-    esac
-  done
-
+{
   (set) 2>&1 |
-    case $as_nl`(ac_space=' '; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
       # `set' does not quote correctly, so add quotes (double-quote
       # substitution turns \\\\ into \\, and sed turns \\ into \).
       sed -n \
 	"s/'/'\\\\''/g;
 	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
-      ;; #(
+      ;;
     *)
       # `set' quotes correctly as required by POSIX, so do not add quotes.
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
       ;;
-    esac |
-    sort
-) |
+    esac;
+} |
   sed '
-     /^ac_cv_env_/b end
      t clear
-     :clear
+     : clear
      s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
      t end
-     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
-     :end' >>confcache
-if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
-  if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
-      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
-echo "$as_me: updating cache $cache_file" >&6;}
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
     cat confcache >$cache_file
   else
-    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+    echo "not updating unwritable cache $cache_file"
   fi
 fi
 rm -f confcache
@@ -21748,48 +21209,63 @@
 # Let make expand exec_prefix.
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[	 ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[	 ]*$//;
+}'
+fi
+
 # Transform confdefs.h into DEFS.
 # Protect against shell expansion while executing Makefile rules.
 # Protect against Makefile macro expansion.
 #
 # If the first sed substitution is executed (which looks for macros that
-# take arguments), then branch to the quote section.  Otherwise,
+# take arguments), then we branch to the quote section.  Otherwise,
 # look for a macro that doesn't take arguments.
-ac_script='
+cat >confdef2opt.sed <<\_ACEOF
 t clear
-:clear
-s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\)/-D\1=\2/g
+: clear
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\),-D\1=\2,g
 t quote
-s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)/-D\1=\2/g
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\),-D\1=\2,g
 t quote
-b any
-:quote
-s/[	 `~#$^&*(){}\\|;'\''"<>?]/\\&/g
-s/\[/\\&/g
-s/\]/\\&/g
-s/\$/$$/g
-H
-:any
-${
-	g
-	s/^\n//
-	s/\n/ /g
-	p
-}
-'
-DEFS=`sed -n "$ac_script" confdefs.h`
+d
+: quote
+s,[	 `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output.  A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
 
 
 ac_libobjs=
 ac_ltlibobjs=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
-  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
-  ac_i=`echo "$ac_i" | sed "$ac_script"`
-  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
-  #    will be set to the directory where LIBOBJS objects are built.
-  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+  ac_i=`echo "$ac_i" |
+	 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
 done
 LIBOBJS=$ac_libobjs
 
@@ -21820,45 +21296,17 @@
 ## M4sh Initialization.  ##
 ## --------------------- ##
 
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
+# Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
   # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
 fi
+DUALCASE=1; export DUALCASE # for MKS sh
 
 # Support unset when possible.
 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -21868,43 +21316,8 @@
 fi
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" ""	$as_nl"
-
-# Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
-fi
-
 # Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
+$as_unset ENV MAIL MAILPATH
 PS1='$ '
 PS2='> '
 PS4='+ '
@@ -21918,19 +21331,18 @@
   if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+    $as_unset $as_var
   fi
 done
 
 # Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
   as_expr=expr
 else
   as_expr=false
 fi
 
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
   as_basename=basename
 else
   as_basename=false
@@ -21938,120 +21350,159 @@
 
 
 # Name of the executable.
-as_me=`$as_basename -- "$0" ||
+as_me=`$as_basename "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
 echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
 
-# CDPATH.
-$as_unset CDPATH
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
 
 
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
 
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
   as_lineno_1=$LINENO
   as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
   test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
   # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
   # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
     sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
       N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
       t loop
-      s/-\n.*//
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
     ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
    { (exit 1); exit 1; }; }
 
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
   # Exit status is that of the last command.
   exit
 }
 
 
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
 esac
 
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
   as_expr=expr
 else
   as_expr=false
 fi
 
 rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
 echo >conf$$.file
 if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... but there are two gotchas:
-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-  # In both cases, we have to default to `cp -p'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
     as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
 elif ln conf$$.file conf$$ 2>/dev/null; then
   as_ln_s=ln
 else
   as_ln_s='cp -p'
 fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
+rm -f conf$$ conf$$.exe conf$$.file
 
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
@@ -22060,28 +21511,7 @@
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-        test -d "$1/.";
-      else
-	case $1 in
-        -*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_executable_p="test -f"
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -22090,14 +21520,31 @@
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
 exec 6>&1
 
-# Save the log message, to keep $[0] and so on meaningful, and to
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
 # report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
 This file was extended by $as_me, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
+generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -22105,18 +21552,30 @@
   CONFIG_COMMANDS = $CONFIG_COMMANDS
   $ $0 $@
 
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
 _ACEOF
 
-cat >>$CONFIG_STATUS <<_ACEOF
 # Files that config.status was made for.
-config_files="$ac_config_files"
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
 
-_ACEOF
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
 
 cat >>$CONFIG_STATUS <<\_ACEOF
+
 ac_cs_usage="\
 \`$as_me' instantiates files from templates according to the
 current configuration.
@@ -22124,7 +21583,7 @@
 Usage: $0 [OPTIONS] [FILE]...
 
   -h, --help       print this help, then exit
-  -V, --version    print version number and configuration settings, then exit
+  -V, --version    print version number, then exit
   -q, --quiet      do not print progress messages
   -d, --debug      don't remove temporary files
       --recheck    update $as_me by reconfiguring in the same conditions
@@ -22135,21 +21594,19 @@
 $config_files
 
 Report bugs to <bug-autoconf at gnu.org>."
-
 _ACEOF
+
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.61,
-  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2003 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='$ac_pwd'
-srcdir='$srcdir'
-INSTALL='$INSTALL'
+srcdir=$srcdir
+INSTALL="$INSTALL"
 _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
@@ -22160,42 +21617,60 @@
 do
   case $1 in
   --*=*)
-    ac_option=`expr "X$1" : 'X\([^=]*\)='`
-    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
     ac_shift=:
     ;;
-  *)
+  -*)
     ac_option=$1
     ac_optarg=$2
     ac_shift=shift
     ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
   esac
 
   case $ac_option in
   # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
     ac_cs_recheck=: ;;
-  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
-    echo "$ac_cs_version"; exit ;;
-  --debug | --debu | --deb | --de | --d | -d )
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
     $ac_shift
     CONFIG_FILES="$CONFIG_FILES $ac_optarg"
     ac_need_defaults=false;;
-  --he | --h |  --help | --hel | -h )
-    echo "$ac_cs_usage"; exit ;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil | --si | --s)
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) { echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
    { (exit 1); exit 1; }; } ;;
 
-  *) ac_config_targets="$ac_config_targets $1"
-     ac_need_defaults=false ;;
+  *) ac_config_targets="$ac_config_targets $1" ;;
 
   esac
   shift
@@ -22211,43 +21686,29 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 if \$ac_cs_recheck; then
-  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
-  CONFIG_SHELL=$SHELL
-  export CONFIG_SHELL
-  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
 fi
 
 _ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-exec 5>>config.log
-{
-  echo
-  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-  echo "$ac_log"
-} >&5
 
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-_ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
 
-# Handling of arguments.
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
 for ac_config_target in $ac_config_targets
 do
-  case $ac_config_target in
-    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "portaudio-2.0.pc") CONFIG_FILES="$CONFIG_FILES portaudio-2.0.pc" ;;
-
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "portaudio-2.0.pc" ) CONFIG_FILES="$CONFIG_FILES portaudio-2.0.pc" ;;
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
 done
 
-
 # If the user did not use the arguments to specify the items to instantiate,
 # then the envvar interface is used.  Set only those that are not.
 # We use the long form for the default assignment because of an extremely
@@ -22257,406 +21718,345 @@
 fi
 
 # Have a temporary directory for convenience.  Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
+# simply because there is no reason to put it here, and in addition,
 # creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
+# Create a temporary directory, and hook for its removal unless debugging.
 $debug ||
 {
-  tmp=
-  trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
-' 0
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
   trap '{ (exit 1); exit 1; }' 1 2 13 15
 }
+
 # Create a (secure) tmp directory for tmp files.
 
 {
-  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
   test -n "$tmp" && test -d "$tmp"
 }  ||
 {
-  tmp=./conf$$-$RANDOM
-  (umask 077 && mkdir "$tmp")
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
 } ||
 {
    echo "$me: cannot create a temporary directory in ." >&2
    { (exit 1); exit 1; }
 }
 
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
 #
-# Set up the sed scripts for CONFIG_FILES section.
+# CONFIG_FILES section.
 #
 
 # No need to generate the scripts if there are no CONFIG_FILES.
 # This happens for instance when ./config.status config.h
-if test -n "$CONFIG_FILES"; then
-
-_ACEOF
-
-
-
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
-  cat >conf$$subs.sed <<_ACEOF
-SHELL!$SHELL$ac_delim
-PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
-PACKAGE_NAME!$PACKAGE_NAME$ac_delim
-PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
-PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
-PACKAGE_STRING!$PACKAGE_STRING$ac_delim
-PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
-exec_prefix!$exec_prefix$ac_delim
-prefix!$prefix$ac_delim
-program_transform_name!$program_transform_name$ac_delim
-bindir!$bindir$ac_delim
-sbindir!$sbindir$ac_delim
-libexecdir!$libexecdir$ac_delim
-datarootdir!$datarootdir$ac_delim
-datadir!$datadir$ac_delim
-sysconfdir!$sysconfdir$ac_delim
-sharedstatedir!$sharedstatedir$ac_delim
-localstatedir!$localstatedir$ac_delim
-includedir!$includedir$ac_delim
-oldincludedir!$oldincludedir$ac_delim
-docdir!$docdir$ac_delim
-infodir!$infodir$ac_delim
-htmldir!$htmldir$ac_delim
-dvidir!$dvidir$ac_delim
-pdfdir!$pdfdir$ac_delim
-psdir!$psdir$ac_delim
-libdir!$libdir$ac_delim
-localedir!$localedir$ac_delim
-mandir!$mandir$ac_delim
-DEFS!$DEFS$ac_delim
-ECHO_C!$ECHO_C$ac_delim
-ECHO_N!$ECHO_N$ac_delim
-ECHO_T!$ECHO_T$ac_delim
-LIBS!$LIBS$ac_delim
-build_alias!$build_alias$ac_delim
-host_alias!$host_alias$ac_delim
-target_alias!$target_alias$ac_delim
-CC!$CC$ac_delim
-CFLAGS!$CFLAGS$ac_delim
-LDFLAGS!$LDFLAGS$ac_delim
-CPPFLAGS!$CPPFLAGS$ac_delim
-ac_ct_CC!$ac_ct_CC$ac_delim
-EXEEXT!$EXEEXT$ac_delim
-OBJEXT!$OBJEXT$ac_delim
-build!$build$ac_delim
-build_cpu!$build_cpu$ac_delim
-build_vendor!$build_vendor$ac_delim
-build_os!$build_os$ac_delim
-host!$host$ac_delim
-host_cpu!$host_cpu$ac_delim
-host_vendor!$host_vendor$ac_delim
-host_os!$host_os$ac_delim
-GREP!$GREP$ac_delim
-EGREP!$EGREP$ac_delim
-LN_S!$LN_S$ac_delim
-ECHO!$ECHO$ac_delim
-AR!$AR$ac_delim
-RANLIB!$RANLIB$ac_delim
-STRIP!$STRIP$ac_delim
-DLLTOOL!$DLLTOOL$ac_delim
-AS!$AS$ac_delim
-OBJDUMP!$OBJDUMP$ac_delim
-CPP!$CPP$ac_delim
-CXX!$CXX$ac_delim
-CXXFLAGS!$CXXFLAGS$ac_delim
-ac_ct_CXX!$ac_ct_CXX$ac_delim
-CXXCPP!$CXXCPP$ac_delim
-F77!$F77$ac_delim
-FFLAGS!$FFLAGS$ac_delim
-ac_ct_F77!$ac_ct_F77$ac_delim
-LIBTOOL!$LIBTOOL$ac_delim
-INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
-INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
-INSTALL_DATA!$INSTALL_DATA$ac_delim
-PKG_CONFIG!$PKG_CONFIG$ac_delim
-JACK_CFLAGS!$JACK_CFLAGS$ac_delim
-JACK_LIBS!$JACK_LIBS$ac_delim
-LT_CURRENT!$LT_CURRENT$ac_delim
-LT_REVISION!$LT_REVISION$ac_delim
-LT_AGE!$LT_AGE$ac_delim
-OTHER_OBJS!$OTHER_OBJS$ac_delim
-PADLL!$PADLL$ac_delim
-SHARED_FLAGS!$SHARED_FLAGS$ac_delim
-THREAD_CFLAGS!$THREAD_CFLAGS$ac_delim
-DLL_LIBS!$DLL_LIBS$ac_delim
-NASM!$NASM$ac_delim
-NASMOPT!$NASMOPT$ac_delim
-subdirs!$subdirs$ac_delim
-ENABLE_CXX_TRUE!$ENABLE_CXX_TRUE$ac_delim
-ENABLE_CXX_FALSE!$ENABLE_CXX_FALSE$ac_delim
-LIBOBJS!$LIBOBJS$ac_delim
-LTLIBOBJS!$LTLIBOBJS$ac_delim
-_ACEOF
-
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 92; then
-    break
-  elif $ac_last_try; then
-    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
-  else
-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s, at SHELL@,$SHELL,;t t
+s, at PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s, at PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s, at PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s, at PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s, at PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s, at PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s, at exec_prefix@,$exec_prefix,;t t
+s, at prefix@,$prefix,;t t
+s, at program_transform_name@,$program_transform_name,;t t
+s, at bindir@,$bindir,;t t
+s, at sbindir@,$sbindir,;t t
+s, at libexecdir@,$libexecdir,;t t
+s, at datadir@,$datadir,;t t
+s, at sysconfdir@,$sysconfdir,;t t
+s, at sharedstatedir@,$sharedstatedir,;t t
+s, at localstatedir@,$localstatedir,;t t
+s, at libdir@,$libdir,;t t
+s, at includedir@,$includedir,;t t
+s, at oldincludedir@,$oldincludedir,;t t
+s, at infodir@,$infodir,;t t
+s, at mandir@,$mandir,;t t
+s, at build_alias@,$build_alias,;t t
+s, at host_alias@,$host_alias,;t t
+s, at target_alias@,$target_alias,;t t
+s, at DEFS@,$DEFS,;t t
+s, at ECHO_C@,$ECHO_C,;t t
+s, at ECHO_N@,$ECHO_N,;t t
+s, at ECHO_T@,$ECHO_T,;t t
+s, at LIBS@,$LIBS,;t t
+s, at CC@,$CC,;t t
+s, at CFLAGS@,$CFLAGS,;t t
+s, at LDFLAGS@,$LDFLAGS,;t t
+s, at CPPFLAGS@,$CPPFLAGS,;t t
+s, at ac_ct_CC@,$ac_ct_CC,;t t
+s, at EXEEXT@,$EXEEXT,;t t
+s, at OBJEXT@,$OBJEXT,;t t
+s, at build@,$build,;t t
+s, at build_cpu@,$build_cpu,;t t
+s, at build_vendor@,$build_vendor,;t t
+s, at build_os@,$build_os,;t t
+s, at host@,$host,;t t
+s, at host_cpu@,$host_cpu,;t t
+s, at host_vendor@,$host_vendor,;t t
+s, at host_os@,$host_os,;t t
+s, at EGREP@,$EGREP,;t t
+s, at LN_S@,$LN_S,;t t
+s, at ECHO@,$ECHO,;t t
+s, at AR@,$AR,;t t
+s, at ac_ct_AR@,$ac_ct_AR,;t t
+s, at RANLIB@,$RANLIB,;t t
+s, at ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s, at STRIP@,$STRIP,;t t
+s, at ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s, at DLLTOOL@,$DLLTOOL,;t t
+s, at ac_ct_DLLTOOL@,$ac_ct_DLLTOOL,;t t
+s, at AS@,$AS,;t t
+s, at ac_ct_AS@,$ac_ct_AS,;t t
+s, at OBJDUMP@,$OBJDUMP,;t t
+s, at ac_ct_OBJDUMP@,$ac_ct_OBJDUMP,;t t
+s, at CPP@,$CPP,;t t
+s, at CXX@,$CXX,;t t
+s, at CXXFLAGS@,$CXXFLAGS,;t t
+s, at ac_ct_CXX@,$ac_ct_CXX,;t t
+s, at CXXCPP@,$CXXCPP,;t t
+s, at F77@,$F77,;t t
+s, at FFLAGS@,$FFLAGS,;t t
+s, at ac_ct_F77@,$ac_ct_F77,;t t
+s, at LIBTOOL@,$LIBTOOL,;t t
+s, at INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s, at INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s, at INSTALL_DATA@,$INSTALL_DATA,;t t
+s, at PKG_CONFIG@,$PKG_CONFIG,;t t
+s, at ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t
+s, at JACK_CFLAGS@,$JACK_CFLAGS,;t t
+s, at JACK_LIBS@,$JACK_LIBS,;t t
+s, at LT_CURRENT@,$LT_CURRENT,;t t
+s, at LT_REVISION@,$LT_REVISION,;t t
+s, at LT_AGE@,$LT_AGE,;t t
+s, at OTHER_OBJS@,$OTHER_OBJS,;t t
+s, at PADLL@,$PADLL,;t t
+s, at SHARED_FLAGS@,$SHARED_FLAGS,;t t
+s, at THREAD_CFLAGS@,$THREAD_CFLAGS,;t t
+s, at DLL_LIBS@,$DLL_LIBS,;t t
+s, at NASM@,$NASM,;t t
+s, at NASMOPT@,$NASMOPT,;t t
+s, at subdirs@,$subdirs,;t t
+s, at ENABLE_CXX_TRUE@,$ENABLE_CXX_TRUE,;t t
+s, at ENABLE_CXX_FALSE@,$ENABLE_CXX_FALSE,;t t
+s, at LIBOBJS@,$LIBOBJS,;t t
+s, at LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
   fi
-done
-
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
-  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
-  ac_eof=`expr $ac_eof + 1`
-fi
+fi # test -n "$CONFIG_FILES"
 
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
-_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
-CEOF$ac_eof
 _ACEOF
-
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
-  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[	 ]*\):*/\1/
-s/:*$//
-s/^[^=]*=[	 ]*$//
-}'
-fi
-
 cat >>$CONFIG_STATUS <<\_ACEOF
-fi # test -n "$CONFIG_FILES"
-
-
-for ac_tag in  :F $CONFIG_FILES
-do
-  case $ac_tag in
-  :[FHLC]) ac_mode=$ac_tag; continue;;
-  esac
-  case $ac_mode$ac_tag in
-  :[FHL]*:*);;
-  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-echo "$as_me: error: Invalid tag $ac_tag." >&2;}
-   { (exit 1); exit 1; }; };;
-  :[FH]-) ac_tag=-:-;;
-  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
-  esac
-  ac_save_IFS=$IFS
-  IFS=:
-  set x $ac_tag
-  IFS=$ac_save_IFS
-  shift
-  ac_file=$1
-  shift
-
-  case $ac_mode in
-  :L) ac_source=$1;;
-  :[FH])
-    ac_file_inputs=
-    for ac_f
-    do
-      case $ac_f in
-      -) ac_f="$tmp/stdin";;
-      *) # Look for the file first in the build tree, then in the source tree
-	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
-	 # because $ac_f cannot contain `:'.
-	 test -f "$ac_f" ||
-	   case $ac_f in
-	   [\\/$]*) false;;
-	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
-	   esac ||
-	   { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-echo "$as_me: error: cannot find input file: $ac_f" >&2;}
-   { (exit 1); exit 1; }; };;
-      esac
-      ac_file_inputs="$ac_file_inputs $ac_f"
-    done
-
-    # Let's still pretend it is `configure' which instantiates (i.e., don't
-    # use $as_me), people would be surprised to read:
-    #    /* config.h.  Generated by config.status.  */
-    configure_input="Generated from "`IFS=:
-	  echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
-    if test x"$ac_file" != x-; then
-      configure_input="$ac_file.  $configure_input"
-      { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    fi
-
-    case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin";;
-    esac
-    ;;
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+	cat >$tmp/stdin
+	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
   esac
 
-  ac_dir=`$as_dirname -- "$ac_file" ||
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
 $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$ac_file" : 'X\(//\)[^/]' \| \
 	 X"$ac_file" : 'X\(//\)$' \| \
-	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+	 X"$ac_file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
 echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-  { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
     as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$as_dir" : 'X\(//\)[^/]' \| \
 	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
 echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
     done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
    { (exit 1); exit 1; }; }; }
+
   ac_builddir=.
 
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
+if test "$ac_dir" != .; then
   ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
 
 case $srcdir in
-  .)  # We are building in place.
+  .)  # No --srcdir option.  We are building in place.
     ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
     ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
 esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
 
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
 
-  case $ac_mode in
-  :F)
-  #
-  # CONFIG_FILE
-  #
 
   case $INSTALL in
   [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
   esac
-_ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-
-case `sed -n '/datarootdir/ {
-  p
-  q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p
-' $ac_file_inputs` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-  ac_datarootdir_hack='
-  s&@datadir@&$datadir&g
-  s&@docdir@&$docdir&g
-  s&@infodir@&$infodir&g
-  s&@localedir@&$localedir&g
-  s&@mandir@&$mandir&g
-    s&\\\${datarootdir}&$datarootdir&g' ;;
-esac
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+				     sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+	 # Absolute (can't be DOS-style, as IFS=:)
+	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 echo "$f";;
+      *) # Relative
+	 if test -f "$f"; then
+	   # Build tree
+	   echo "$f"
+	 elif test -f "$srcdir/$f"; then
+	   # Source tree
+	   echo "$srcdir/$f"
+	 else
+	   # /dev/null tree
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 fi;;
+      esac
+    done` || { (exit 1); exit 1; }
 _ACEOF
-
-# Neutralize VPATH when `$srcdir' = `.'.
-# Shell code in configure.ac might set extrasub.
-# FIXME: do we really want to maintain this feature?
 cat >>$CONFIG_STATUS <<_ACEOF
   sed "$ac_vpsub
 $extrasub
@@ -22664,40 +22064,29 @@
 cat >>$CONFIG_STATUS <<\_ACEOF
 :t
 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s&@configure_input@&$configure_input&;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-$ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
-  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&5
-echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&2;}
-
-  rm -f "$tmp/stdin"
-  case $ac_file in
-  -) cat "$tmp/out"; rm -f "$tmp/out";;
-  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
-  esac
- ;;
-
-
-
-  esac
+s, at configure_input@,$configure_input,;t t
+s, at srcdir@,$ac_srcdir,;t t
+s, at abs_srcdir@,$ac_abs_srcdir,;t t
+s, at top_srcdir@,$ac_top_srcdir,;t t
+s, at abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s, at builddir@,$ac_builddir,;t t
+s, at abs_builddir@,$ac_abs_builddir,;t t
+s, at top_builddir@,$ac_top_builddir,;t t
+s, at abs_top_builddir@,$ac_abs_top_builddir,;t t
+s, at INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
 
-done # for ac_tag
+done
+_ACEOF
 
+cat >>$CONFIG_STATUS <<\_ACEOF
 
 { (exit 0); exit 0; }
 _ACEOF
@@ -22734,10 +22123,7 @@
   # Remove --cache-file and --srcdir arguments so they do not pile up.
   ac_sub_configure_args=
   ac_prev=
-  eval "set x $ac_configure_args"
-  shift
-  for ac_arg
-  do
+  for ac_arg in $ac_configure_args; do
     if test -n "$ac_prev"; then
       ac_prev=
       continue
@@ -22760,123 +22146,123 @@
       ac_prev=prefix ;;
     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
       ;;
-    *)
-      case $ac_arg in
-      *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-      esac
-      ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
+    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
     esac
   done
 
   # Always prepend --prefix to ensure using the same prefix
   # in subdir configurations.
-  ac_arg="--prefix=$prefix"
-  case $ac_arg in
-  *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-  esac
-  ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args"
-
-  # Pass --silent
-  if test "$silent" = yes; then
-    ac_sub_configure_args="--silent $ac_sub_configure_args"
-  fi
+  ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args"
 
   ac_popdir=`pwd`
   for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
 
     # Do not complain, so a configure script can configure whichever
     # parts of a large source tree are present.
-    test -d "$srcdir/$ac_dir" || continue
+    test -d $srcdir/$ac_dir || continue
 
-    ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
-    echo "$as_me:$LINENO: $ac_msg" >&5
-    echo "$ac_msg" >&6
-    { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    { echo "$as_me:$LINENO: configuring in $ac_dir" >&5
+echo "$as_me: configuring in $ac_dir" >&6;}
+    { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
     as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$as_dir" : 'X\(//\)[^/]' \| \
 	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
 echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
     done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
    { (exit 1); exit 1; }; }; }
+
     ac_builddir=.
 
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
+if test "$ac_dir" != .; then
   ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
 
 case $srcdir in
-  .)  # We are building in place.
+  .)  # No --srcdir option.  We are building in place.
     ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
     ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
 esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
 
 
-    cd "$ac_dir"
+    cd $ac_dir
 
     # Check for guested configure; otherwise get Cygnus style configure.
-    if test -f "$ac_srcdir/configure.gnu"; then
-      ac_sub_configure=$ac_srcdir/configure.gnu
-    elif test -f "$ac_srcdir/configure"; then
-      ac_sub_configure=$ac_srcdir/configure
-    elif test -f "$ac_srcdir/configure.in"; then
-      # This should be Cygnus configure.
-      ac_sub_configure=$ac_aux_dir/configure
+    if test -f $ac_srcdir/configure.gnu; then
+      ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'"
+    elif test -f $ac_srcdir/configure; then
+      ac_sub_configure="$SHELL '$ac_srcdir/configure'"
+    elif test -f $ac_srcdir/configure.in; then
+      ac_sub_configure=$ac_configure
     else
       { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5
 echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
@@ -22888,21 +22274,21 @@
       # Make the cache file name correct relative to the subdirectory.
       case $cache_file in
       [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
-      *) # Relative name.
-	ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
+      *) # Relative path.
+	ac_sub_cache_file=$ac_top_builddir$cache_file ;;
       esac
 
-      { echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
-echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
+      { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
+echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
       # The eval makes quoting arguments work.
-      eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
-	   --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
+      eval $ac_sub_configure $ac_sub_configure_args \
+	   --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir ||
 	{ { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5
 echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;}
    { (exit 1); exit 1; }; }
     fi
 
-    cd "$ac_popdir"
+    cd $ac_popdir
   done
 fi
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/configure.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/configure.in	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/configure.in	Mon Aug  4 21:29:58 2008
@@ -139,11 +139,16 @@
 	dnl Mac OS X configuration
 
 	AC_DEFINE(PA_USE_COREAUDIO)
-	CFLAGS="$CFLAGS -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3";
-	OTHER_OBJS="src/os/mac_osx/pa_mac_hostapis.o src/os/unix/pa_unix_util.o src/hostapi/coreaudio/pa_mac_core.o src/hostapi/coreaudio/pa_mac_core_utilities.o src/hostapi/coreaudio/pa_mac_core_blocking.o";
+	if [[ -d /Developer/SDKs/MacOSX10.5.sdk ]] ; then
+		SHARED_FLAGS="-Werror -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon -dynamiclib -arch x86_64 -arch ppc64 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.3";
+		CFLAGS="-Werror $CFLAGS -arch x86_64 -arch ppc64 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.3";
+	else
+		SHARED_FLAGS="-Werror -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon -dynamiclib  -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3";
+		CFLAGS="-Werror $CFLAGS -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3";
+	fi
+	OTHER_OBJS="src/os/mac_osx/pa_mac_hostapis.o src/os/unix/pa_unix_util.o src/hostapi/coreaudio/pa_mac_core.o src/hostapi/coreaudio/pa_mac_core_utilities.o src/hostapi/coreaudio/pa_mac_core_blocking.o src/common/pa_ringbuffer.o";
 	LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon";
 	PADLL="libportaudio.dylib";
-	SHARED_FLAGS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon -dynamiclib  -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3";
         if [[ $with_macapi = "asio" ]] ; then
             if [[ $with_asiodir ]] ; then
               ASIODIR="$with_asiodir";
@@ -312,7 +317,4 @@
 AC_SUBST(ENABLE_CXX_TRUE)
 AC_SUBST(ENABLE_CXX_FALSE)
 
-#check for some headers
-AC_CHECK_HEADERS([libkern/OSAtomic.h])
-
 AC_OUTPUT([Makefile portaudio-2.0.pc])

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_linux_alsa.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_linux_alsa.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_linux_alsa.h	Mon Aug  4 21:29:58 2008
@@ -2,7 +2,7 @@
 #define PA_LINUX_ALSA_H
 
 /*
- * $Id: pa_linux_alsa.h 1145 2006-11-22 22:40:04Z aknudsen $
+ * $Id: pa_linux_alsa.h 1236 2007-06-24 20:39:26Z aknudsen $
  * PortAudio Portable Real-Time Audio Library
  * ALSA-specific extensions
  *
@@ -58,17 +58,33 @@
 }
 PaAlsaStreamInfo;
 
+/** Initialize host API specific structure, call this before setting relevant attributes. */
 void PaAlsa_InitializeStreamInfo( PaAlsaStreamInfo *info );
 
+/** Instruct whether to enable real-time priority when starting the audio thread.
+ *
+ * If this is turned on by the stream is started, the audio callback thread will be created
+ * with the FIFO scheduling policy, which is suitable for realtime operation.
+ **/
 void PaAlsa_EnableRealtimeScheduling( PaStream *s, int enable );
 
 #if 0
 void PaAlsa_EnableWatchdog( PaStream *s, int enable );
 #endif
 
-int PaAlsa_GetStreamInputCard( PaStream *s, int *card );
+/** Get the ALSA-lib card index of this stream's input device. */
+PaError PaAlsa_GetStreamInputCard( PaStream *s, int *card );
+
+/** Get the ALSA-lib card index of this stream's output device. */
+PaError PaAlsa_GetStreamOutputCard( PaStream *s, int *card );
 
-int PaAlsa_GetStreamOutputCard( PaStream *s, int *card );
+/** Set the number of periods (buffer fragments) to configure devices with.
+ *
+ * By default the number of periods is 4, this is the lowest number of periods that works well on
+ * the author's soundcard.
+ * @param numPeriods The number of periods.
+ */
+PaError PaAlsa_SetNumPeriods( int numPeriods );
 
 #ifdef __cplusplus
 }

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_mac_core.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_mac_core.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_mac_core.h	Mon Aug  4 21:29:58 2008
@@ -50,8 +50,8 @@
  * A pointer to a paMacCoreStreamInfo may be passed as
  * the hostApiSpecificStreamInfo in the PaStreamParameters struct
  * when opening a stream or querying the format. Use NULL, for the
- * defaults. Note that for duplex streams, both infos should be the
- * same or behaviour is undefined.
+ * defaults. Note that for duplex streams, flags for input and output
+ * should be the same or behaviour is undefined.
  */
 typedef struct
 {
@@ -59,7 +59,7 @@
     PaHostApiTypeId hostApiType;  /**host API for which this data is intended */
     unsigned long version;        /**structure version */
     unsigned long flags;          /* flags to modify behaviour */
-    long const * channelMap;             /* Channel map for HAL channel mapping , if not needed, use NULL;*/ 
+    SInt32 const * channelMap;    /* Channel map for HAL channel mapping , if not needed, use NULL;*/ 
     unsigned long channelMapSize; /* Channel map size for HAL channel mapping , if not needed, use 0;*/ 
 } PaMacCoreStreamInfo;
 
@@ -81,7 +81,7 @@
  * @param channelMap The channel map array, as described in notes.txt. This array pointer will be used directly (ie the underlying data will not be copied), so the caller should not free the array until after the stream has been opened.
  * @param channelMapSize The size of the channel map array.
  */
-void PaMacCore_SetupChannelMap( PaMacCoreStreamInfo *data, const long * const channelMap, unsigned long channelMapSize );
+void PaMacCore_SetupChannelMap( PaMacCoreStreamInfo *data, const SInt32 * const channelMap, unsigned long channelMapSize );
 
 /*
  * Retrieve the AudioDeviceID of the input device assigned to an open stream

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_win_wmme.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_win_wmme.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/pa_win_wmme.h	Mon Aug  4 21:29:58 2008
@@ -1,7 +1,7 @@
 #ifndef PA_WIN_WMME_H
 #define PA_WIN_WMME_H
 /*
- * $Id: pa_win_wmme.h 1115 2006-09-06 15:39:48Z rossb $
+ * $Id: pa_win_wmme.h 1247 2007-08-11 16:29:09Z rossb $
  * PortAudio Portable Real-Time Audio Library
  * MME specific extensions
  *
@@ -44,6 +44,7 @@
 
 
 #include "portaudio.h"
+#include "pa_win_waveformat.h"
 
 #ifdef __cplusplus
 extern "C"
@@ -53,7 +54,7 @@
 
 #define paWinMmeUseLowLevelLatencyParameters            (0x01)
 #define paWinMmeUseMultipleDevices                      (0x02)  /* use mme specific multiple device feature */
-
+#define paWinMmeUseChannelMask                          (0x04)
 
 /* By default, the mme implementation drops the processing thread's priority
     to THREAD_PRIORITY_NORMAL and sleeps the thread if the CPU load exceeds 100%
@@ -106,6 +107,15 @@
     PaWinMmeDeviceAndChannelCount *devices;
     unsigned long deviceCount;
 
+    /*
+        support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
+        paWinMmeUseChannelMask this allows you to specify which speakers 
+        to address in a multichannel stream. Constants for channelMask
+        are specified in pa_win_waveformat.h
+
+    */
+    PaWinWaveFormatChannelMask channelMask;
+
 }PaWinMmeStreamInfo;
 
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/portaudio.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/portaudio.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/include/portaudio.h	Mon Aug  4 21:29:58 2008
@@ -1,8 +1,7 @@
-
 #ifndef PORTAUDIO_H
 #define PORTAUDIO_H
 /*
- * $Id: portaudio.h 1149 2006-11-27 01:42:26Z leland_lucius $
+ * $Id: portaudio.h 1247 2007-08-11 16:29:09Z rossb $
  * PortAudio Portable Real-Time Audio Library
  * PortAudio API Header File
  * Latest version available at: http://www.portaudio.com/

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/ltmain.sh
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/ltmain.sh	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/ltmain.sh	Mon Aug  4 21:29:58 2008
@@ -33,6 +33,9 @@
 # function.
 progpath="$0"
 
+# define SED for historic ltconfig's generated by Libtool 1.3
+test -z "$SED" && SED=sed
+
 # The name of this program:
 progname=`echo "$progpath" | $SED $basename`
 modename="$progname"
@@ -51,6 +54,13 @@
 if test -n "${ZSH_VERSION+set}" ; then
   setopt NO_GLOB_SUBST
 fi
+# Same for EGREP, and just to be sure, do LTCC as well
+if test "X$EGREP" = X ; then
+    EGREP=egrep
+fi
+if test "X$LTCC" = X ; then
+    LTCC=${CC-gcc}
+fi
 
 # Check that we have a working $echo.
 if test "X$1" = X--no-reexec; then
@@ -137,6 +147,30 @@
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
 
+if test -z "$max_cmd_len"; then
+  i=0
+  testring="ABCD"
+  new_result=
+  
+  # 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"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
+             = "XX$testring") >/dev/null 2>&1 &&
+          new_result=`expr "X$testring" : ".*" 2>&1` &&
+          max_cmd_len="$new_result" &&
+          test "$i" != 17 # 1/2 MB should be enough
+  do
+    i=`expr $i + 1`
+    testring="$testring$testring"
+  done
+  testring=
+  # Add a significant safety factor because C++ compilers can tack on massive
+  # amounts of additional arguments before passing them to the linker.
+  # It appears as though 1/2 is a usable value.
+  max_cmd_len=`expr $max_cmd_len \/ 2`
+fi
+
 #####################################
 # Shell function definitions:
 # This seems to be the best place for them
@@ -257,7 +291,21 @@
 	    esac
 	    CC_quoted="$CC_quoted $arg"
 	  done
+	    # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
+	    trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
+	    # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
+	    extendcc=${host}-${CC}
+	    # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc  
+	    # (Gentoo-specific hack because we always export $CHOST)
+	    mungedcc=${CHOST-${host}}-${trimedcc}
 	    case "$@ " in
+	      "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
+	      "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
+	      tagname=CC
+	      break ;;
+	      "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
+	      "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
+	      "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
 	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
 	      # The compiler in the base compile command matches
 	      # the one in the tagged configuration.
@@ -851,7 +899,7 @@
     # Lock this critical section if it is needed
     # We use this script file to make the link, it avoids creating a new file
     if test "$need_locks" = yes; then
-      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+      until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
 	$show "Waiting for $lockfile to be removed"
 	sleep 2
       done
@@ -3642,6 +3690,13 @@
 			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
 			esac
 		      done
+		      # It is ok to link against an archive when
+		      # building a shared library.
+		      if $AR -t $potlib > /dev/null 2>&1; then
+		        newdeplibs="$newdeplibs $a_deplib"
+		        a_deplib=""
+		        break 2
+		      fi
 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
 			 | ${SED} 10q \
 			 | $EGREP "$file_magic_regex" > /dev/null; then
@@ -5379,6 +5434,11 @@
 	$echo >> $output "\
     if test \"\$libtool_execute_magic\" != \"$magic\"; then
       # Run the actual program with our arguments.
+
+      # Make sure env LD_LIBRARY_PATH does not mess us up
+      if test -n \"\${LD_LIBRARY_PATH+set}\"; then
+        export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH
+      fi
 "
 	case $host in
 	# Backslashes separate directories on plain windows
@@ -5606,9 +5666,53 @@
 		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
 		  exit $EXIT_FAILURE
 		fi
-		newdependency_libs="$newdependency_libs $libdir/$name"
+		if test "X$EGREP" = X ; then
+			EGREP=egrep
+		fi
+		# We do not want portage's install root ($D) present.  Check only for
+		# this if the .la is being installed.
+		if test "$installed" = yes && test "$D"; then
+		  eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
+		else
+		  mynewdependency_lib="$libdir/$name"
+		fi
+		# Do not add duplicates
+		if test "$mynewdependency_lib"; then
+		  my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
+		  if test -z "$my_little_ninja_foo_1"; then
+		    newdependency_libs="$newdependency_libs $mynewdependency_lib"
+		  fi
+		fi
+		;;
+		  *)
+		if test "$installed" = yes; then
+		  # Rather use S=WORKDIR if our version of portage supports it.
+		  # This is because some ebuild (gcc) do not use $S as buildroot.
+		  if test "$PWORKDIR"; then
+		    S="$PWORKDIR"
+		  fi
+		  # We do not want portage's build root ($S) present.
+		  my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
+		  # We do not want portage's install root ($D) present.
+		  my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
+		  if test -n "$my_little_ninja_foo_2" && test "$S"; then
+		    mynewdependency_lib=""
+		  elif test -n "$my_little_ninja_foo_3" && test "$D"; then
+		    eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
+		  else
+		    mynewdependency_lib="$deplib"
+		  fi
+		else
+		  mynewdependency_lib="$deplib"
+		fi
+		# Do not add duplicates
+		if test "$mynewdependency_lib"; then
+		  my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
+		  if test -z "$my_little_ninja_foo_4"; then
+			newdependency_libs="$newdependency_libs $mynewdependency_lib"
+		  fi
+		fi
 		;;
-	      *) newdependency_libs="$newdependency_libs $deplib" ;;
 	      esac
 	    done
 	    dependency_libs="$newdependency_libs"
@@ -5660,6 +5764,10 @@
 	  case $host,$output,$installed,$module,$dlname in
 	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 	  esac
+	  # Do not add duplicates
+	  if test "$installed" = yes && test "$D"; then
+	    install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
+	  fi
 	  $echo > $output "\
 # $outputname - a libtool library file
 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/SConscript
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/SConscript	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/SConscript	Mon Aug  4 21:29:58 2008
@@ -202,4 +202,10 @@
 tests = [env.Program(target=os.path.join("#", "bin", name), source=[os.path.join("#", "test", name + ".c"),
         staticLib]) for name in testNames]
 
-Return("sources", "sharedLib", "staticLib", "tests", "env")
+# Detect host APIs
+hostApis = []
+for cppdef in env["CPPDEFINES"]:
+    if cppdef.startswith("PA_USE_"):
+        hostApis.append(cppdef[7:-2])
+
+Return("sources", "sharedLib", "staticLib", "tests", "env", "hostApis")

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_debugprint.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_debugprint.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_debugprint.c	Mon Aug  4 21:29:58 2008
@@ -74,7 +74,7 @@
  VERY dangerous alternative, vsprintf (with no n)
  */
 
-#if (_MSC_VER) && (_MSC_VER < 1400)
+#if (_MSC_VER) && (_MSC_VER <= 1400)
 #define VSNPRINTF  _vsnprintf
 #else
 #define VSNPRINTF  vsnprintf

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_debugprint.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_debugprint.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_debugprint.h	Mon Aug  4 21:29:58 2008
@@ -72,7 +72,7 @@
     Function exit (simple return value):
 
         "FunctionName returned:\n"
-        "\tReturnType: returnValue\n\n"
+        "\tReturnType: returnValue\n"
 
     If the return type is an error code, the error text is displayed in ()
 
@@ -101,9 +101,36 @@
 
 
 #ifdef PA_LOG_API_CALLS
-#define PA_LOGAPI(x) PaUtil_DebugPrint x ;
+#define PA_LOGAPI(x) PaUtil_DebugPrint x 
+
+#define PA_LOGAPI_ENTER(functionName) PaUtil_DebugPrint( functionName " called.\n" )
+
+#define PA_LOGAPI_ENTER_PARAMS(functionName) PaUtil_DebugPrint( functionName " called:\n" )
+
+#define PA_LOGAPI_EXIT(functionName) PaUtil_DebugPrint( functionName " returned.\n" )
+
+#define PA_LOGAPI_EXIT_PAERROR( functionName, result ) \
+	PaUtil_DebugPrint( functionName " returned:\n" ); \
+	PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
+
+#define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result ) \
+	PaUtil_DebugPrint( functionName " returned:\n" ); \
+	PaUtil_DebugPrint("\t" resultFormatString "\n", result )
+
+#define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result ) \
+	PaUtil_DebugPrint( functionName " returned:\n" ); \
+	if( result > 0 ) \
+        PaUtil_DebugPrint("\t" positiveResultFormatString "\n", result ); \
+    else \
+        PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
 #else
 #define PA_LOGAPI(x)
+#define PA_LOGAPI_ENTER(functionName)
+#define PA_LOGAPI_ENTER_PARAMS(functionName)
+#define PA_LOGAPI_EXIT(functionName)
+#define PA_LOGAPI_EXIT_PAERROR( functionName, result )
+#define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result )
+#define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result )
 #endif
 
     

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_endianness.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_endianness.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_endianness.h	Mon Aug  4 21:29:58 2008
@@ -1,7 +1,7 @@
 #ifndef PA_ENDIANNESS_H
 #define PA_ENDIANNESS_H
 /*
- * $Id: pa_endianness.h 1136 2006-11-22 03:52:34Z rossb $
+ * $Id: pa_endianness.h 1216 2007-06-10 09:26:00Z aknudsen $
  * Portable Audio I/O Library current platform endianness macros
  *
  * Based on the Open Source API proposed by Ross Bencina
@@ -97,7 +97,7 @@
 
         /* set PA_LITTLE_ENDIAN or PA_BIG_ENDIAN by testing well known platform specific defines */
 
-        #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(LITTLE_ENDIAN) || defined(__i386) || defined(_M_IX86)
+        #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(LITTLE_ENDIAN) || defined(__i386) || defined(_M_IX86) || defined(__x86_64__)
             #define PA_LITTLE_ENDIAN /* win32, assume intel byte order */
         #else
             #define PA_BIG_ENDIAN

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_front.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_front.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_front.c	Mon Aug  4 21:29:58 2008
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_front.c 1139 2006-11-22 06:51:06Z rossb $
+ * $Id: pa_front.c 1229 2007-06-15 16:11:11Z rossb $
  * Portable Audio I/O Library Multi-Host API front end
  * Validate function parameters and manage multiple host APIs.
  *
@@ -82,51 +82,15 @@
 #include "pa_types.h"
 #include "pa_hostapi.h"
 #include "pa_stream.h"
-
-#include "pa_trace.h"
+#include "pa_trace.h" /* still usefull?*/
+#include "pa_debugprint.h"
 
 
 #define PA_VERSION_  1899
-#define PA_VERSION_TEXT_ "PortAudio V19-devel"
+#define PA_VERSION_TEXT_ "PortAudio V19-devel (built " __DATE__  ")"
 
 
 
-/* #define PA_LOG_API_CALLS */
-
-/*
-    The basic format for log messages is described below. If you need to
-    add any log messages, please follow this format.
- 
-    Function entry (void function):
- 
-        "FunctionName called.\n"
- 
-    Function entry (non void function):
- 
-        "FunctionName called:\n"
-        "\tParam1Type param1: param1Value\n"
-        "\tParam2Type param2: param2Value\n"      (etc...)
- 
- 
-    Function exit (no return value):
- 
-        "FunctionName returned.\n"
- 
-    Function exit (simple return value):
- 
-        "FunctionName returned:\n"
-        "\tReturnType: returnValue\n\n"
- 
-    If the return type is an error code, the error text is displayed in ()
- 
-    If the return type is not an error code, but has taken a special value
-    because an error occurred, then the reason for the error is shown in []
- 
-    If the return type is a struct ptr, the struct is dumped.
- 
-    See the code below for examples
-*/
-
 
 int Pa_GetVersion( void )
 {
@@ -183,6 +147,7 @@
 static void TerminateHostApis( void )
 {
     /* terminate in reverse order from initialization */
+    PA_DEBUG(("TerminateHostApis in \n"));
 
     while( hostApisCount_ > 0 )
     {
@@ -195,6 +160,8 @@
     if( hostApis_ != 0 )
         PaUtil_FreeMemory( hostApis_ );
     hostApis_ = 0;
+
+    PA_DEBUG(("TerminateHostApis out\n"));
 }
 
 
@@ -220,10 +187,15 @@
     for( i=0; i< initializerCount; ++i )
     {
         hostApis_[hostApisCount_] = NULL;
+
+        PA_DEBUG(( "before paHostApiInitializers[%d].\n",i));
+
         result = paHostApiInitializers[i]( &hostApis_[hostApisCount_], hostApisCount_ );
         if( result != paNoError )
             goto error;
 
+        PA_DEBUG(( "after paHostApiInitializers[%d].\n",i));
+
         if( hostApis_[hostApisCount_] )
         {
             PaUtilHostApiRepresentation* hostApi = hostApis_[hostApisCount_];
@@ -337,9 +309,7 @@
 {
     PaError result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint( "Pa_Initialize called.\n" );
-#endif
+    PA_LOGAPI_ENTER( "Pa_Initialize" );
 
     if( PA_IS_INITIALISED_ )
     {
@@ -359,10 +329,7 @@
             ++initializationCount_;
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint( "Pa_Initialize returned:\n" );
-    PaUtil_DebugPrint( "\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI_EXIT_PAERROR( "Pa_Initialize", result );
 
     return result;
 }
@@ -372,9 +339,7 @@
 {
     PaError result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_Terminate called.\n" );
-#endif
+    PA_LOGAPI_ENTER( "Pa_Terminate" );
 
     if( PA_IS_INITIALISED_ )
     {
@@ -393,10 +358,7 @@
         result=  paNotInitialized;
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_Terminate returned:\n" );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI_EXIT_PAERROR( "Pa_Terminate", result );
 
     return result;
 }
@@ -443,7 +405,12 @@
     case paCanNotWriteToACallbackStream:        result = "Can't write to a callback stream"; break;
     case paCanNotReadFromAnOutputOnlyStream:    result = "Can't read from an output only stream"; break;
     case paCanNotWriteToAnInputOnlyStream:      result = "Can't write to an input only stream"; break;
-    default:                         result = "Illegal error number"; break;
+    default:                         
+		if( errorCode > 0 )
+			result = "Invalid error code (value greater than zero)"; 
+        else
+			result = "Invalid error code"; 
+        break;
     }
     return result;
 }
@@ -454,10 +421,8 @@
     PaHostApiIndex result;
     int i;
     
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_HostApiTypeIdToHostApiIndex called:\n" );
-    PaUtil_DebugPrint("\tPaHostApiTypeId type: %d\n", type );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_HostApiTypeIdToHostApiIndex" );
+    PA_LOGAPI(("\tPaHostApiTypeId type: %d\n", type ));
 
     if( !PA_IS_INITIALISED_ )
     {
@@ -477,13 +442,7 @@
         }
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_HostApiTypeIdToHostApiIndex returned:\n" );
-    if( result < 0 )
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-    else
-        PaUtil_DebugPrint("\tPaHostApiIndex: %d\n\n", result );
-#endif
+    PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( "Pa_HostApiTypeIdToHostApiIndex", "PaHostApiIndex: %d", result );
 
     return result;
 }
@@ -544,9 +503,7 @@
 {
     int result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetHostApiCount called.\n" );
-#endif
+    PA_LOGAPI_ENTER( "Pa_GetHostApiCount" );
 
     if( !PA_IS_INITIALISED_ )
     {
@@ -557,13 +514,7 @@
         result = hostApisCount_;
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetHostApiCount returned:\n" );
-    if( result < 0 )
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-    else
-        PaUtil_DebugPrint("\tPaHostApiIndex %d\n\n", result );
-#endif
+    PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( "Pa_GetHostApiCount", "PaHostApiIndex: %d", result );
 
     return result;
 }
@@ -573,9 +524,7 @@
 {
     int result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetDefaultHostApi called.\n" );
-#endif
+    PA_LOGAPI_ENTER( "Pa_GetDefaultHostApi" );
 
     if( !PA_IS_INITIALISED_ )
     {
@@ -594,13 +543,7 @@
         }
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetDefaultHostApi returned:\n" );
-    if( result < 0 )
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-    else
-        PaUtil_DebugPrint("\tPaHostApiIndex %d\n\n", result );
-#endif
+    PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( "Pa_GetDefaultHostApi", "PaHostApiIndex: %d", result );
 
     return result;
 }
@@ -610,44 +553,36 @@
 {
     PaHostApiInfo *info;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetHostApiInfo called:\n" );
-    PaUtil_DebugPrint("\tPaHostApiIndex hostApi: %d\n", hostApi );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_GetHostApiInfo" );
+    PA_LOGAPI(("\tPaHostApiIndex hostApi: %d\n", hostApi ));
 
     if( !PA_IS_INITIALISED_ )
     {
         info = NULL;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetHostApiInfo returned:\n" );
-        PaUtil_DebugPrint("\tPaHostApiInfo*: NULL [ PortAudio not initialized ]\n\n" );
-#endif
+        PA_LOGAPI(("Pa_GetHostApiInfo returned:\n" ));
+        PA_LOGAPI(("\tPaHostApiInfo*: NULL [ PortAudio not initialized ]\n" ));
 
     }
     else if( hostApi < 0 || hostApi >= hostApisCount_ )
     {
         info = NULL;
         
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetHostApiInfo returned:\n" );
-        PaUtil_DebugPrint("\tPaHostApiInfo*: NULL [ hostApi out of range ]\n\n" );
-#endif
+        PA_LOGAPI(("Pa_GetHostApiInfo returned:\n" ));
+        PA_LOGAPI(("\tPaHostApiInfo*: NULL [ hostApi out of range ]\n" ));
 
     }
     else
     {
         info = &hostApis_[hostApi]->info;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetHostApiInfo returned:\n" );
-        PaUtil_DebugPrint("\tPaHostApiInfo*: 0x%p\n", info );
-        PaUtil_DebugPrint("\t{" );
-        PaUtil_DebugPrint("\t\tint structVersion: %d\n", info->structVersion );
-        PaUtil_DebugPrint("\t\tPaHostApiTypeId type: %d\n", info->type );
-        PaUtil_DebugPrint("\t\tconst char *name: %s\n\n", info->name );
-        PaUtil_DebugPrint("\t}\n\n" );
-#endif
+        PA_LOGAPI(("Pa_GetHostApiInfo returned:\n" ));
+        PA_LOGAPI(("\tPaHostApiInfo*: 0x%p\n", info ));
+        PA_LOGAPI(("\t{\n" ));
+        PA_LOGAPI(("\t\tint structVersion: %d\n", info->structVersion ));
+        PA_LOGAPI(("\t\tPaHostApiTypeId type: %d\n", info->type ));
+        PA_LOGAPI(("\t\tconst char *name: %s\n", info->name ));
+        PA_LOGAPI(("\t}\n" ));
 
     }
 
@@ -659,11 +594,9 @@
 {
     PaDeviceIndex result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_HostApiDeviceIndexToPaDeviceIndex called:\n" );
-    PaUtil_DebugPrint("\tPaHostApiIndex hostApi: %d\n", hostApi );
-    PaUtil_DebugPrint("\tint hostApiDeviceIndex: %d\n", hostApiDeviceIndex );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_HostApiDeviceIndexToPaDeviceIndex" );
+    PA_LOGAPI(("\tPaHostApiIndex hostApi: %d\n", hostApi ));
+    PA_LOGAPI(("\tint hostApiDeviceIndex: %d\n", hostApiDeviceIndex ));
 
     if( !PA_IS_INITIALISED_ )
     {
@@ -689,13 +622,7 @@
         }
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_HostApiDeviceIndexToPaDeviceIndex returned:\n" );
-    if( result < 0 )
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-    else
-        PaUtil_DebugPrint("\tPaDeviceIndex: %d\n\n", result );
-#endif
+    PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( "Pa_HostApiDeviceIndexToPaDeviceIndex", "PaDeviceIndex: %d", result );
 
     return result;
 }
@@ -705,9 +632,7 @@
 {
     PaDeviceIndex result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetDeviceCount called.\n" );
-#endif
+    PA_LOGAPI_ENTER( "Pa_GetDeviceCount" );
 
     if( !PA_IS_INITIALISED_ )
     {
@@ -718,13 +643,7 @@
         result = deviceCount_;
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetDeviceCount returned:\n" );
-    if( result < 0 )
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-    else
-        PaUtil_DebugPrint("\tPaDeviceIndex: %d\n\n", result );
-#endif
+    PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( "Pa_GetDeviceCount", "PaDeviceIndex: %d", result );
 
     return result;
 }
@@ -735,9 +654,7 @@
     PaHostApiIndex hostApi;
     PaDeviceIndex result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetDefaultInputDevice called.\n" );
-#endif
+    PA_LOGAPI_ENTER( "Pa_GetDefaultInputDevice" );
 
     hostApi = Pa_GetDefaultHostApi();
     if( hostApi < 0 )
@@ -749,10 +666,7 @@
         result = hostApis_[hostApi]->info.defaultInputDevice;
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetDefaultInputDevice returned:\n" );
-    PaUtil_DebugPrint("\tPaDeviceIndex: %d\n\n", result );
-#endif
+    PA_LOGAPI_EXIT_T( "Pa_GetDefaultInputDevice", "PaDeviceIndex: %d", result );
 
     return result;
 }
@@ -763,9 +677,7 @@
     PaHostApiIndex hostApi;
     PaDeviceIndex result;
     
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetDefaultOutputDevice called.\n" );
-#endif
+    PA_LOGAPI_ENTER( "Pa_GetDefaultOutputDevice" );
 
     hostApi = Pa_GetDefaultHostApi();
     if( hostApi < 0 )
@@ -777,10 +689,7 @@
         result = hostApis_[hostApi]->info.defaultOutputDevice;
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetDefaultOutputDevice returned:\n" );
-    PaUtil_DebugPrint("\tPaDeviceIndex: %d\n\n", result );
-#endif
+    PA_LOGAPI_EXIT_T( "Pa_GetDefaultOutputDevice", "PaDeviceIndex: %d", result );
 
     return result;
 }
@@ -793,37 +702,31 @@
     PaDeviceInfo *result;
 
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetDeviceInfo called:\n" );
-    PaUtil_DebugPrint("\tPaDeviceIndex device: %d\n", device );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_GetDeviceInfo" );
+    PA_LOGAPI(("\tPaDeviceIndex device: %d\n", device ));
 
     if( hostApiIndex < 0 )
     {
         result = NULL;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetDeviceInfo returned:\n" );
-        PaUtil_DebugPrint("\tPaDeviceInfo* NULL [ invalid device index ]\n\n" );
-#endif
+        PA_LOGAPI(("Pa_GetDeviceInfo returned:\n" ));
+        PA_LOGAPI(("\tPaDeviceInfo* NULL [ invalid device index ]\n" ));
 
     }
     else
     {
         result = hostApis_[hostApiIndex]->deviceInfos[ hostSpecificDeviceIndex ];
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetDeviceInfo returned:\n" );
-        PaUtil_DebugPrint("\tPaDeviceInfo*: 0x%p:\n", result );
-        PaUtil_DebugPrint("\t{\n" );
-
-        PaUtil_DebugPrint("\t\tint structVersion: %d\n", result->structVersion );
-        PaUtil_DebugPrint("\t\tconst char *name: %s\n", result->name );
-        PaUtil_DebugPrint("\t\tPaHostApiIndex hostApi: %d\n", result->hostApi );
-        PaUtil_DebugPrint("\t\tint maxInputChannels: %d\n", result->maxInputChannels );
-        PaUtil_DebugPrint("\t\tint maxOutputChannels: %d\n", result->maxOutputChannels );
-        PaUtil_DebugPrint("\t}\n\n" );
-#endif
+        PA_LOGAPI(("Pa_GetDeviceInfo returned:\n" ));
+        PA_LOGAPI(("\tPaDeviceInfo*: 0x%p:\n", result ));
+        PA_LOGAPI(("\t{\n" ));
+
+        PA_LOGAPI(("\t\tint structVersion: %d\n", result->structVersion ));
+        PA_LOGAPI(("\t\tconst char *name: %s\n", result->name ));
+        PA_LOGAPI(("\t\tPaHostApiIndex hostApi: %d\n", result->hostApi ));
+        PA_LOGAPI(("\t\tint maxInputChannels: %d\n", result->maxInputChannels ));
+        PA_LOGAPI(("\t\tint maxOutputChannels: %d\n", result->maxOutputChannels ));
+        PA_LOGAPI(("\t}\n" ));
 
     }
 
@@ -1089,41 +992,38 @@
 
 
 #ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_IsFormatSupported called:\n" );
+    PA_LOGAPI_ENTER_PARAMS( "Pa_IsFormatSupported" );
 
     if( inputParameters == NULL ){
-        PaUtil_DebugPrint("\tPaStreamParameters *inputParameters: NULL\n" );
+        PA_LOGAPI(("\tPaStreamParameters *inputParameters: NULL\n" ));
     }else{
-        PaUtil_DebugPrint("\tPaStreamParameters *inputParameters: 0x%p\n", inputParameters );
-        PaUtil_DebugPrint("\tPaDeviceIndex inputParameters->device: %d\n", inputParameters->device );
-        PaUtil_DebugPrint("\tint inputParameters->channelCount: %d\n", inputParameters->channelCount );
-        PaUtil_DebugPrint("\tPaSampleFormat inputParameters->sampleFormat: %d\n", inputParameters->sampleFormat );
-        PaUtil_DebugPrint("\tPaTime inputParameters->suggestedLatency: %f\n", inputParameters->suggestedLatency );
-        PaUtil_DebugPrint("\tvoid *inputParameters->hostApiSpecificStreamInfo: 0x%p\n", inputParameters->hostApiSpecificStreamInfo );
+        PA_LOGAPI(("\tPaStreamParameters *inputParameters: 0x%p\n", inputParameters ));
+        PA_LOGAPI(("\tPaDeviceIndex inputParameters->device: %d\n", inputParameters->device ));
+        PA_LOGAPI(("\tint inputParameters->channelCount: %d\n", inputParameters->channelCount ));
+        PA_LOGAPI(("\tPaSampleFormat inputParameters->sampleFormat: %d\n", inputParameters->sampleFormat ));
+        PA_LOGAPI(("\tPaTime inputParameters->suggestedLatency: %f\n", inputParameters->suggestedLatency ));
+        PA_LOGAPI(("\tvoid *inputParameters->hostApiSpecificStreamInfo: 0x%p\n", inputParameters->hostApiSpecificStreamInfo ));
     }
 
     if( outputParameters == NULL ){
-        PaUtil_DebugPrint("\tPaStreamParameters *outputParameters: NULL\n" );
+        PA_LOGAPI(("\tPaStreamParameters *outputParameters: NULL\n" ));
     }else{
-        PaUtil_DebugPrint("\tPaStreamParameters *outputParameters: 0x%p\n", outputParameters );
-        PaUtil_DebugPrint("\tPaDeviceIndex outputParameters->device: %d\n", outputParameters->device );
-        PaUtil_DebugPrint("\tint outputParameters->channelCount: %d\n", outputParameters->channelCount );
-        PaUtil_DebugPrint("\tPaSampleFormat outputParameters->sampleFormat: %d\n", outputParameters->sampleFormat );
-        PaUtil_DebugPrint("\tPaTime outputParameters->suggestedLatency: %f\n", outputParameters->suggestedLatency );
-        PaUtil_DebugPrint("\tvoid *outputParameters->hostApiSpecificStreamInfo: 0x%p\n", outputParameters->hostApiSpecificStreamInfo );
+        PA_LOGAPI(("\tPaStreamParameters *outputParameters: 0x%p\n", outputParameters ));
+        PA_LOGAPI(("\tPaDeviceIndex outputParameters->device: %d\n", outputParameters->device ));
+        PA_LOGAPI(("\tint outputParameters->channelCount: %d\n", outputParameters->channelCount ));
+        PA_LOGAPI(("\tPaSampleFormat outputParameters->sampleFormat: %d\n", outputParameters->sampleFormat ));
+        PA_LOGAPI(("\tPaTime outputParameters->suggestedLatency: %f\n", outputParameters->suggestedLatency ));
+        PA_LOGAPI(("\tvoid *outputParameters->hostApiSpecificStreamInfo: 0x%p\n", outputParameters->hostApiSpecificStreamInfo ));
     }
     
-    PaUtil_DebugPrint("\tdouble sampleRate: %g\n", sampleRate );
+    PA_LOGAPI(("\tdouble sampleRate: %g\n", sampleRate ));
 #endif
 
     if( !PA_IS_INITIALISED_ )
     {
         result = paNotInitialized;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_IsFormatSupported returned:\n" );
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+        PA_LOGAPI_EXIT_PAERROR( "Pa_IsFormatSupported", result );
         return result;
     }
 
@@ -1135,10 +1035,7 @@
                                            &hostApiOutputDevice );
     if( result != paNoError )
     {
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_IsFormatSupported returned:\n" );
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+        PA_LOGAPI_EXIT_PAERROR( "Pa_IsFormatSupported", result );
         return result;
     }
     
@@ -1176,11 +1073,11 @@
                                   sampleRate );
 
 #ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_OpenStream returned:\n" );
+    PA_LOGAPI(("Pa_OpenStream returned:\n" ));
     if( result == paFormatIsSupported )
-        PaUtil_DebugPrint("\tPaError: 0 [ paFormatIsSupported ]\n\n" );
+        PA_LOGAPI(("\tPaError: 0 [ paFormatIsSupported ]\n" ));
     else
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
+        PA_LOGAPI(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
 #endif
 
     return result;
@@ -1204,47 +1101,45 @@
 
 
 #ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_OpenStream called:\n" );
-    PaUtil_DebugPrint("\tPaStream** stream: 0x%p\n", stream );
+    PA_LOGAPI_ENTER_PARAMS( "Pa_OpenStream" );
+    PA_LOGAPI(("\tPaStream** stream: 0x%p\n", stream ));
 
     if( inputParameters == NULL ){
-        PaUtil_DebugPrint("\tPaStreamParameters *inputParameters: NULL\n" );
+        PA_LOGAPI(("\tPaStreamParameters *inputParameters: NULL\n" ));
     }else{
-        PaUtil_DebugPrint("\tPaStreamParameters *inputParameters: 0x%p\n", inputParameters );
-        PaUtil_DebugPrint("\tPaDeviceIndex inputParameters->device: %d\n", inputParameters->device );
-        PaUtil_DebugPrint("\tint inputParameters->channelCount: %d\n", inputParameters->channelCount );
-        PaUtil_DebugPrint("\tPaSampleFormat inputParameters->sampleFormat: %d\n", inputParameters->sampleFormat );
-        PaUtil_DebugPrint("\tPaTime inputParameters->suggestedLatency: %f\n", inputParameters->suggestedLatency );
-        PaUtil_DebugPrint("\tvoid *inputParameters->hostApiSpecificStreamInfo: 0x%p\n", inputParameters->hostApiSpecificStreamInfo );
+        PA_LOGAPI(("\tPaStreamParameters *inputParameters: 0x%p\n", inputParameters ));
+        PA_LOGAPI(("\tPaDeviceIndex inputParameters->device: %d\n", inputParameters->device ));
+        PA_LOGAPI(("\tint inputParameters->channelCount: %d\n", inputParameters->channelCount ));
+        PA_LOGAPI(("\tPaSampleFormat inputParameters->sampleFormat: %d\n", inputParameters->sampleFormat ));
+        PA_LOGAPI(("\tPaTime inputParameters->suggestedLatency: %f\n", inputParameters->suggestedLatency ));
+        PA_LOGAPI(("\tvoid *inputParameters->hostApiSpecificStreamInfo: 0x%p\n", inputParameters->hostApiSpecificStreamInfo ));
     }
 
     if( outputParameters == NULL ){
-        PaUtil_DebugPrint("\tPaStreamParameters *outputParameters: NULL\n" );
+        PA_LOGAPI(("\tPaStreamParameters *outputParameters: NULL\n" ));
     }else{
-        PaUtil_DebugPrint("\tPaStreamParameters *outputParameters: 0x%p\n", outputParameters );
-        PaUtil_DebugPrint("\tPaDeviceIndex outputParameters->device: %d\n", outputParameters->device );
-        PaUtil_DebugPrint("\tint outputParameters->channelCount: %d\n", outputParameters->channelCount );
-        PaUtil_DebugPrint("\tPaSampleFormat outputParameters->sampleFormat: %d\n", outputParameters->sampleFormat );
-        PaUtil_DebugPrint("\tPaTime outputParameters->suggestedLatency: %f\n", outputParameters->suggestedLatency );
-        PaUtil_DebugPrint("\tvoid *outputParameters->hostApiSpecificStreamInfo: 0x%p\n", outputParameters->hostApiSpecificStreamInfo );
+        PA_LOGAPI(("\tPaStreamParameters *outputParameters: 0x%p\n", outputParameters ));
+        PA_LOGAPI(("\tPaDeviceIndex outputParameters->device: %d\n", outputParameters->device ));
+        PA_LOGAPI(("\tint outputParameters->channelCount: %d\n", outputParameters->channelCount ));
+        PA_LOGAPI(("\tPaSampleFormat outputParameters->sampleFormat: %d\n", outputParameters->sampleFormat ));
+        PA_LOGAPI(("\tPaTime outputParameters->suggestedLatency: %f\n", outputParameters->suggestedLatency ));
+        PA_LOGAPI(("\tvoid *outputParameters->hostApiSpecificStreamInfo: 0x%p\n", outputParameters->hostApiSpecificStreamInfo ));
     }
     
-    PaUtil_DebugPrint("\tdouble sampleRate: %g\n", sampleRate );
-    PaUtil_DebugPrint("\tunsigned long framesPerBuffer: %d\n", framesPerBuffer );
-    PaUtil_DebugPrint("\tPaStreamFlags streamFlags: 0x%x\n", streamFlags );
-    PaUtil_DebugPrint("\tPaStreamCallback *streamCallback: 0x%p\n", streamCallback );
-    PaUtil_DebugPrint("\tvoid *userData: 0x%p\n", userData );
+    PA_LOGAPI(("\tdouble sampleRate: %g\n", sampleRate ));
+    PA_LOGAPI(("\tunsigned long framesPerBuffer: %d\n", framesPerBuffer ));
+    PA_LOGAPI(("\tPaStreamFlags streamFlags: 0x%x\n", streamFlags ));
+    PA_LOGAPI(("\tPaStreamCallback *streamCallback: 0x%p\n", streamCallback ));
+    PA_LOGAPI(("\tvoid *userData: 0x%p\n", userData ));
 #endif
 
     if( !PA_IS_INITIALISED_ )
     {
         result = paNotInitialized;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_OpenStream returned:\n" );
-        PaUtil_DebugPrint("\t*(PaStream** stream): undefined\n" );
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+        PA_LOGAPI(("Pa_OpenStream returned:\n" ));
+        PA_LOGAPI(("\t*(PaStream** stream): undefined\n" ));
+        PA_LOGAPI(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
         return result;
     }
 
@@ -1257,11 +1152,9 @@
     {
         result = paBadStreamPtr;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_OpenStream returned:\n" );
-        PaUtil_DebugPrint("\t*(PaStream** stream): undefined\n" );
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+        PA_LOGAPI(("Pa_OpenStream returned:\n" ));
+        PA_LOGAPI(("\t*(PaStream** stream): undefined\n" ));
+        PA_LOGAPI(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
         return result;
     }
 
@@ -1274,11 +1167,9 @@
                                            &hostApiOutputDevice );
     if( result != paNoError )
     {
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_OpenStream returned:\n" );
-        PaUtil_DebugPrint("\t*(PaStream** stream): undefined\n" );
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+        PA_LOGAPI(("Pa_OpenStream returned:\n" ));
+        PA_LOGAPI(("\t*(PaStream** stream): undefined\n" ));
+        PA_LOGAPI(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
         return result;
     }
     
@@ -1319,11 +1210,9 @@
         AddOpenStream( *stream );
 
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_OpenStream returned:\n" );
-    PaUtil_DebugPrint("\t*(PaStream** stream): 0x%p\n", *stream );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI(("Pa_OpenStream returned:\n" ));
+    PA_LOGAPI(("\t*(PaStream** stream): 0x%p\n", *stream ));
+    PA_LOGAPI(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
 
     return result;
 }
@@ -1342,17 +1231,15 @@
     PaStreamParameters hostApiInputParameters, hostApiOutputParameters;
     PaStreamParameters *hostApiInputParametersPtr, *hostApiOutputParametersPtr;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_OpenDefaultStream called:\n" );
-    PaUtil_DebugPrint("\tPaStream** stream: 0x%p\n", stream );
-    PaUtil_DebugPrint("\tint inputChannelCount: %d\n", inputChannelCount );
-    PaUtil_DebugPrint("\tint outputChannelCount: %d\n", outputChannelCount );
-    PaUtil_DebugPrint("\tPaSampleFormat sampleFormat: %d\n", sampleFormat );
-    PaUtil_DebugPrint("\tdouble sampleRate: %g\n", sampleRate );
-    PaUtil_DebugPrint("\tunsigned long framesPerBuffer: %d\n", framesPerBuffer );
-    PaUtil_DebugPrint("\tPaStreamCallback *streamCallback: 0x%p\n", streamCallback );
-    PaUtil_DebugPrint("\tvoid *userData: 0x%p\n", userData );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_OpenDefaultStream" );
+    PA_LOGAPI(("\tPaStream** stream: 0x%p\n", stream ));
+    PA_LOGAPI(("\tint inputChannelCount: %d\n", inputChannelCount ));
+    PA_LOGAPI(("\tint outputChannelCount: %d\n", outputChannelCount ));
+    PA_LOGAPI(("\tPaSampleFormat sampleFormat: %d\n", sampleFormat ));
+    PA_LOGAPI(("\tdouble sampleRate: %g\n", sampleRate ));
+    PA_LOGAPI(("\tunsigned long framesPerBuffer: %d\n", framesPerBuffer ));
+    PA_LOGAPI(("\tPaStreamCallback *streamCallback: 0x%p\n", streamCallback ));
+    PA_LOGAPI(("\tvoid *userData: 0x%p\n", userData ));
 
 
     if( inputChannelCount > 0 )
@@ -1406,11 +1293,9 @@
                  stream, hostApiInputParametersPtr, hostApiOutputParametersPtr,
                  sampleRate, framesPerBuffer, paNoFlag, streamCallback, userData );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_OpenDefaultStream returned:\n" );
-    PaUtil_DebugPrint("\t*(PaStream** stream): 0x%p", *stream );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI(("Pa_OpenDefaultStream returned:\n" ));
+    PA_LOGAPI(("\t*(PaStream** stream): 0x%p", *stream ));
+    PA_LOGAPI(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
 
     return result;
 }
@@ -1434,10 +1319,8 @@
     PaUtilStreamInterface *interface;
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_CloseStream called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_CloseStream" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     /* always remove the open stream from our list, even if this function
         eventually returns an error. Otherwise CloseOpenStreams() will
@@ -1459,10 +1342,7 @@
             result = interface->Close( stream );
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_CloseStream returned:\n" );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI_EXIT_PAERROR( "Pa_CloseStream", result );
 
     return result;
 }
@@ -1472,11 +1352,9 @@
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_SetStreamFinishedCallback called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-    PaUtil_DebugPrint("\tPaStreamFinishedCallback* streamFinishedCallback: 0x%p\n", streamFinishedCallback );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_SetStreamFinishedCallback" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
+    PA_LOGAPI(("\tPaStreamFinishedCallback* streamFinishedCallback: 0x%p\n", streamFinishedCallback ));
 
     if( result == paNoError )
     {
@@ -1492,10 +1370,7 @@
         }
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_SetStreamFinishedCallback returned:\n" );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI_EXIT_PAERROR( "Pa_SetStreamFinishedCallback", result );
 
     return result;
 
@@ -1506,10 +1381,8 @@
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_StartStream called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_StartStream" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( result == paNoError )
     {
@@ -1524,10 +1397,7 @@
         }
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_StartStream returned:\n" );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI_EXIT_PAERROR( "Pa_StartStream", result );
 
     return result;
 }
@@ -1537,10 +1407,8 @@
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_StopStream called\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_StopStream" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( result == paNoError )
     {
@@ -1555,10 +1423,7 @@
         }
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_StopStream returned:\n" );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI_EXIT_PAERROR( "Pa_StopStream", result );
 
     return result;
 }
@@ -1568,10 +1433,8 @@
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_AbortStream called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_AbortStream" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( result == paNoError )
     {
@@ -1586,10 +1449,7 @@
         }
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_AbortStream returned:\n" );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI_EXIT_PAERROR( "Pa_AbortStream", result );
 
     return result;
 }
@@ -1599,18 +1459,13 @@
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_IsStreamStopped called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_IsStreamStopped" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( result == paNoError )
         result = PA_STREAM_INTERFACE(stream)->IsStopped( stream );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_IsStreamStopped returned:\n" );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI_EXIT_PAERROR( "Pa_IsStreamStopped", result );
 
     return result;
 }
@@ -1620,18 +1475,14 @@
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_IsStreamActive called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_IsStreamActive" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( result == paNoError )
         result = PA_STREAM_INTERFACE(stream)->IsActive( stream );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_IsStreamActive returned:\n" );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+
+    PA_LOGAPI_EXIT_PAERROR( "Pa_IsStreamActive", result );
 
     return result;
 }
@@ -1642,36 +1493,30 @@
     PaError error = PaUtil_ValidateStreamPointer( stream );
     const PaStreamInfo *result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetStreamInfo called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_GetStreamInfo" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( error != paNoError )
     {
         result = 0;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetStreamInfo returned:\n" );
-        PaUtil_DebugPrint("\tconst PaStreamInfo*: 0 [PaError error:%d ( %s )]\n\n", result, error, Pa_GetErrorText( error ) );
-#endif
+        PA_LOGAPI(("Pa_GetStreamInfo returned:\n" ));
+        PA_LOGAPI(("\tconst PaStreamInfo*: 0 [PaError error:%d ( %s )]\n", result, error, Pa_GetErrorText( error ) ));
 
     }
     else
     {
         result = &PA_STREAM_REP( stream )->streamInfo;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetStreamInfo returned:\n" );
-        PaUtil_DebugPrint("\tconst PaStreamInfo*: 0x%p:\n", result );
-        PaUtil_DebugPrint("\t{" );
-
-        PaUtil_DebugPrint("\t\tint structVersion: %d\n", result->structVersion );
-        PaUtil_DebugPrint("\t\tPaTime inputLatency: %f\n", result->inputLatency );
-        PaUtil_DebugPrint("\t\tPaTime outputLatency: %f\n", result->outputLatency );
-        PaUtil_DebugPrint("\t\tdouble sampleRate: %f\n", result->sampleRate );
-        PaUtil_DebugPrint("\t}\n\n" );
-#endif
+        PA_LOGAPI(("Pa_GetStreamInfo returned:\n" ));
+        PA_LOGAPI(("\tconst PaStreamInfo*: 0x%p:\n", result ));
+        PA_LOGAPI(("\t{" ));
+
+        PA_LOGAPI(("\t\tint structVersion: %d\n", result->structVersion ));
+        PA_LOGAPI(("\t\tPaTime inputLatency: %f\n", result->inputLatency ));
+        PA_LOGAPI(("\t\tPaTime outputLatency: %f\n", result->outputLatency ));
+        PA_LOGAPI(("\t\tdouble sampleRate: %f\n", result->sampleRate ));
+        PA_LOGAPI(("\t}\n" ));
 
     }
 
@@ -1684,29 +1529,23 @@
     PaError error = PaUtil_ValidateStreamPointer( stream );
     PaTime result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetStreamTime called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_GetStreamTime" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( error != paNoError )
     {
         result = 0;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetStreamTime returned:\n" );
-        PaUtil_DebugPrint("\tPaTime: 0 [PaError error:%d ( %s )]\n\n", result, error, Pa_GetErrorText( error ) );
-#endif
+        PA_LOGAPI(("Pa_GetStreamTime returned:\n" ));
+        PA_LOGAPI(("\tPaTime: 0 [PaError error:%d ( %s )]\n", result, error, Pa_GetErrorText( error ) ));
 
     }
     else
     {
         result = PA_STREAM_INTERFACE(stream)->GetTime( stream );
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetStreamTime returned:\n" );
-        PaUtil_DebugPrint("\tPaTime: %g\n\n", result );
-#endif
+        PA_LOGAPI(("Pa_GetStreamTime returned:\n" ));
+        PA_LOGAPI(("\tPaTime: %g\n", result ));
 
     }
 
@@ -1719,30 +1558,24 @@
     PaError error = PaUtil_ValidateStreamPointer( stream );
     double result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetStreamCpuLoad called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_GetStreamCpuLoad" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( error != paNoError )
     {
 
         result = 0.0;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetStreamCpuLoad returned:\n" );
-        PaUtil_DebugPrint("\tdouble: 0.0 [PaError error: %d ( %s )]\n\n", error, Pa_GetErrorText( error ) );
-#endif
+        PA_LOGAPI(("Pa_GetStreamCpuLoad returned:\n" ));
+        PA_LOGAPI(("\tdouble: 0.0 [PaError error: %d ( %s )]\n", error, Pa_GetErrorText( error ) ));
 
     }
     else
     {
         result = PA_STREAM_INTERFACE(stream)->GetCpuLoad( stream );
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetStreamCpuLoad returned:\n" );
-        PaUtil_DebugPrint("\tdouble: %g\n\n", result );
-#endif
+        PA_LOGAPI(("Pa_GetStreamCpuLoad returned:\n" ));
+        PA_LOGAPI(("\tdouble: %g\n", result ));
 
     }
 
@@ -1756,10 +1589,8 @@
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_ReadStream called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_ReadStream" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( result == paNoError )
     {
@@ -1786,10 +1617,7 @@
         }
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_ReadStream returned:\n" );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI_EXIT_PAERROR( "Pa_ReadStream", result );
 
     return result;
 }
@@ -1801,10 +1629,8 @@
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_WriteStream called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_WriteStream" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( result == paNoError )
     {
@@ -1831,10 +1657,7 @@
         }
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_WriteStream returned:\n" );
-    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI_EXIT_PAERROR( "Pa_WriteStream", result );
 
     return result;
 }
@@ -1844,29 +1667,23 @@
     PaError error = PaUtil_ValidateStreamPointer( stream );
     signed long result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetStreamReadAvailable called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_GetStreamReadAvailable" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( error != paNoError )
     {
         result = 0;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetStreamReadAvailable returned:\n" );
-        PaUtil_DebugPrint("\tunsigned long: 0 [ PaError error: %d ( %s ) ]\n\n", error, Pa_GetErrorText( error ) );
-#endif
+        PA_LOGAPI(("Pa_GetStreamReadAvailable returned:\n" ));
+        PA_LOGAPI(("\tunsigned long: 0 [ PaError error: %d ( %s ) ]\n", error, Pa_GetErrorText( error ) ));
 
     }
     else
     {
         result = PA_STREAM_INTERFACE(stream)->GetReadAvailable( stream );
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetStreamReadAvailable returned:\n" );
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+        PA_LOGAPI(("Pa_GetStreamReadAvailable returned:\n" ));
+        PA_LOGAPI(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
 
     }
 
@@ -1879,29 +1696,23 @@
     PaError error = PaUtil_ValidateStreamPointer( stream );
     signed long result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetStreamWriteAvailable called:\n" );
-    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_GetStreamWriteAvailable" );
+    PA_LOGAPI(("\tPaStream* stream: 0x%p\n", stream ));
 
     if( error != paNoError )
     {
         result = 0;
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetStreamWriteAvailable returned:\n" );
-        PaUtil_DebugPrint("\tunsigned long: 0 [ PaError error: %d ( %s ) ]\n\n", error, Pa_GetErrorText( error ) );
-#endif
+        PA_LOGAPI(("Pa_GetStreamWriteAvailable returned:\n" ));
+        PA_LOGAPI(("\tunsigned long: 0 [ PaError error: %d ( %s ) ]\n", error, Pa_GetErrorText( error ) ));
 
     }
     else
     {
         result = PA_STREAM_INTERFACE(stream)->GetWriteAvailable( stream );
 
-#ifdef PA_LOG_API_CALLS
-        PaUtil_DebugPrint("Pa_GetStreamWriteAvailable returned:\n" );
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+        PA_LOGAPI(("Pa_GetStreamWriteAvailable returned:\n" ));
+        PA_LOGAPI(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
 
     }
 
@@ -1913,10 +1724,8 @@
 {
     int result;
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetSampleSize called:\n" );
-    PaUtil_DebugPrint("\tPaSampleFormat format: %d\n", format );
-#endif
+    PA_LOGAPI_ENTER_PARAMS( "Pa_GetSampleSize" );
+    PA_LOGAPI(("\tPaSampleFormat format: %d\n", format ));
 
     switch( format & ~paNonInterleaved )
     {
@@ -1944,13 +1753,7 @@
         break;
     }
 
-#ifdef PA_LOG_API_CALLS
-    PaUtil_DebugPrint("Pa_GetSampleSize returned:\n" );
-    if( result > 0 )
-        PaUtil_DebugPrint("\tint: %d\n\n", result );
-    else
-        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );
-#endif
+    PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( "Pa_GetSampleSize", "int: %d", result );
 
     return (PaError) result;
 }

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_ringbuffer.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_ringbuffer.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_ringbuffer.c	Mon Aug  4 21:29:58 2008
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_ringbuffer.c 1164 2006-12-21 15:34:50Z bjornroche $
+ * $Id: pa_ringbuffer.c 1240 2007-07-17 13:05:07Z bjornroche $
  * Portable Audio I/O Library
  * Ring Buffer utility.
  *
@@ -71,21 +71,27 @@
  *
  ****************/
 
-#if defined(HAVE_LIBKERN_OSATOMIC_H) && (defined(__APPLE__) || defined(__FreeBSD__))
+#if defined(__APPLE__)
 #   include <libkern/OSAtomic.h>
-    /* Here are the memory barrier functions. Mac OS X and FreeBSD only provide
-       full memory barriers, so the three types of barriers are the same. */
+    /* Here are the memory barrier functions. Mac OS X only provides
+       full memory barriers, so the three types of barriers are the same,
+       however, these barriers are superior to compiler-based ones. */
 #   define PaUtil_FullMemoryBarrier()  OSMemoryBarrier()
 #   define PaUtil_ReadMemoryBarrier()  OSMemoryBarrier()
 #   define PaUtil_WriteMemoryBarrier() OSMemoryBarrier()
 #elif defined(__GNUC__)
-    /* GCC understands volatile asm and "memory" to mean it
+    /* GCC >= 4.1 has built-in intrinsics. We'll use those */
+#   if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
+#      define PaUtil_FullMemoryBarrier()  __sync_synchronize()
+#      define PaUtil_ReadMemoryBarrier()  __sync_synchronize()
+#      define PaUtil_WriteMemoryBarrier() __sync_synchronize()
+    /* as a fallback, GCC understands volatile asm and "memory" to mean it
      * should not reorder memory read/writes */
-#   if defined( __PPC__ )
+#   elif defined( __PPC__ )
 #      define PaUtil_FullMemoryBarrier()  asm volatile("sync":::"memory")
 #      define PaUtil_ReadMemoryBarrier()  asm volatile("sync":::"memory")
 #      define PaUtil_WriteMemoryBarrier() asm volatile("sync":::"memory")
-#   elif defined( __i386__ ) || defined( __i486__ ) || defined( __i586__ ) || defined( __i686__ ) || defined(__x86_64__)
+#   elif defined( __i386__ ) || defined( __i486__ ) || defined( __i586__ ) || defined( __i686__ ) || defined( __x86_64__ )
 #      define PaUtil_FullMemoryBarrier()  asm volatile("mfence":::"memory")
 #      define PaUtil_ReadMemoryBarrier()  asm volatile("lfence":::"memory")
 #      define PaUtil_WriteMemoryBarrier() asm volatile("sfence":::"memory")

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_util.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_util.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/common/pa_util.h	Mon Aug  4 21:29:58 2008
@@ -1,7 +1,7 @@
 #ifndef PA_UTIL_H
 #define PA_UTIL_H
 /*
- * $Id: pa_util.h 1097 2006-08-26 08:27:53Z rossb $
+ * $Id: pa_util.h 1229 2007-06-15 16:11:11Z rossb $
  * Portable Audio I/O Library implementation utilities header
  * common implementation utilities and interfaces
  *
@@ -113,23 +113,6 @@
 
 
         
-/** PA_DEBUG() provides a simple debug message printing facility. The macro
- passes it's argument to a printf-like function called PaUtil_DebugPrint()
- which prints to stderr and always flushes the stream after printing.
- Because preprocessor macros cannot directly accept variable length argument
- lists, calls to the macro must include an additional set of parenthesis, eg:
- PA_DEBUG(("errorno: %d", 1001 ));
-*/
-
-void PaUtil_DebugPrint( const char *format, ... );
-
-#ifdef PA_ENABLE_DEBUG_OUTPUT
-#define PA_DEBUG(x) PaUtil_DebugPrint x ;
-#else
-#define PA_DEBUG(x)
-#endif
-
-
 /* the following functions are implemented in a platform platform specific
  .c file
 */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/alsa/pa_linux_alsa.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/alsa/pa_linux_alsa.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/alsa/pa_linux_alsa.c	Mon Aug  4 21:29:58 2008
@@ -1,11 +1,11 @@
 /*
- * $Id: pa_linux_alsa.c 1161 2006-12-17 16:16:13Z aknudsen $
+ * $Id: pa_linux_alsa.c 1278 2007-09-12 17:39:48Z aknudsen $
  * PortAudio Portable Real-Time Audio Library
  * Latest Version at: http://www.portaudio.com
  * ALSA implementation by Joshua Haberman and Arve Knudsen
  *
  * Copyright (c) 2002 Joshua Haberman <joshua at haberman.com>
- * Copyright (c) 2005-2006 Arve Knudsen <aknuds-1 at broadpark.no>
+ * Copyright (c) 2005-2007 Arve Knudsen <aknuds-1 at broadpark.no>
  *
  * Based on the Open Source API proposed by Ross Bencina
  * Copyright (c) 1999-2002 Ross Bencina, Phil Burk
@@ -70,6 +70,8 @@
 #include "pa_stream.h"
 #include "pa_cpuload.h"
 #include "pa_process.h"
+#include "pa_endianness.h"
+#include "pa_debugprint.h"
 
 #include "pa_linux_alsa.h"
 
@@ -96,6 +98,13 @@
     assert( success == aErr_ );
 
 static int aErr_;               /* Used with ENSURE_ */
+static int numPeriods_ = 4;
+
+int PaAlsa_SetNumPeriods( int numPeriods )
+{
+    numPeriods_ = numPeriods;
+    return paNoError;
+}
 
 typedef enum
 {
@@ -520,14 +529,19 @@
     return 0;
 }
 
-/* Wrapper around snd_pcm_open which repeatedly retries opening a device for up to a second
- * if it is busy. This is because dmix may temporarily hold on to a device after it (dmix)
- * has been opened and closed. */
-static int OpenPcm( snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode )
+/** Open PCM device.
+ *
+ * Wrapper around snd_pcm_open which may repeatedly retry opening a device if it is busy, for
+ * a certain time. This is because dmix may temporarily hold on to a device after it (dmix)
+ * has been opened and closed.
+ * @param mode: Open mode (e.g., SND_PCM_BLOCKING).
+ * @param waitOnBusy: Retry opening busy device for up to one second?
+ **/
+static int OpenPcm( snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode, int waitOnBusy )
 {
-    int tries = 0;
+    int tries = 0, maxTries = waitOnBusy ? 100 : 0;
     int ret = snd_pcm_open( pcmp, name, stream, mode );
-    for( tries = 0; tries < 100 && -EBUSY == ret; ++tries )
+    for( tries = 0; tries < maxTries && -EBUSY == ret; ++tries )
     {
         Pa_Sleep( 10 );
         ret = snd_pcm_open( pcmp, name, stream, mode );
@@ -539,8 +553,8 @@
     }
     if( -EBUSY == ret )
     {
-        PA_DEBUG(( "%s: Failed to open busy device\n",
-                    __FUNCTION__ ));
+        PA_DEBUG(( "%s: Failed to open busy device '%s'\n",
+                    __FUNCTION__, name ));
     }
 
     return ret;
@@ -563,7 +577,7 @@
 
     /* Query capture */
     if( deviceName->hasCapture &&
-            OpenPcm( &pcm, deviceName->alsaName, SND_PCM_STREAM_CAPTURE, blocking )
+            OpenPcm( &pcm, deviceName->alsaName, SND_PCM_STREAM_CAPTURE, blocking, 0 )
             >= 0 )
     {
         if( GropeDevice( pcm, deviceName->isPlug, StreamDirection_In, blocking, devInfo,
@@ -577,7 +591,7 @@
 
     /* Query playback */
     if( deviceName->hasPlayback &&
-            OpenPcm( &pcm, deviceName->alsaName, SND_PCM_STREAM_PLAYBACK, blocking )
+            OpenPcm( &pcm, deviceName->alsaName, SND_PCM_STREAM_PLAYBACK, blocking, 0 )
             >= 0 )
     {
         if( GropeDevice( pcm, deviceName->isPlug, StreamDirection_Out, blocking, devInfo,
@@ -607,8 +621,12 @@
     if( baseDeviceInfo->maxInputChannels > 0 || baseDeviceInfo->maxOutputChannels > 0 )
     {
         /* Make device default if there isn't already one or it is the ALSA "default" device */
-        if( baseApi->info.defaultInputDevice == paNoDevice && baseDeviceInfo->maxInputChannels > 0 )
+        if( (baseApi->info.defaultInputDevice == paNoDevice || !strcmp(deviceName->alsaName,
+                        "default" )) && baseDeviceInfo->maxInputChannels > 0 )
+        {
             baseApi->info.defaultInputDevice = *devIdx;
+            PA_DEBUG(("Default input device: %s\n", deviceName->name));
+        }
         if( (baseApi->info.defaultOutputDevice == paNoDevice || !strcmp(deviceName->alsaName,
                         "default" )) && baseDeviceInfo->maxOutputChannels > 0 )
         {
@@ -639,6 +657,10 @@
     int res;
     int blocking = SND_PCM_NONBLOCK;
     char alsaCardName[50];
+#ifdef PA_ENABLE_DEBUG_OUTPUT
+    PaTime startTime = PaUtil_GetTime();
+#endif
+
     if( getenv( "PA_ALSA_INITIALIZE_BLOCK" ) && atoi( getenv( "PA_ALSA_INITIALIZE_BLOCK" ) ) )
         blocking = 0;
 
@@ -820,6 +842,11 @@
 
     /* Loop over list of cards, filling in info. If a device is deemed unavailable (can't get name),
      * it's ignored.
+     *
+     * Note that we do this in two stages. This is a workaround owing to the fact that the 'dmix'
+     * plugin may cause the underlying hardware device to be busy for a short while even after it
+     * (dmix) is closed. The 'default' plugin may also point to the dmix plugin, so the same goes
+     * for this.
      */
 
     for( i = 0, devIdx = 0; i < numDeviceNames; ++i )
@@ -834,6 +861,7 @@
         PA_ENSURE( FillInDevInfo( alsaApi, hwInfo, blocking, devInfo, &devIdx ) );
     }
     assert( devIdx < numDeviceNames );
+    /* Now inspect 'dmix' and 'default' plugins */
     for( i = 0; i < numDeviceNames; ++i )
     {
         PaAlsaDeviceInfo* devInfo = &deviceInfoArray[i];
@@ -850,6 +878,10 @@
 
     baseApi->info.deviceCount = devIdx;   /* Number of successfully queried devices */
 
+#ifdef PA_ENABLE_DEBUG_OUTPUT
+    PA_DEBUG(( "%s: Building device list took %f seconds\n", __FUNCTION__, PaUtil_GetTime() - startTime ));
+#endif
+
 end:
     return result;
 
@@ -910,8 +942,13 @@
     if( snd_pcm_hw_params_test_format( pcm, hwParams, SND_PCM_FORMAT_S32 ) >= 0)
         available |= paInt32;
 
-    if( snd_pcm_hw_params_test_format( pcm, hwParams, SND_PCM_FORMAT_S24 ) >= 0)
+#ifdef PA_LITTLE_ENDIAN
+    if( snd_pcm_hw_params_test_format( pcm, hwParams, SND_PCM_FORMAT_S24_3LE ) >= 0)
         available |= paInt24;
+#elif defined PA_BIG_ENDIAN
+    if( snd_pcm_hw_params_test_format( pcm, hwParams, SND_PCM_FORMAT_S24_3BE ) >= 0)
+        available |= paInt24;
+#endif
 
     if( snd_pcm_hw_params_test_format( pcm, hwParams, SND_PCM_FORMAT_S16 ) >= 0)
         available |= paInt16;
@@ -936,7 +973,11 @@
             return SND_PCM_FORMAT_S16;
 
         case paInt24:
-            return SND_PCM_FORMAT_S24;
+#ifdef PA_LITTLE_ENDIAN
+            return SND_PCM_FORMAT_S24_3LE;
+#elif defined PA_BIG_ENDIAN
+            return SND_PCM_FORMAT_S24_3BE;
+#endif
 
         case paInt32:
             return SND_PCM_FORMAT_S32;
@@ -986,14 +1027,10 @@
 
     PA_DEBUG(( "%s: Opening device %s\n", __FUNCTION__, deviceName ));
     if( (ret = OpenPcm( pcm, deviceName, streamDir == StreamDirection_In ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK,
-                    SND_PCM_NONBLOCK )) < 0 )
+                    SND_PCM_NONBLOCK, 1 )) < 0 )
     {
         /* Not to be closed */
         *pcm = NULL;
-        if( -EBUSY == ret )
-        {
-            PA_DEBUG(( "%s: Device is busy\n", __FUNCTION__ ));
-        }
         ENSURE_( ret, -EBUSY == ret ? paDeviceUnavailable : paBadIODeviceCombination );
     }
     ENSURE_( snd_pcm_nonblock( *pcm, 0 ), paUnanticipatedHostError );
@@ -1287,14 +1324,25 @@
 
     snd_pcm_sw_params_alloca( &swParams );
 
-    bufSz = (params->suggestedLatency * sampleRate) + self->framesPerBuffer;    /* One period does not count as latency */
+    bufSz = params->suggestedLatency * sampleRate;
     ENSURE_( snd_pcm_hw_params_set_buffer_size_near( self->pcm, hwParams, &bufSz ), paUnanticipatedHostError );
 
     /* Set the parameters! */
-    ENSURE_( snd_pcm_hw_params( self->pcm, hwParams ), paUnanticipatedHostError );
+    {
+        int r = snd_pcm_hw_params( self->pcm, hwParams );
+#ifdef PA_ENABLE_DEBUG_OUTPUT
+        if( r < 0 )
+        {
+            snd_output_t *output = NULL;
+            snd_output_stdio_attach( &output, stderr, 0 );
+            snd_pcm_hw_params_dump( hwParams, output );
+        }
+#endif
+        ENSURE_(r, paUnanticipatedHostError );
+    }
     ENSURE_( snd_pcm_hw_params_get_buffer_size( hwParams, &self->bufferSize ), paUnanticipatedHostError );
-    /* Latency in seconds, one period is not counted as latency */
-    *latency = (self->bufferSize - self->framesPerBuffer) / sampleRate;
+    /* Latency in seconds */
+    *latency = self->bufferSize / sampleRate;
 
     /* Now software parameters... */
     ENSURE_( snd_pcm_sw_params_current( self->pcm, swParams ), paUnanticipatedHostError );
@@ -1473,20 +1521,19 @@
         }
     }
 
-    /* Using 5 as a base number of periods, we try to approximate the suggested latency (+1 period),
+    /* Using the base number of periods, we try to approximate the suggested latency (+1 period),
        finding a combination of period/buffer size which best fits these constraints */
     {
-        unsigned numPeriods = 4, maxPeriods = 0;
+        unsigned numPeriods = numPeriods_, maxPeriods = 0;
         /* It may be that the device only supports 2 periods for instance */
         dir = 0;
         ENSURE_( snd_pcm_hw_params_get_periods_max( hwParams, &maxPeriods, &dir ), paUnanticipatedHostError );
         assert( maxPeriods > 1 );
-        /* One period is not counted as latency */
-        maxPeriods -= 1;
         numPeriods = PA_MIN( maxPeriods, numPeriods );
 
         if( framesPerUserBuffer != paFramesPerBufferUnspecified )
         {
+            /* Try to get a power-of-two of the user buffer size. */
             framesPerHostBuffer = framesPerUserBuffer;
             if( framesPerHostBuffer < bufferSize )
             {
@@ -1494,6 +1541,11 @@
                 {
                     framesPerHostBuffer *= 2;
                 }
+                /* One extra period is preferrable to one less (should be more robust) */
+                if( bufferSize / framesPerHostBuffer < numPeriods )
+                {
+                    framesPerHostBuffer /= 2;
+                }
             }
             else
             {
@@ -1614,15 +1666,15 @@
     unsigned long framesPerHostBuffer = 0;
     int dir = 0;
     int accurate = 1;
+    unsigned numPeriods = numPeriods_;
 
     if( self->capture.pcm && self->playback.pcm )
     {
         if( framesPerUserBuffer == paFramesPerBufferUnspecified )
         {
-            snd_pcm_uframes_t desiredLatency, e, minPeriodSize, maxPeriodSize, optimalPeriodSize, periodSize,
-                              minCapture, minPlayback, maxCapture, maxPlayback;
-
             /* Come up with a common desired latency */
+            snd_pcm_uframes_t desiredBufSz, e, minPeriodSize, maxPeriodSize, optimalPeriodSize, periodSize,
+                              minCapture, minPlayback, maxCapture, maxPlayback;
 
             dir = 0;
             ENSURE_( snd_pcm_hw_params_get_period_size_min( hwParamsCapture, &minCapture, &dir ), paUnanticipatedHostError );
@@ -1636,9 +1688,9 @@
             maxPeriodSize = PA_MIN( maxPlayback, maxCapture );
             PA_UNLESS( minPeriodSize <= maxPeriodSize, paBadIODeviceCombination );
 
-            desiredLatency = (snd_pcm_uframes_t)(PA_MIN( outputParameters->suggestedLatency, inputParameters->suggestedLatency )
+            desiredBufSz = (snd_pcm_uframes_t)(PA_MIN( outputParameters->suggestedLatency, inputParameters->suggestedLatency )
                     * sampleRate);
-            /* Clamp desiredLatency */
+            /* Clamp desiredBufSz */
             {
                 snd_pcm_uframes_t maxBufferSize;
                 snd_pcm_uframes_t maxBufferSizeCapture, maxBufferSizePlayback;
@@ -1646,7 +1698,7 @@
                 ENSURE_( snd_pcm_hw_params_get_buffer_size_max( hwParamsPlayback, &maxBufferSizePlayback ), paUnanticipatedHostError );
                 maxBufferSize = PA_MIN( maxBufferSizeCapture, maxBufferSizePlayback );
 
-                desiredLatency = PA_MIN( desiredLatency, maxBufferSize );
+                desiredBufSz = PA_MIN( desiredBufSz, maxBufferSize );
             }
 
             /* Find the closest power of 2 */
@@ -1659,13 +1711,15 @@
             {
                 if( snd_pcm_hw_params_test_period_size( self->playback.pcm, hwParamsPlayback, periodSize, 0 ) >= 0 &&
                         snd_pcm_hw_params_test_period_size( self->capture.pcm, hwParamsCapture, periodSize, 0 ) >= 0 )
-                    break;  /* Ok! */
+                {
+                    /* OK! */
+                    break;
+                }
 
                 periodSize *= 2;
             }
 
-            /* 4 periods considered optimal */
-            optimalPeriodSize = PA_MAX( desiredLatency / 4, minPeriodSize );
+            optimalPeriodSize = PA_MAX( desiredBufSz / numPeriods, minPeriodSize );
             optimalPeriodSize = PA_MIN( optimalPeriodSize, maxPeriodSize );
 
             /* Find the closest power of 2 */
@@ -1676,12 +1730,15 @@
 
             while( optimalPeriodSize >= periodSize )
             {
-                if( snd_pcm_hw_params_test_period_size( self->capture.pcm, hwParamsCapture, optimalPeriodSize, 0 ) < 0 )
-                    continue;
-                if( snd_pcm_hw_params_test_period_size( self->playback.pcm, hwParamsPlayback, optimalPeriodSize, 0 ) >= 0 )
+                if( snd_pcm_hw_params_test_period_size( self->capture.pcm, hwParamsCapture, optimalPeriodSize, 0 )
+                        >= 0 && snd_pcm_hw_params_test_period_size( self->playback.pcm, hwParamsPlayback,
+                            optimalPeriodSize, 0 ) >= 0 )
+                {
                     break;
+                }
                 optimalPeriodSize /= 2;
             }
+        
             if( optimalPeriodSize > periodSize )
                 periodSize = optimalPeriodSize;
 
@@ -1698,7 +1755,7 @@
             else
             {
                 /* Unable to find a common period size, oh well */
-                optimalPeriodSize = PA_MAX( desiredLatency / 4, minPeriodSize );
+                optimalPeriodSize = PA_MAX( desiredBufSz / numPeriods, minPeriodSize );
                 optimalPeriodSize = PA_MIN( optimalPeriodSize, maxPeriodSize );
 
                 self->capture.framesPerBuffer = optimalPeriodSize;
@@ -1726,7 +1783,7 @@
 
             dir = 0;
             ENSURE_( snd_pcm_hw_params_get_periods_max( hwParamsPlayback, &maxPeriods, &dir ), paUnanticipatedHostError );
-            if( maxPeriods < 4 )
+            if( maxPeriods < numPeriods )
             {
                 /* The playback component is trickier to get right, try that first */
                 first = &self->playback;
@@ -2102,7 +2159,9 @@
 static PaError AlsaStop( PaAlsaStream *stream, int abort )
 {
     PaError result = paNoError;
-    /* XXX: Seems that draining the dmix device may trigger a race condition in ALSA */
+    /* XXX: snd_pcm_drain tends to lock up, avoid it until we find out more */
+    abort = 1;
+    /*
     if( stream->capture.pcm && !strcmp( Pa_GetDeviceInfo( stream->capture.device )->name,
                 "dmix" ) )
     {
@@ -2113,6 +2172,7 @@
     {
         abort = 1;
     }
+    */
 
     if( abort )
     {
@@ -3448,7 +3508,6 @@
 
 /* Extensions */
 
-/** Initialize host API specific structure, call this before setting relevant attributes. */
 void PaAlsa_InitializeStreamInfo( PaAlsaStreamInfo *info )
 {
     info->size = sizeof (PaAlsaStreamInfo);
@@ -3457,11 +3516,6 @@
     info->deviceString = NULL;
 }
 
-/** Instruct whether to enable real-time priority when starting the audio thread.
- *
- * If this is turned on by the stream is started, the audio callback thread will be created
- * with the FIFO scheduling policy, which is suitable for realtime operation.
- **/
 void PaAlsa_EnableRealtimeScheduling( PaStream *s, int enable )
 {
     PaAlsaStream *stream = (PaAlsaStream *) s;
@@ -3476,7 +3530,6 @@
 }
 #endif
 
-/** Get the ALSA-lib card index of this stream's input device. */
 PaError PaAlsa_GetStreamInputCard(PaStream* s, int* card) {
     PaAlsaStream *stream = (PaAlsaStream *) s;
     snd_pcm_info_t* pcmInfo;
@@ -3493,7 +3546,6 @@
     return result;
 }
 
-/** Get the ALSA-lib card index of this stream's output device. */
 PaError PaAlsa_GetStreamOutputCard(PaStream* s, int* card) {
     PaAlsaStream *stream = (PaAlsaStream *) s;
     snd_pcm_info_t* pcmInfo;

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/asihpi/pa_linux_asihpi.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/asihpi/pa_linux_asihpi.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/asihpi/pa_linux_asihpi.c	Mon Aug  4 21:29:58 2008
@@ -1,10 +1,10 @@
 /*
  * PortAudio Portable Real-Time Audio Library
  * Latest Version at: http://www.portaudio.com
- * 
+ *
  * PortAudio v18 version of AudioScience HPI driver by Fred Gleason <fredg at salemradiolabs.com>
  * PortAudio v19 version of AudioScience HPI driver by Ludwig Schwardt <schwardt at sun.ac.za>
- * 
+ *
  * Copyright (c) 2003 Fred Gleason
  * Copyright (c) 2005,2006 Ludwig Schwardt
  *
@@ -29,13 +29,13 @@
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -47,45 +47,45 @@
 
 /** @file
  @ingroup hostapi_src
- @brief Host API implementation supporting AudioScience cards 
+ @brief Host API implementation supporting AudioScience cards
         via the Linux HPI interface.
- 
+
  <h3>Overview</h3>
- 
+
  This is a PortAudio implementation for the AudioScience HPI Audio API
  on the Linux platform. AudioScience makes a range of audio adapters customised
  for the broadcasting industry, with support for both Windows and Linux.
  More information on their products can be found on their website:
- 
+
      http://www.audioscience.com
- 
+
  Documentation for the HPI API can be found at:
- 
+
      http://www.audioscience.com/internet/download/sdk/spchpi.pdf
- 
+
  The Linux HPI driver itself (a kernel module + library) can be downloaded from:
- 
+
      http://www.audioscience.com/internet/download/linux_drivers.htm
- 
+
  <h3>Implementation strategy</h3>
- 
- *Note* Ideally, AudioScience cards should be handled by the PortAudio ALSA 
+
+ *Note* Ideally, AudioScience cards should be handled by the PortAudio ALSA
  implementation on Linux, as ALSA is the preferred Linux soundcard API. The existence
- of this host API implementation might therefore seem a bit flawed. Unfortunately, at 
- the time of the creation of this implementation (June 2006), the PA ALSA implementation 
- could not make use of the existing AudioScience ALSA driver. PA ALSA uses the 
- "memory-mapped" (mmap) ALSA access mode to interact with the ALSA library, while the 
+ of this host API implementation might therefore seem a bit flawed. Unfortunately, at
+ the time of the creation of this implementation (June 2006), the PA ALSA implementation
+ could not make use of the existing AudioScience ALSA driver. PA ALSA uses the
+ "memory-mapped" (mmap) ALSA access mode to interact with the ALSA library, while the
  AudioScience ALSA driver only supports the "read-write" access mode. The appropriate
  solution to this problem is to add "read-write" support to PortAudio ALSA, thereby
  extending the range of soundcards it supports (AudioScience cards are not the only
- ones with this problem). Given the author's limited knowledge of ALSA and the 
+ ones with this problem). Given the author's limited knowledge of ALSA and the
  simplicity of the HPI API, the second-best solution was born...
- 
+
  The following mapping between HPI and PA was followed:
  HPI subsystem => PortAudio host API
  HPI adapter => nothing specific
  HPI stream => PortAudio device
- 
+
  Each HPI stream is either input or output (not both), and can support
  different channel counts, sampling rates and sample formats. It is therefore
  a more natural fit to a PA device. A PA stream can therefore combine two
@@ -93,19 +93,19 @@
  HPI streams can even be on different physical adapters. The two streams ought to be
  sample-synchronised when they reside on the same adapter, as most AudioScience adapters
  derive their ADC and DAC clocks from one master clock. When combining two adapters
- into one full-duplex stream, however, the use of a word clock connection between the 
+ into one full-duplex stream, however, the use of a word clock connection between the
  adapters is strongly recommended.
-  
+
  The HPI interface is inherently blocking, making use of read and write calls to
  transfer data between user buffers and driver buffers. The callback interface therefore
  requires a helper thread ("callback engine") which periodically transfers data (one thread
- per PA stream, in fact). The current implementation explicitly sleeps via Pa_Sleep() until 
- enough samples can be transferred (select() or poll() would be better, but currently seems 
+ per PA stream, in fact). The current implementation explicitly sleeps via Pa_Sleep() until
+ enough samples can be transferred (select() or poll() would be better, but currently seems
  impossible...). The thread implementation makes use of the Unix thread helper functions
- and some pthread calls here and there. If a unified PA thread exists, this host API 
- implementation might also compile on Windows, as this is the only real Linux-specific 
+ and some pthread calls here and there. If a unified PA thread exists, this host API
+ implementation might also compile on Windows, as this is the only real Linux-specific
  part of the code.
- 
+
  There is no inherent fixed buffer size in the HPI interface, as in some other host APIs.
  The PortAudio implementation contains a buffer that is allocated during OpenStream and
  used to transfer data between the callback and the HPI driver buffer. The size of this
@@ -113,28 +113,28 @@
  requested callback buffer size as far as possible. It can become quite huge, as the
  AudioScience cards are typically geared towards higher-latency applications and contain
  large hardware buffers.
- 
+
  The HPI interface natively supports most common sample formats and sample rates (some
  conversion is done on the adapter itself).
- 
+
  Stream time is measured based on the number of processed frames, which is adjusted by the
  number of frames currently buffered by the HPI driver.
- 
+
  There is basic support for detecting overflow and underflow. The HPI interface does not
  explicitly indicate this, so thresholds on buffer levels are used in combination with
  stream state. Recovery from overflow and underflow is left to the PA client.
- 
+
  Blocking streams are also implemented. It makes use of the same polling routines that
  the callback interface uses, in order to prevent the allocation of variable-sized
- buffers during reading and writing. The framesPerBuffer parameter is therefore still 
+ buffers during reading and writing. The framesPerBuffer parameter is therefore still
  relevant, and this can be increased in the blocking case to improve efficiency.
- 
+
  The implementation contains extensive reporting macros (slightly modified PA_ENSURE and
  PA_UNLESS versions) and a useful stream dump routine to provide debugging feedback.
- 
+
  Output buffer priming via the user callback (i.e. paPrimeOutputBuffersUsingStreamCallback
  and friends) is not implemented yet. All output is primed with silence.
- 
+
  Please send bug reports etc. to Ludwig Schwardt <schwardt at sun.ac.za>
  */
 
@@ -157,6 +157,7 @@
 #include "pa_cpuload.h"      /* CPU load measurer */
 #include "pa_process.h"      /* Buffer processor */
 #include "pa_converters.h"   /* PaUtilZeroer */
+#include "pa_debugprint.h"
 
 /* -------------------------------------------------------------------------- */
 
@@ -305,9 +306,9 @@
  during the Active state of PortAudio (due to underruns) and also during CallBackFinished in
  the case of an output stream. Similarly, HPI_STATE_STOPPED mostly coincides with the Stopped
  PortAudio state, by may also occur in the CallbackFinished state when recording is finished.
- 
+
  Here is a rough match-up:
- 
+
  PortAudio state   =>     HPI state
  ---------------          ---------
  Active            =>     HPI_STATE_RECORDING, HPI_STATE_PLAYING, (HPI_STATE_DRAINED)
@@ -328,7 +329,7 @@
     /** Device information (HPI handles, etc) */
     PaAsiHpiDeviceInfo *hpiDevice;
     /** Stream handle, as passed to HPI interface.
-     HACK: we assume types HPI_HISTREAM and HPI_HOSTREAM are the same... 
+     HACK: we assume types HPI_HISTREAM and HPI_HOSTREAM are the same...
      (both are HW32 up to version 3.00 of ASIHPI, and hopefully they stay that way) */
     HPI_HISTREAM hpiStream;
     /** Stream format, as passed to HPI interface */
@@ -377,7 +378,7 @@
     int neverDropInput;
     /** Contains copy of user buffers, used by blocking interface to transfer non-interleaved data.
      It went here instead of to each stream component, as the stream component buffer setup in
-     PaAsiHpi_SetupBuffers doesn't know the stream details such as callbackMode. 
+     PaAsiHpi_SetupBuffers doesn't know the stream details such as callbackMode.
      (Maybe a problem later if ReadStream and WriteStream happens concurrently on same stream.) */
     void **blockingUserBufferCopy;
 
@@ -408,7 +409,7 @@
     /** Number of frames played/recorded since last stream reset */
     HW32 frameCounter;
     /** Amount of data (in bytes) in hardware (on-card) buffer.
-     This differs from dataSize if bus mastering (BBM) is used, which introduces another 
+     This differs from dataSize if bus mastering (BBM) is used, which introduces another
      driver-level buffer to which dataSize/bufferSize then refers. */
     HW32 auxDataSize;
     /** Total number of data frames currently buffered by HPI driver (host + hw buffers) */
@@ -517,9 +518,9 @@
  This compiles a list of all HPI adapters, and registers a PA device for each input and
  output stream it finds. Most errors are ignored, as missing or erroneous devices are
  simply skipped.
- 
+
  @param hpiHostApi Pointer to HPI host API struct
- 
+
  @return PortAudio error code (only paInsufficientMemory in practice)
  */
 static PaError PaAsiHpi_BuildDeviceList( PaAsiHpiHostApiRepresentation *hpiHostApi )
@@ -726,11 +727,11 @@
  This is the only function exported beyond this file. It is called by PortAudio to initialize
  the host API. It stores API info, finds and registers all devices, and sets up callback and
  blocking interfaces.
- 
+
  @param hostApi Pointer to host API struct
- 
+
  @param hostApiIndex Index of current (HPI) host API
- 
+
  @return PortAudio error code
  */
 PaError PaAsiHpi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex )
@@ -807,7 +808,7 @@
 /** Terminate host API implementation.
  This closes all HPI adapters and frees the HPI subsystem. It also frees the host API struct
  memory. It should be called once for every PaAsiHpi_Initialize call.
- 
+
  @param Pointer to host API struct
  */
 static void Terminate( struct PaUtilHostApiRepresentation *hostApi )
@@ -853,9 +854,9 @@
 
 
 /** Converts PortAudio sample format to equivalent HPI format.
- 
+
  @param paFormat PortAudio sample format
- 
+
  @return HPI sample format
  */
 static HW16 PaAsiHpi_PaToHpiFormat( PaSampleFormat paFormat )
@@ -887,9 +888,9 @@
 
 
 /** Converts HPI sample format to equivalent PortAudio format.
- 
+
  @param paFormat HPI sample format
- 
+
  @return PortAudio sample format
  */
 static PaSampleFormat PaAsiHpi_HpiToPaFormat( HW16 hpiFormat )
@@ -919,20 +920,20 @@
 
 
 /** Creates HPI format struct based on PortAudio parameters.
- This also does some checks to see whether the desired format is valid, and whether 
+ This also does some checks to see whether the desired format is valid, and whether
  the device allows it. This only checks the format of one half (input or output) of the
  PortAudio stream.
- 
+
  @param hostApi Pointer to host API struct
- 
+
  @param parameters Pointer to stream parameter struct
- 
+
  @param sampleRate Desired sample rate
- 
+
  @param hpiDevice Pointer to HPI device struct
- 
+
  @param hpiFormat Resulting HPI format returned here
-  
+
  @return PortAudio error code (typically indicating a problem with stream format)
  */
 static PaError PaAsiHpi_CreateFormat( struct PaUtilHostApiRepresentation *hostApi,
@@ -1005,13 +1006,13 @@
 /** Open HPI input stream with given format.
  This attempts to open HPI input stream with desired format. If the format is not supported
  or the device is unavailable, the stream is closed and a PortAudio error code is returned.
- 
+
  @param hostApi Pointer to host API struct
- 
+
  @param hpiDevice Pointer to HPI device struct
- 
+
  @param hpiFormat Pointer to HPI format struct
-  
+
  @return PortAudio error code (typically indicating a problem with stream format or device)
 */
 static PaError PaAsiHpi_OpenInput( struct PaUtilHostApiRepresentation *hostApi,
@@ -1060,13 +1061,13 @@
 /** Open HPI output stream with given format.
  This attempts to open HPI output stream with desired format. If the format is not supported
  or the device is unavailable, the stream is closed and a PortAudio error code is returned.
- 
+
  @param hostApi Pointer to host API struct
- 
+
  @param hpiDevice Pointer to HPI device struct
- 
+
  @param hpiFormat Pointer to HPI format struct
-  
+
  @return PortAudio error code (typically indicating a problem with stream format or device)
 */
 static PaError PaAsiHpi_OpenOutput( struct PaUtilHostApiRepresentation *hostApi,
@@ -1115,15 +1116,15 @@
 /** Checks whether the desired stream formats and devices are supported
  (for both input and output).
  This is done by actually opening the appropriate HPI streams and closing them again.
- 
+
  @param hostApi Pointer to host API struct
-  
+
  @param inputParameters Pointer to stream parameter struct for input side of stream
- 
+
  @param outputParameters Pointer to stream parameter struct for output side of stream
- 
+
  @param sampleRate Desired sample rate
- 
+
  @return PortAudio error code (paFormatIsSupported on success)
  */
 static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
@@ -1177,11 +1178,11 @@
 /** Obtain HPI stream information.
  This obtains info such as stream state and available data/space in buffers. It also
  estimates whether an underflow or overflow occurred.
- 
+
  @param streamComp Pointer to stream component (input or output) to query
- 
+
  @param info Pointer to stream info struct that will contain result
-  
+
  @return PortAudio error code (either paNoError, paDeviceUnavailable or paUnanticipatedHostError)
  */
 static PaError PaAsiHpi_GetStreamInfo( PaAsiHpiStreamComponent *streamComp, PaAsiHpiStreamInfo *info )
@@ -1262,9 +1263,9 @@
 
 
 /** Display stream component information for debugging purposes.
- 
+
  @param streamComp Pointer to stream component (input or output) to query
- 
+
  @param stream Pointer to stream struct which contains the component above
  */
 static void PaAsiHpi_StreamComponentDump( PaAsiHpiStreamComponent *streamComp,
@@ -1391,7 +1392,7 @@
 
 
 /** Display stream information for debugging purposes.
- 
+
  @param stream Pointer to stream to query
  */
 static void PaAsiHpi_StreamDump( PaAsiHpiStream *stream )
@@ -1457,25 +1458,25 @@
 
 
 /** Determine buffer sizes and allocate appropriate stream buffers.
- This attempts to allocate a BBM (host) buffer for the HPI stream component (either input 
+ This attempts to allocate a BBM (host) buffer for the HPI stream component (either input
  or output, as both have similar buffer needs). Not all AudioScience adapters support BBM,
- in which case the hardware buffer has to suffice. The size of the HPI host buffer is chosen 
- as a multiple of framesPerPaHostBuffer, and also influenced by the suggested latency and the 
- estimated minimum polling interval. The HPI host and hardware buffer sizes are stored, and an 
- appropriate cap for the hardware buffer is also calculated. Finally, the temporary stream 
+ in which case the hardware buffer has to suffice. The size of the HPI host buffer is chosen
+ as a multiple of framesPerPaHostBuffer, and also influenced by the suggested latency and the
+ estimated minimum polling interval. The HPI host and hardware buffer sizes are stored, and an
+ appropriate cap for the hardware buffer is also calculated. Finally, the temporary stream
  buffer which serves as the PortAudio host buffer for this implementation is allocated.
  This buffer contains an integer number of user buffers, to simplify buffer adaption in the
  buffer processor. The function returns paBufferTooBig if the HPI interface cannot allocate
  an HPI host buffer of the desired size.
- 
+
  @param streamComp Pointer to stream component struct
-  
+
  @param pollingInterval Polling interval for stream, in milliseconds
- 
+
  @param framesPerPaHostBuffer Size of PortAudio host buffer, in frames
- 
+
  @param suggestedLatency Suggested latency for stream component, in seconds
- 
+
  @return PortAudio error code (possibly paBufferTooBig or paInsufficientMemory)
  */
 static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, HW32 pollingInterval,
@@ -1532,7 +1533,7 @@
             }
         }
         /* Choose closest memory block boundary (HPI API document states that
-        "a buffer size of Nx4096 - 20 makes the best use of memory" 
+        "a buffer size of Nx4096 - 20 makes the best use of memory"
         (under the entry for HPI_StreamEstimateBufferSize)) */
         bbmBufferSize = ((HW32)ceil((bbmBufferSize + 20)/4096.0))*4096 - 20;
         streamComp->hostBufferSize = bbmBufferSize;
@@ -1646,28 +1647,28 @@
  based on the suggested latency. It then opens each requested stream direction with the
  appropriate stream format, and allocates the required stream buffers. It sets up the
  various PortAudio structures dealing with streams, and estimates the stream latency.
- 
+
  See pa_hostapi.h for a list of validity guarantees made about OpenStream parameters.
- 
+
  @param hostApi Pointer to host API struct
- 
+
  @param s List of open streams, where successfully opened stream will go
- 
+
  @param inputParameters Pointer to stream parameter struct for input side of stream
- 
+
  @param outputParameters Pointer to stream parameter struct for output side of stream
- 
+
  @param sampleRate Desired sample rate
- 
- @param framesPerBuffer Desired number of frames per buffer passed to user callback 
+
+ @param framesPerBuffer Desired number of frames per buffer passed to user callback
                         (or chunk size for blocking stream)
- 
+
  @param streamFlags Stream flags
- 
+
  @param streamCallback Pointer to user callback function (zero for blocking interface)
- 
+
  @param userData Pointer to user data that will be passed to callback function along with data
- 
+
  @return PortAudio error code
 */
 static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
@@ -1860,12 +1861,12 @@
 
 
 /** Close PortAudio stream.
- When CloseStream() is called, the multi-api layer ensures that the stream has already 
+ When CloseStream() is called, the multi-api layer ensures that the stream has already
  been stopped or aborted. This closes the underlying HPI streams and deallocates stream
  buffers and structs.
- 
+
  @param s Pointer to PortAudio stream
- 
+
  @return PortAudio error code
 */
 static PaError CloseStream( PaStream *s )
@@ -1919,9 +1920,9 @@
  This resets the output stream and uses PortAudio helper routines to fill the
  temp buffer with silence. It then writes two host buffers to the stream. This is supposed
  to be called before the stream is started. It has no effect on input-only streams.
- 
+
  @param stream Pointer to stream struct
- 
+
  @return PortAudio error code
  */
 static PaError PaAsiHpi_PrimeOutputWithSilence( PaAsiHpiStream *stream )
@@ -1962,14 +1963,14 @@
 /** Start HPI streams (both input + output).
  This starts all HPI streams in the PortAudio stream. Output streams are first primed with
  silence, if required. After this call the PA stream is in the Active state.
- 
+
  @todo Implement priming via the user callback
- 
+
  @param stream Pointer to stream struct
- 
+
  @param outputPrimed True if output is already primed (if false, silence will be loaded before starting)
- 
- @return PortAudio error code 
+
+ @return PortAudio error code
  */
 static PaError PaAsiHpi_StartStream( PaAsiHpiStream *stream, int outputPrimed )
 {
@@ -2006,10 +2007,10 @@
  The thread will then take care of starting the HPI streams, and this function will block
  until the streams actually start. In the case of a blocking interface, the HPI streams
  are simply started.
- 
+
  @param s Pointer to PortAudio stream
- 
- @return PortAudio error code 
+
+ @return PortAudio error code
 */
 static PaError StartStream( PaStream *s )
 {
@@ -2025,7 +2026,7 @@
     {
         /* Create and start callback engine thread */
         /* Also waits 1 second for stream to be started by engine thread (otherwise aborts) */
-        PA_ENSURE_( PaUnixThread_New( &stream->thread, &CallbackThreadFunc, stream, 1. ) );
+        PA_ENSURE_( PaUnixThread_New( &stream->thread, &CallbackThreadFunc, stream, 1., 0 ) );
     }
     else
     {
@@ -2040,15 +2041,15 @@
 /** Stop HPI streams (input + output), either softly or abruptly.
  If abort is false, the function blocks until the output stream is drained, otherwise it
  stops immediately and discards data in the stream hardware buffers.
- 
+
  This function is safe to call from the callback engine thread as well as the main thread.
- 
+
  @param stream Pointer to stream struct
- 
+
  @param abort True if samples in output buffer should be discarded (otherwise blocks until stream is done)
- 
- @return PortAudio error code 
- 
+
+ @return PortAudio error code
+
  */
 static PaError PaAsiHpi_StopStream( PaAsiHpiStream *stream, int abort )
 {
@@ -2098,20 +2099,20 @@
 
 
 /** Stop or abort PortAudio stream.
- 
+
  This function is used to explicitly stop the PortAudio stream (via StopStream/AbortStream),
- as opposed to the situation when the callback finishes with a result other than paContinue. 
- If a stream is in callback mode we will have to inspect whether the background thread has 
- finished, or we will have to take it out. In either case we join the thread before returning. 
- In blocking mode, we simply tell HPI to stop abruptly (abort) or finish buffers (drain). 
+ as opposed to the situation when the callback finishes with a result other than paContinue.
+ If a stream is in callback mode we will have to inspect whether the background thread has
+ finished, or we will have to take it out. In either case we join the thread before returning.
+ In blocking mode, we simply tell HPI to stop abruptly (abort) or finish buffers (drain).
  The PortAudio stream will be in the Stopped state after a call to this function.
- 
- Don't call this from the callback engine thread! 
- 
+
+ Don't call this from the callback engine thread!
+
  @param stream Pointer to stream struct
- 
+
  @param abort True if samples in output buffer should be discarded (otherwise blocks until stream is done)
- 
+
  @return PortAudio error code
 */
 static PaError PaAsiHpi_ExplicitStop( PaAsiHpiStream *stream, int abort )
@@ -2151,10 +2152,10 @@
 
 /** Stop PortAudio stream.
  This blocks until the output buffers are drained.
- 
+
  @param s Pointer to PortAudio stream
- 
- @return PortAudio error code 
+
+ @return PortAudio error code
 */
 static PaError StopStream( PaStream *s )
 {
@@ -2164,10 +2165,10 @@
 
 /** Abort PortAudio stream.
  This discards any existing data in output buffers and stops the stream immediately.
- 
+
  @param s Pointer to PortAudio stream
- 
- @return PortAudio error code 
+
+ @return PortAudio error code
 */
 static PaError AbortStream( PaStream *s )
 {
@@ -2176,14 +2177,14 @@
 
 
 /** Determine whether the stream is stopped.
- A stream is considered to be stopped prior to a successful call to StartStream and after 
- a successful call to StopStream or AbortStream. If a stream callback returns a value other 
+ A stream is considered to be stopped prior to a successful call to StartStream and after
+ a successful call to StopStream or AbortStream. If a stream callback returns a value other
  than paContinue the stream is NOT considered to be stopped (it is in CallbackFinished state).
- 
+
  @param s Pointer to PortAudio stream
- 
+
  @return Returns one (1) when the stream is stopped, zero (0) when the stream is running, or
-         a PaErrorCode (which are always negative) if PortAudio is not initialized or an 
+         a PaErrorCode (which are always negative) if PortAudio is not initialized or an
          error is encountered.
 */
 static PaError IsStreamStopped( PaStream *s )
@@ -2196,14 +2197,14 @@
 
 
 /** Determine whether the stream is active.
- A stream is active after a successful call to StartStream(), until it becomes inactive either 
- as a result of a call to StopStream() or AbortStream(), or as a result of a return value 
- other than paContinue from the stream callback. In the latter case, the stream is considered 
+ A stream is active after a successful call to StartStream(), until it becomes inactive either
+ as a result of a call to StopStream() or AbortStream(), or as a result of a return value
+ other than paContinue from the stream callback. In the latter case, the stream is considered
  inactive after the last buffer has finished playing.
- 
+
  @param s Pointer to PortAudio stream
- 
- @return Returns one (1) when the stream is active (i.e. playing or recording audio), 
+
+ @return Returns one (1) when the stream is active (i.e. playing or recording audio),
          zero (0) when not playing, or a PaErrorCode (which are always negative)
          if PortAudio is not initialized or an error is encountered.
 */
@@ -2217,12 +2218,12 @@
 
 
 /** Returns current stream time.
- This corresponds to the system clock. The clock should run continuously while the stream 
+ This corresponds to the system clock. The clock should run continuously while the stream
  is open, i.e. between calls to OpenStream() and CloseStream(), therefore a frame counter
  is not good enough.
- 
+
  @param s Pointer to PortAudio stream
- 
+
  @return Stream time, in seconds
  */
 static PaTime GetStreamTime( PaStream *s )
@@ -2232,9 +2233,9 @@
 
 
 /** Returns CPU load.
- 
+
  @param s Pointer to PortAudio stream
- 
+
  @return CPU load (0.0 if blocking interface is used)
  */
 static double GetStreamCpuLoad( PaStream *s )
@@ -2251,8 +2252,8 @@
  abruptly). It also calls the user-supplied StreamFinished callback, and sets the
  stream state to CallbackFinished if it was reached via a non-paContinue return from
  the user callback function.
- 
- @param userData A pointer to an open stream previously created with Pa_OpenStream 
+
+ @param userData A pointer to an open stream previously created with Pa_OpenStream
  */
 static void PaAsiHpi_OnThreadExit( void *userData )
 {
@@ -2273,7 +2274,7 @@
     }
 
     /* Unfortunately both explicit calls to Stop/AbortStream (leading to Stopped state)
-     and implicit stops via paComplete/paAbort (leading to CallbackFinished state) 
+     and implicit stops via paComplete/paAbort (leading to CallbackFinished state)
      end up here - need another flag to remind us which is the case */
     if( stream->callbackFinished )
         stream->state = paAsiHpiCallbackFinishedState;
@@ -2281,20 +2282,20 @@
 
 
 /** Wait until there is enough frames to fill a host buffer.
- The routine attempts to sleep until at least a full host buffer can be retrieved from the 
+ The routine attempts to sleep until at least a full host buffer can be retrieved from the
  input HPI stream and passed to the output HPI stream. It will first sleep until enough
  output space is available, as this is usually easily achievable. If it is an output-only
  stream, it will also sleep if the hardware buffer is too full, thereby throttling the
  filling of the output buffer and reducing output latency. The routine then blocks until
  enough input samples are available, unless this will cause an output underflow. In the
  process, input overflows and output underflows are indicated.
- 
+
  @param stream Pointer to stream struct
-  
+
  @param framesAvail Returns the number of available frames
- 
+
  @param cbFlags Overflows and underflows indicated in here
- 
+
  @return PortAudio error code (only paUnanticipatedHostError expected)
  */
 static PaError PaAsiHpi_WaitForFrames( PaAsiHpiStream *stream, unsigned long *framesAvail,
@@ -2369,9 +2370,9 @@
             /** @todo The paInputOverflow flag should be set in the callback containing the
              first input sample following the overflow. That means the block currently sitting
              at the fore-front of recording, i.e. typically the one containing the newest (last)
-             sample in the HPI buffer system. This is most likely not the same as the current 
-             block of data being passed to the callback. The current overflow should ideally 
-             be noted in an overflow list of sorts, with an indication of when it should be 
+             sample in the HPI buffer system. This is most likely not the same as the current
+             block of data being passed to the callback. The current overflow should ideally
+             be noted in an overflow list of sorts, with an indication of when it should be
              reported. The trouble starts if there are several separate overflow incidents,
              given a big input buffer. Oh well, something to try out later... */
             if( info.overflow )
@@ -2402,18 +2403,18 @@
 
 /** Obtain recording, current and playback timestamps of stream.
  The current time is determined by the system clock. This "now" timestamp occurs at the
- forefront of recording (and playback in the full-duplex case), which happens later than the 
+ forefront of recording (and playback in the full-duplex case), which happens later than the
  input timestamp by an amount equal to the total number of recorded frames in the input buffer.
- The output timestamp indicates when the next generated sample will actually be played. This 
+ The output timestamp indicates when the next generated sample will actually be played. This
  happens after all the samples currently in the output buffer are played. The output timestamp
  therefore follows the current timestamp by an amount equal to the number of frames yet to be
  played back in the output buffer.
- 
+
  If the current timestamp is the present, the input timestamp is in the past and the output
  timestamp is in the future.
- 
+
  @param stream Pointer to stream struct
- 
+
  @param timeInfo Pointer to timeInfo struct that will contain timestamps
  */
 static void PaAsiHpi_CalculateTimeInfo( PaAsiHpiStream *stream, PaStreamCallbackTimeInfo *timeInfo )
@@ -2448,16 +2449,16 @@
 
 /** Read from HPI input stream and register buffers.
  This reads data from the HPI input stream (if it exists) and registers the temp stream
- buffers of both input and output streams with the buffer processor. In the process it also 
+ buffers of both input and output streams with the buffer processor. In the process it also
  handles input underflows in the full-duplex case.
- 
+
  @param stream Pointer to stream struct
-  
- @param numFrames On entrance the number of available frames, on exit the number of 
+
+ @param numFrames On entrance the number of available frames, on exit the number of
                   received frames
- 
+
  @param cbFlags Indicates overflows and underflows
- 
+
  @return PortAudio error code
  */
 static PaError PaAsiHpi_BeginProcessing( PaAsiHpiStream *stream, unsigned long *numFrames,
@@ -2531,11 +2532,11 @@
  This completes the processing cycle by writing the temp buffer to the HPI interface.
  Additional output underflows are caught before data is written to the stream, as this
  action typically remedies the underflow and hides it in the process.
- 
+
  @param stream Pointer to stream struct
-  
+
  @param numFrames The number of frames to write to the output stream
- 
+
  @param cbFlags Indicates overflows and underflows
  */
 static PaError PaAsiHpi_EndProcessing( PaAsiHpiStream *stream, unsigned long numFrames,
@@ -2573,11 +2574,11 @@
 
 /** Main callback engine.
  This function runs in a separate thread and does all the work of fetching audio data from
- the AudioScience card via the HPI interface, feeding it to the user callback via the buffer 
+ the AudioScience card via the HPI interface, feeding it to the user callback via the buffer
  processor, and delivering the resulting output data back to the card via HPI calls.
  It is started and terminated when the PortAudio stream is started and stopped, and starts
  the HPI streams on startup.
- 
+
  @param userData A pointer to an open stream previously created with Pa_OpenStream.
 */
 static void *CallbackThreadFunc( void *userData )
@@ -2720,16 +2721,16 @@
  functions can be guaranteed to only be called for blocking streams. */
 
 /** Read data from input stream.
- This reads the indicated number of frames into the supplied buffer from an input stream, 
+ This reads the indicated number of frames into the supplied buffer from an input stream,
  and blocks until this is done.
- 
+
  @param s Pointer to PortAudio stream
-  
+
  @param buffer Pointer to buffer that will receive interleaved data (or an array of pointers
                to a buffer for each non-interleaved channel)
- 
+
  @param frames Number of frames to read from stream
- 
+
  @return PortAudio error code (also indicates overflow via paInputOverflowed)
  */
 static PaError ReadStream( PaStream *s,
@@ -2787,16 +2788,16 @@
 
 
 /** Write data to output stream.
- This writes the indicated number of frames from the supplied buffer to an output stream, 
+ This writes the indicated number of frames from the supplied buffer to an output stream,
  and blocks until this is done.
- 
+
  @param s Pointer to PortAudio stream
-  
+
  @param buffer Pointer to buffer that provides interleaved data (or an array of pointers
                to a buffer for each non-interleaved channel)
- 
+
  @param frames Number of frames to write to stream
- 
+
  @return PortAudio error code (also indicates underflow via paOutputUnderflowed)
  */
 static PaError WriteStream( PaStream *s,
@@ -2854,9 +2855,9 @@
 
 
 /** Number of frames that can be read from input stream without blocking.
- 
+
  @param s Pointer to PortAudio stream
-  
+
  @return Number of frames, or PortAudio error code
  */
 static signed long GetStreamReadAvailable( PaStream *s )
@@ -2882,9 +2883,9 @@
 
 
 /** Number of frames that can be written to output stream without blocking.
- 
+
  @param s Pointer to PortAudio stream
-  
+
  @return Number of frames, or PortAudio error code
  */
 static signed long GetStreamWriteAvailable( PaStream *s )

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/asio/pa_asio.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/asio/pa_asio.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/asio/pa_asio.cpp	Mon Aug  4 21:29:58 2008
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_asio.cpp 1146 2006-11-23 04:39:43Z rossb $
+ * $Id: pa_asio.cpp 1230 2007-06-15 16:16:33Z rossb $
  * Portable Audio I/O Library for ASIO Drivers
  *
  * Author: Stephane Letz
@@ -132,7 +132,7 @@
 #include "pa_stream.h"
 #include "pa_cpuload.h"
 #include "pa_process.h"
-
+#include "pa_debugprint.h"
 
 /* This version of pa_asio.cpp is currently only targetted at Win32,
    It would require a few tweaks to work with pre-OS X Macintosh.
@@ -1021,6 +1021,7 @@
 /* we look up IsDebuggerPresent at runtime incase it isn't present (on Win95 for example) */
 typedef BOOL (WINAPI *IsDebuggerPresentPtr)(VOID);
 IsDebuggerPresentPtr IsDebuggerPresent_ = 0;
+//FARPROC IsDebuggerPresent_ = 0; // this is the current way to do it apparently according to davidv
 
 PaError PaAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex )
 {
@@ -1677,6 +1678,7 @@
     PaAsioDriverInfo *driverInfo;
     int *inputChannelSelectors = 0;
     int *outputChannelSelectors = 0;
+    bool isExternal = false;
 
     /* unless we move to using lower level ASIO calls, we can only have
         one device open at a time */
@@ -1792,6 +1794,30 @@
     }
 
 
+    /* davidv: listing ASIO Clock sources, there is an ongoing investigation by
+       me about whether or not call ASIOSetSampleRate if an external Clock is
+       used. A few drivers expected different things here */
+    {
+        ASIOClockSource clocks[32];
+        long numSources=32;
+        asioError = ASIOGetClockSources(clocks, &numSources);
+        if( asioError != ASE_OK ){
+            PA_DEBUG(("ERROR: ASIOGetClockSources: %s\n", PaAsio_GetAsioErrorText(asioError) ));
+        }else{
+            PA_DEBUG(("INFO ASIOGetClockSources listing %d clocks\n", numSources ));
+            for (int i=0;i<numSources;++i){
+                PA_DEBUG(("ASIOClockSource%d %s current:%d\n", i,clocks[i].name, clocks[i].isCurrentSource ));
+               
+                /*
+                  If you have problems with some drivers when externally clocked, 
+                  uncomment the next two lines
+                 */
+                //if (clocks[i].isCurrentSource)
+                //    isExternal = true;
+            }
+        }
+    }
+
     // check that the device supports the requested sample rate 
 
     asioError = ASIOCanSampleRate( sampleRate );
@@ -1821,7 +1847,8 @@
     if (oldRate != sampleRate){
 
         PA_DEBUG(("before ASIOSetSampleRate(%f)\n",sampleRate));
-        asioError = ASIOSetSampleRate( sampleRate );
+
+        asioError = ASIOSetSampleRate( isExternal?0:sampleRate );
         /* Set sample rate */
         if( asioError != ASE_OK )
         {

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/notes.txt
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/notes.txt	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/notes.txt	Mon Aug  4 21:29:58 2008
@@ -73,17 +73,24 @@
 
 Known issues:
 
-- Latency: Latency settings are ignored in most cases. Exceptions are when
-doing I/O between different devices and as a hint for selecting a realtively
-low or relatively high latency in conjunction with
-paHostFramesPerBufferUnspecified. Latency settings are always automatically
-bound to "safe" values, however, so setting extreme values here should not be
+- Buffering: No buffering beyond that provided by core audio is provided
+except where absolutely needed for the implementation to work. This may cause
+issues with large framesPerBuffer settings and it also means that no additional
+latency will be provided even if a large latency setting is selected.
+
+- Latency: Latency settings are generally ignored. They may be used as a
+hint for buffer size in paHostFramesPerBufferUnspecified, or the value may
+be used in cases where additional buffering is needed, such as doing input and
+output on seperate devices. Latency settings are always automatically bound
+to "safe" values, however, so setting extreme values here should not be
 an issue.
 
 - Buffer Size: paHostFramesPerBufferUnspecified and specific host buffer sizes
 are supported. paHostFramesPerBufferUnspecified works best in "pro" mode,
 where the buffer size and sample rate of the audio device is most likely
-to match the expected values.
+to match the expected values. In the case of paHostFramesPerBuffer, an
+appropriate framesPerBuffer value will be used that guarantees minimum
+requested latency if that's possible.
 
 - Timing info. It reports on stream time, but I'm probably doing something
 wrong since patest_sine_time often reports negative latency numbers. Also,
@@ -111,8 +118,7 @@
 as "documented" here:
 http://lists.apple.com/archives/coreaudio-api/2004/Jan/msg00141.html
 
-- x86/Universal Binary: to build a universal binary, be sure to use
-the darwin makefile and not the usual configure && make combo.
+- x86/Universal Binary: Universal binaries can be build.
 
 
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core.c	Mon Aug  4 21:29:58 2008
@@ -65,6 +65,7 @@
 #include "pa_mac_core_internal.h"
 
 #include <string.h> /* strlen(), memcmp() etc. */
+#include <libkern/OSAtomic.h>
 
 #include "pa_mac_core.h"
 #include "pa_mac_core_utilities.h"
@@ -98,7 +99,7 @@
 /*
  * Function declared in pa_mac_core.h. Adds channel mapping to a PaMacCoreStreamInfoStruct
  */
-void PaMacCore_SetupChannelMap( PaMacCoreStreamInfo *data, const long * const channelMap, const unsigned long channelMapSize )
+void PaMacCore_SetupChannelMap( PaMacCoreStreamInfo *data, const SInt32 * const channelMap, const unsigned long channelMapSize )
 {
    data->channelMap = channelMap;
    data->channelMapSize = channelMapSize;
@@ -261,11 +262,12 @@
                                int isInput);
 
 static PaError OpenAndSetupOneAudioUnit(
+                                   const PaMacCoreStream *stream,
                                    const PaStreamParameters *inStreamParams,
                                    const PaStreamParameters *outStreamParams,
-                                   const unsigned long requestedFramesPerBuffer,
-                                   unsigned long *actualInputFramesPerBuffer,
-                                   unsigned long *actualOutputFramesPerBuffer,
+                                   const UInt32 requestedFramesPerBuffer,
+                                   UInt32 *actualInputFramesPerBuffer,
+                                   UInt32 *actualOutputFramesPerBuffer,
                                    const PaMacAUHAL *auhalHostApi,
                                    AudioUnit *audioUnit,
                                    AudioConverterRef *srConverter,
@@ -277,6 +279,55 @@
 #define PA_AUHAL_SET_LAST_HOST_ERROR( errorCode, errorText ) \
     PaUtil_SetLastHostErrorInfo( paInDevelopment, errorCode, errorText )
 
+/*
+ * Callback for setting over/underrun flags.
+ *
+ */
+static OSStatus xrunCallback(
+    AudioDeviceID inDevice, 
+    UInt32 inChannel, 
+    Boolean isInput, 
+    AudioDevicePropertyID inPropertyID, 
+    void* inClientData)
+{
+   PaMacCoreStream *stream = (PaMacCoreStream *) inClientData;
+   if( stream->state != ACTIVE )
+      return 0; //if the stream isn't active, we don't care if the device is dropping
+   if( isInput )
+      OSAtomicOr32( paInputUnderflow, (uint32_t *)&(stream->xrunFlags) );
+   else
+      OSAtomicOr32( paOutputOverflow, (uint32_t *)&(stream->xrunFlags) );
+
+   return 0;
+}
+
+/*
+ * Callback called when starting or stopping a stream.
+ */
+static void startStopCallback(
+   void *               inRefCon,
+   AudioUnit            ci,
+   AudioUnitPropertyID  inID,
+   AudioUnitScope       inScope,
+   AudioUnitElement     inElement )
+{
+   PaMacCoreStream *stream = (PaMacCoreStream *) inRefCon;
+   UInt32 isRunning;
+   UInt32 size = sizeof( isRunning );
+   assert( !AudioUnitGetProperty( ci, kAudioOutputUnitProperty_IsRunning, inScope, inElement, &isRunning, &size ) );
+   if( isRunning )
+      return; //We are only interested in when we are stopping
+   // -- if we are using 2 I/O units, we only need one notification!
+   if( stream->inputUnit && stream->outputUnit && stream->inputUnit != stream->outputUnit && ci == stream->inputUnit )
+      return;
+   PaStreamFinishedCallback *sfc = stream->streamRepresentation.streamFinishedCallback;
+   if( stream->state == STOPPING )
+      stream->state = STOPPED ;
+   if( sfc )
+      sfc( stream->streamRepresentation.userData );
+}
+
+
 /*currently, this is only used in initialization, but it might be modified
   to be used when the list of devices changes.*/
 static PaError gatherDeviceInfo(PaMacAUHAL *auhalHostApi)
@@ -737,11 +788,12 @@
 }
 
 static PaError OpenAndSetupOneAudioUnit(
+                                   const PaMacCoreStream *stream,
                                    const PaStreamParameters *inStreamParams,
                                    const PaStreamParameters *outStreamParams,
-                                   const unsigned long requestedFramesPerBuffer,
-                                   unsigned long *actualInputFramesPerBuffer,
-                                   unsigned long *actualOutputFramesPerBuffer,
+                                   const UInt32 requestedFramesPerBuffer,
+                                   UInt32 *actualInputFramesPerBuffer,
+                                   UInt32 *actualOutputFramesPerBuffer,
                                    const PaMacAUHAL *auhalHostApi,
                                    AudioUnit *audioUnit,
                                    AudioConverterRef *srConverter,
@@ -753,7 +805,7 @@
     Component comp;
     /*An Apple TN suggests using CAStreamBasicDescription, but that is C++*/
     AudioStreamBasicDescription desiredFormat;
-    OSErr result = noErr;
+    OSStatus result = noErr;
     PaError paResult = paNoError;
     int line = 0;
     UInt32 callbackKey;
@@ -881,7 +933,7 @@
                     audioDevice,
                     sizeof(AudioDeviceID) ) );
     }
-    if( outStreamParams )
+    if( outStreamParams && outStreamParams != inStreamParams )
     {
        *audioDevice = auhalHostApi->devIds[outStreamParams->device] ;
        ERR_WRAP( AudioUnitSetProperty( *audioUnit,
@@ -891,6 +943,19 @@
                     audioDevice,
                     sizeof(AudioDeviceID) ) );
     }
+    /* -- add listener for dropouts -- */
+    ERR_WRAP( AudioDeviceAddPropertyListener( *audioDevice,
+                                              0,
+                                              outStreamParams ? false : true,
+                                              kAudioDeviceProcessorOverload,
+                                              xrunCallback,
+                                              (void *)stream) );
+
+    /* -- listen for stream start and stop -- */
+    ERR_WRAP( AudioUnitAddPropertyListener( *audioUnit,
+                                            kAudioOutputUnitProperty_IsRunning,
+                                            startStopCallback,
+                                            (void *)stream ) );
 
     /* -- set format -- */
     bzero( &desiredFormat, sizeof(desiredFormat) );
@@ -1010,7 +1075,7 @@
                             kAudioUnitScope_Input,
                             OUTPUT_ELEMENT,
                             actualOutputFramesPerBuffer,
-                            sizeof(unsigned long) ) );
+                            sizeof(*actualOutputFramesPerBuffer) ) );
        ERR_WRAP( AudioUnitGetProperty( *audioUnit,
                             kAudioUnitProperty_MaximumFramesPerSlice,
                             kAudioUnitScope_Global,
@@ -1025,7 +1090,7 @@
                             kAudioUnitScope_Output,
                             INPUT_ELEMENT,
                             actualInputFramesPerBuffer,
-                            sizeof(unsigned long) ) );
+                            sizeof(*actualInputFramesPerBuffer) ) );
 /* Don't know why this causes problems
        ERR_WRAP( AudioUnitGetProperty( *audioUnit,
                             kAudioUnitProperty_MaximumFramesPerSlice,
@@ -1305,7 +1370,7 @@
           /*requested a realtively low latency. make sure this is in range of devices */
           /*try to get the device's min natural buffer size and use that (but no smaller than 64).*/
           AudioValueRange audioRange;
-          size_t size = sizeof( audioRange );
+          UInt32 size = sizeof( audioRange );
           if( inputParameters ) {
              WARNING( result = AudioDeviceGetProperty( auhalHostApi->devIds[inputParameters->device],
                                           0,
@@ -1315,6 +1380,7 @@
              if( result )
                 requested = MAX( requested, audioRange.mMinimum );
           }
+          size = sizeof( audioRange );
           if( outputParameters ) {
              WARNING( result = AudioDeviceGetProperty( auhalHostApi->devIds[outputParameters->device],
                                           0,
@@ -1328,7 +1394,7 @@
           /* requested a realtively high latency. make sure this is in range of devices */
           /*try to get the device's max natural buffer size and use that (but no larger than 1024).*/
           AudioValueRange audioRange;
-          size_t size = sizeof( audioRange );
+          UInt32 size = sizeof( audioRange );
           requested = MIN( requested, 1024 );
           if( inputParameters ) {
              WARNING( result = AudioDeviceGetProperty( auhalHostApi->devIds[inputParameters->device],
@@ -1339,6 +1405,7 @@
              if( result )
                 requested = MIN( requested, audioRange.mMaximum );
           }
+          size = sizeof( audioRange );
           if( outputParameters ) {
              WARNING( result = AudioDeviceGetProperty( auhalHostApi->devIds[outputParameters->device],
                                           0,
@@ -1359,17 +1426,22 @@
     /* -- Now we actually open and setup streams. -- */
     if( inputParameters && outputParameters && outputParameters->device == inputParameters->device )
     { /* full duplex. One device. */
-       result = OpenAndSetupOneAudioUnit( inputParameters,
+       UInt32 inputFramesPerBuffer  = (UInt32) stream->inputFramesPerBuffer;
+       UInt32 outputFramesPerBuffer = (UInt32) stream->outputFramesPerBuffer;
+       result = OpenAndSetupOneAudioUnit( stream,
+                                          inputParameters,
                                           outputParameters,
                                           framesPerBuffer,
-                                          &(stream->inputFramesPerBuffer),
-                                          &(stream->outputFramesPerBuffer),
+                                          &inputFramesPerBuffer,
+                                          &outputFramesPerBuffer,
                                           auhalHostApi,
                                           &(stream->inputUnit),
                                           &(stream->inputSRConverter),
                                           &(stream->inputDevice),
                                           sampleRate,
                                           stream );
+       stream->inputFramesPerBuffer = inputFramesPerBuffer;
+       stream->outputFramesPerBuffer = outputFramesPerBuffer;
        stream->outputUnit = stream->inputUnit;
        stream->outputDevice = stream->inputDevice;
        if( result != paNoError )
@@ -1377,11 +1449,14 @@
     }
     else
     { /* full duplex, different devices OR simplex */
-       result = OpenAndSetupOneAudioUnit( NULL,
+       UInt32 outputFramesPerBuffer = (UInt32) stream->outputFramesPerBuffer;
+       UInt32 inputFramesPerBuffer  = (UInt32) stream->inputFramesPerBuffer;
+       result = OpenAndSetupOneAudioUnit( stream,
+                                          NULL,
                                           outputParameters,
                                           framesPerBuffer,
                                           NULL,
-                                          &(stream->outputFramesPerBuffer),
+                                          &outputFramesPerBuffer,
                                           auhalHostApi,
                                           &(stream->outputUnit),
                                           NULL,
@@ -1390,10 +1465,11 @@
                                           stream );
        if( result != paNoError )
            goto error;
-       result = OpenAndSetupOneAudioUnit( inputParameters,
+       result = OpenAndSetupOneAudioUnit( stream,
+                                          inputParameters,
                                           NULL,
                                           framesPerBuffer,
-                                          &(stream->inputFramesPerBuffer),
+                                          &inputFramesPerBuffer,
                                           NULL,
                                           auhalHostApi,
                                           &(stream->inputUnit),
@@ -1403,6 +1479,8 @@
                                           stream );
        if( result != paNoError )
            goto error;
+       stream->inputFramesPerBuffer = inputFramesPerBuffer;
+       stream->outputFramesPerBuffer = outputFramesPerBuffer;
     }
 
     if( stream->inputUnit ) {
@@ -1727,14 +1805,14 @@
        * we do not use the input SR converter or the input ring buffer.
        *
        */
-      OSErr err = 0;
+      OSStatus err = 0;
       unsigned long frames;
 
       /* -- start processing -- */
       PaUtil_BeginBufferProcessing( &(stream->bufferProcessor),
                                     &timeInfo,
                                     stream->xrunFlags );
-      stream->xrunFlags = 0;
+      stream->xrunFlags = 0; //FIXME: this flag also gets set outside by a callback, which calls the xrunCallback function. It should be in the same thread as the main audio callback, but the apple docs just use the word "usually" so it may be possible to loose an xrun notification, if that callback happens here.
 
       /* -- compute frames. do some checks -- */
       assert( ioData->mNumberBuffers == 1 );
@@ -1868,7 +1946,7 @@
                PaUtil_AdvanceRingBufferReadIndex(&stream->inputRingBuffer, size1 );
             } else if( ( size1 + size2 ) / ( flsz * inChan ) < frames ) {
                /*we underflowed. take what data we can, zero the rest.*/
-               float data[frames*inChan];
+               unsigned char data[frames*inChan*flsz];
                if( size1 )
                   memcpy( data, data1, size1 );
                if( size2 )
@@ -1922,7 +2000,7 @@
        * if this is an input-only stream, we need to process it more,
        * otherwise, we let the output case deal with it.
        */
-      OSErr err = 0;
+      OSStatus err = 0;
       int chan = stream->inputAudioBufferList.mBuffers[0].mNumberChannels ;
       /* FIXME: looping here may not actually be necessary, but it was something I tried in testing. */
       do {
@@ -2054,6 +2132,18 @@
     VDBUG( ( "Closing stream.\n" ) );
 
     if( stream ) {
+       if( stream->outputUnit )
+          AudioDeviceRemovePropertyListener( stream->outputDevice,
+                                             0,
+                                             false,
+                                             kAudioDeviceProcessorOverload,
+                                             xrunCallback );
+       if( stream->inputUnit && stream->outputUnit != stream->inputUnit )
+          AudioDeviceRemovePropertyListener( stream->inputDevice,
+                                             0,
+                                             true,
+                                             kAudioDeviceProcessorOverload,
+                                             xrunCallback );
        if( stream->outputUnit && stream->outputUnit != stream->inputUnit ) {
           AudioUnitUninitialize( stream->outputUnit );
           CloseComponent( stream->outputUnit );
@@ -2089,11 +2179,10 @@
     return result;
 }
 
-
 static PaError StartStream( PaStream *s )
 {
     PaMacCoreStream *stream = (PaMacCoreStream*)s;
-    OSErr result = noErr;
+    OSStatus result = noErr;
     VVDBUG(("StartStream()\n"));
     VDBUG( ( "Starting stream.\n" ) );
 
@@ -2120,11 +2209,25 @@
 #undef ERR_WRAP
 }
 
+// it's not clear from appl's docs that this really waits
+// until all data is flushed.
+static ComponentResult BlockWhileAudioUnitIsRunning( AudioUnit audioUnit, AudioUnitElement element )
+{
+    Boolean isRunning = 1;
+    while( isRunning ) {
+       UInt32 s = sizeof( isRunning );
+       ComponentResult err = AudioUnitGetProperty( audioUnit, kAudioOutputUnitProperty_IsRunning, kAudioUnitScope_Global, element,  &isRunning, &s );
+       if( err )
+          return err;
+       Pa_Sleep( 100 );
+    }
+    return noErr;
+}
 
 static PaError StopStream( PaStream *s )
 {
     PaMacCoreStream *stream = (PaMacCoreStream*)s;
-    OSErr result = noErr;
+    OSStatus result = noErr;
     PaError paErr;
     VVDBUG(("StopStream()\n"));
 
@@ -2140,6 +2243,8 @@
     if( stream->inputUnit == stream->outputUnit && stream->inputUnit )
     {
        ERR_WRAP( AudioOutputUnitStop(stream->inputUnit) );
+       ERR_WRAP( BlockWhileAudioUnitIsRunning(stream->inputUnit,0) );
+       ERR_WRAP( BlockWhileAudioUnitIsRunning(stream->inputUnit,1) );
        ERR_WRAP( AudioUnitReset(stream->inputUnit, kAudioUnitScope_Global, 1) );
        ERR_WRAP( AudioUnitReset(stream->inputUnit, kAudioUnitScope_Global, 0) );
     }
@@ -2148,11 +2253,13 @@
        if( stream->inputUnit )
        {
           ERR_WRAP(AudioOutputUnitStop(stream->inputUnit) );
+          ERR_WRAP( BlockWhileAudioUnitIsRunning(stream->inputUnit,1) );
           ERR_WRAP(AudioUnitReset(stream->inputUnit,kAudioUnitScope_Global,1));
        }
        if( stream->outputUnit )
        {
           ERR_WRAP(AudioOutputUnitStop(stream->outputUnit));
+          ERR_WRAP( BlockWhileAudioUnitIsRunning(stream->outputUnit,0) );
           ERR_WRAP(AudioUnitReset(stream->outputUnit,kAudioUnitScope_Global,0));
        }
     }

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.c	Mon Aug  4 21:29:58 2008
@@ -85,6 +85,22 @@
    default: return 0;
    }
 }
+/*
+ * Same as computeSampleSizeFromFormat, except that if
+ * the size is not a power of two, it returns the next power of two up
+ */
+static size_t computeSampleSizeFromFormatPow2( PaSampleFormat format )
+{
+   switch( format ) {
+   case paFloat32: return 4;
+   case paInt32: return 4;
+   case paInt24: return 4;
+   case paInt16: return 2;
+   case paInt8: case paUInt8: return 1;
+   default: return 0;
+   }
+}
+
 
 
 /*
@@ -114,10 +130,14 @@
    blio->outputRingBuffer.buffer = NULL;
 
    /* initialize simple data */
+   blio->ringBufferFrames = ringBufferSize;
    blio->inputSampleFormat = inputSampleFormat;
-   blio->inputSampleSize = computeSampleSizeFromFormat(inputSampleFormat);
+   blio->inputSampleSizeActual = computeSampleSizeFromFormat(inputSampleFormat);
+   blio->inputSampleSizePow2 = computeSampleSizeFromFormatPow2(inputSampleFormat);
    blio->outputSampleFormat = outputSampleFormat;
-   blio->outputSampleSize = computeSampleSizeFromFormat(outputSampleFormat);
+   blio->outputSampleSizeActual = computeSampleSizeFromFormat(outputSampleFormat);
+   blio->outputSampleSizePow2 = computeSampleSizeFromFormatPow2(outputSampleFormat);
+
    blio->framesPerBuffer = framesPerBuffer;
    blio->inChan = inChan;
    blio->outChan = outChan;
@@ -142,7 +162,7 @@
    result = UNIX_ERR( pthread_cond_init( &(blio->outputCond), NULL ) );
 #endif
    if( inChan ) {
-      data = calloc( ringBufferSize, blio->inputSampleSize );
+      data = calloc( ringBufferSize, blio->inputSampleSizePow2*inChan );
       if( !data )
       {
          result = paInsufficientMemory;
@@ -151,11 +171,11 @@
 
       assert( 0 == PaUtil_InitializeRingBuffer(
             &blio->inputRingBuffer,
-            ringBufferSize*blio->inputSampleSize,
+            ringBufferSize*blio->inputSampleSizePow2*inChan,
             data ) );
    }
    if( outChan ) {
-      data = calloc( ringBufferSize, blio->outputSampleSize );
+      data = calloc( ringBufferSize, blio->outputSampleSizePow2*outChan );
       if( !data )
       {
          result = paInsufficientMemory;
@@ -164,7 +184,7 @@
 
       assert( 0 == PaUtil_InitializeRingBuffer(
             &blio->outputRingBuffer,
-            ringBufferSize*blio->outputSampleSize,
+            ringBufferSize*blio->outputSampleSizePow2*outChan,
             data ) );
    }
 
@@ -247,7 +267,8 @@
       bzero( blio->outputRingBuffer.buffer,
              blio->outputRingBuffer.bufferSize );
       /* Advance buffer */
-      PaUtil_AdvanceRingBufferWriteIndex( &blio->outputRingBuffer, blio->outputRingBuffer.bufferSize );
+      PaUtil_AdvanceRingBufferWriteIndex( &blio->outputRingBuffer, blio->ringBufferFrames*blio->outputSampleSizeActual*blio->outChan );
+      //PaUtil_AdvanceRingBufferWriteIndex( &blio->outputRingBuffer, blio->outputRingBuffer.bufferSize );
 
       /* Update isOutputFull. */
 #ifdef PA_MAC__BLIO_MUTEX
@@ -332,10 +353,10 @@
       avail = PaUtil_GetRingBufferWriteAvailable( &blio->inputRingBuffer );
 
       /* check for underflow */
-      if( avail < frameCount * blio->inputSampleSize * blio->inChan )
+      if( avail < frameCount * blio->inputSampleSizeActual * blio->inChan )
          OSAtomicOr32( paInputOverflow, &blio->statusFlags );
 
-      toRead = MIN( avail, frameCount * blio->inputSampleSize * blio->inChan );
+      toRead = MIN( avail, frameCount * blio->inputSampleSizeActual * blio->inChan );
 
       /* copy the data */
       /*printf( "reading %d\n", toRead );*/
@@ -352,14 +373,14 @@
       avail = PaUtil_GetRingBufferReadAvailable( &blio->outputRingBuffer );
 
       /* check for underflow */
-      if( avail < frameCount * blio->outputSampleSize * blio->outChan )
+      if( avail < frameCount * blio->outputSampleSizeActual * blio->outChan )
          OSAtomicOr32( paOutputUnderflow, &blio->statusFlags );
 
-      toWrite = MIN( avail, frameCount * blio->outputSampleSize * blio->outChan );
+      toWrite = MIN( avail, frameCount * blio->outputSampleSizeActual * blio->outChan );
 
-      if( toWrite != frameCount * blio->outputSampleSize * blio->outChan )
+      if( toWrite != frameCount * blio->outputSampleSizeActual * blio->outChan )
          bzero( ((char *)output)+toWrite,
-                frameCount * blio->outputSampleSize * blio->outChan - toWrite );
+                frameCount * blio->outputSampleSizeActual * blio->outChan - toWrite );
       /* copy the data */
       /*printf( "writing %d\n", toWrite );*/
       assert( toWrite == PaUtil_ReadRingBuffer( &blio->outputRingBuffer, output, toWrite ) );
@@ -413,11 +434,11 @@
 #endif
           }
        } while( avail == 0 );
-       toRead = MIN( avail, frames * blio->inputSampleSize * blio->inChan );
-       toRead -= toRead % blio->inputSampleSize * blio->inChan ;
+       toRead = MIN( avail, frames * blio->inputSampleSizeActual * blio->inChan );
+       toRead -= toRead % blio->inputSampleSizeActual * blio->inChan ;
        PaUtil_ReadRingBuffer( &blio->inputRingBuffer, (void *)cbuf, toRead );
        cbuf += toRead;
-       frames -= toRead / ( blio->inputSampleSize * blio->inChan );
+       frames -= toRead / ( blio->inputSampleSizeActual * blio->inChan );
 
        if( toRead == avail ) {
 #ifdef PA_MAC_BLIO_MUTEX
@@ -443,7 +464,7 @@
 
     /* report underflow only once: */
     if( ret ) {
-       OSAtomicAnd32( ~paInputOverflow, &blio->statusFlags );
+       OSAtomicAnd32( (uint32_t)(~paInputOverflow), &blio->statusFlags );
        ret = paInputOverflowed;
     }
 
@@ -491,11 +512,11 @@
           }
        } while( avail == 0 );
 
-       toWrite = MIN( avail, frames * blio->outputSampleSize * blio->outChan );
-       toWrite -= toWrite % blio->outputSampleSize * blio->outChan ;
+       toWrite = MIN( avail, frames * blio->outputSampleSizeActual * blio->outChan );
+       toWrite -= toWrite % blio->outputSampleSizeActual * blio->outChan ;
        PaUtil_WriteRingBuffer( &blio->outputRingBuffer, (void *)cbuf, toWrite );
        cbuf += toWrite;
-       frames -= toWrite / ( blio->outputSampleSize * blio->outChan );
+       frames -= toWrite / ( blio->outputSampleSizeActual * blio->outChan );
 
 #ifdef PA_MAC_BLIO_MUTEX
        if( toWrite == avail ) {
@@ -520,7 +541,7 @@
 
     /* report underflow only once: */
     if( ret ) {
-      OSAtomicAnd32( ~paOutputUnderflow, &blio->statusFlags );
+      OSAtomicAnd32( (uint32_t)(~paOutputUnderflow), &blio->statusFlags );
       ret = paOutputUnderflowed;
     }
 
@@ -549,7 +570,7 @@
     VVDBUG(("GetStreamReadAvailable()\n"));
 
     return PaUtil_GetRingBufferReadAvailable( &blio->inputRingBuffer )
-                         / ( blio->outputSampleSize * blio->outChan );
+                         / ( blio->outputSampleSizeActual * blio->outChan );
 }
 
 
@@ -559,6 +580,6 @@
     VVDBUG(("GetStreamWriteAvailable()\n"));
 
     return PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer )
-                         / ( blio->outputSampleSize * blio->outChan );
+                         / ( blio->outputSampleSizeActual * blio->outChan );
 }
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_blocking.h	Mon Aug  4 21:29:58 2008
@@ -79,10 +79,13 @@
 typedef struct {
     PaUtilRingBuffer inputRingBuffer;
     PaUtilRingBuffer outputRingBuffer;
+    size_t ringBufferFrames;
     PaSampleFormat inputSampleFormat;
-    size_t inputSampleSize;
+    size_t inputSampleSizeActual;
+    size_t inputSampleSizePow2;
     PaSampleFormat outputSampleFormat;
-    size_t outputSampleSize;
+    size_t outputSampleSizeActual;
+    size_t outputSampleSizePow2;
 
     size_t framesPerBuffer;
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_internal.h	Mon Aug  4 21:29:58 2008
@@ -139,6 +139,7 @@
     /* We need to preallocate an inputBuffer for reading data. */
     AudioBufferList inputAudioBufferList;
     AudioTimeStamp startTime;
+    /* FIXME: instead of volatile, these should be properly memory barriered */
     volatile PaStreamCallbackFlags xrunFlags;
     volatile bool isTimeSet;
     volatile enum {
@@ -146,7 +147,8 @@
                                 and the user has called StopStream(). */
        CALLBACK_STOPPED = 1, /* callback has requested stop,
                                 but user has not yet called StopStream(). */
-       STOPPING         = 2, /* The stream is in the process of closing.
+       STOPPING         = 2, /* The stream is in the process of closing
+                                because the user has called StopStream.
                                 This state is just used internally;
                                 externally it is indistinguishable from
                                 ACTIVE.*/

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.c	Mon Aug  4 21:29:58 2008
@@ -199,10 +199,19 @@
     else
         errorType = "Warning";
 
-    if ((int)error < -99999 || (int)error > 99999)
-        DBUG(("%s on line %d: err='%4s', msg='%s'\n", errorType, line, (const char *)&error, errorText));
-    else
-        DBUG(("%s on line %d: err=%d, 0x%x, msg='%s'\n", errorType, line, (int)error, (unsigned)error, errorText));
+    char str[20];
+    // see if it appears to be a 4-char-code
+    *(UInt32 *)(str + 1) = CFSwapInt32HostToBig(error);
+    if (isprint(str[1]) && isprint(str[2]) && isprint(str[3]) && isprint(str[4]))
+    {
+        str[0] = str[5] = '\'';
+        str[6] = '\0';
+    } else {
+        // no, format it as an integer
+        sprintf(str, "%d", (int)error);
+    }
+
+    DBUG(("%s on line %d: err='%s', msg=%s\n", errorType, line, str, errorText));
 
     PaUtil_SetLastHostErrorInfo( paCoreAudio, error, errorText );
 
@@ -520,9 +529,9 @@
    not usually catastrophic.
 */
 PaError setBestFramesPerBuffer( const AudioDeviceID device,
-                                       const bool isOutput,
-                                       unsigned long requestedFramesPerBuffer, 
-                                       unsigned long *actualFramesPerBuffer )
+                                const bool isOutput,
+                                UInt32 requestedFramesPerBuffer, 
+                                UInt32 *actualFramesPerBuffer )
 {
    UInt32 afpb;
    const bool isInput = !isOutput;

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/coreaudio/pa_mac_core_utilities.h	Mon Aug  4 21:29:58 2008
@@ -199,7 +199,7 @@
    not usually catastrophic.
 */
 PaError setBestFramesPerBuffer( const AudioDeviceID device,
-                                       const bool isOutput,
-                                       unsigned long requestedFramesPerBuffer, 
-                                       unsigned long *actualFramesPerBuffer );
+                                const bool isOutput,
+                                UInt32 requestedFramesPerBuffer, 
+                                UInt32 *actualFramesPerBuffer );
 #endif /* PA_MAC_CORE_UTILITIES_H__*/

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds.c	Mon Aug  4 21:29:58 2008
@@ -1,10 +1,10 @@
 /*
- * $Id: pa_win_ds.c 1116 2006-09-06 15:47:03Z rossb $
+ * $Id: pa_win_ds.c 1286 2007-09-26 21:34:23Z rossb $
  * Portable Audio I/O Library DirectSound implementation
  *
  * Authors: Phil Burk, Robert Marsanyi & Ross Bencina
  * Based on the Open Source API proposed by Ross Bencina
- * Copyright (c) 1999-2006 Ross Bencina, Phil Burk, Robert Marsanyi
+ * Copyright (c) 1999-2007 Ross Bencina, Phil Burk, Robert Marsanyi
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files
@@ -55,20 +55,34 @@
 
     @todo implement IsFormatSupported
 
-    @todo check that CoInitialize() CoUninitialize() are always correctly
-        paired, even in error cases.
-
     @todo call PaUtil_SetLastHostErrorInfo with a specific error string (currently just "DSound error").
 
     @todo make sure all buffers have been played before stopping the stream
         when the stream callback returns paComplete
 
+    @todo retrieve default devices using the DRVM_MAPPER_PREFERRED_GET functions used in the wmme api
+        these wave device ids can be aligned with the directsound devices either by retrieving
+        the system interface device name using DRV_QUERYDEVICEINTERFACE or by using the wave device
+        id retrieved in KsPropertySetEnumerateCallback.
+
     old TODOs from phil, need to work out if these have been done:
         O- fix "patest_stop.c"
 */
 
+
 #include <stdio.h>
 #include <string.h> /* strlen() */
+#include <windows.h>
+#include <objbase.h>
+
+/*
+  We are only using DX3 in here, no need to polute the namespace - davidv
+*/
+#define DIRECTSOUND_VERSION 0x0300
+#include <dsound.h>
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+#include <dsconf.h>
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
 
 #include "pa_util.h"
 #include "pa_allocation.h"
@@ -76,8 +90,13 @@
 #include "pa_stream.h"
 #include "pa_cpuload.h"
 #include "pa_process.h"
+#include "pa_debugprint.h"
 
+#include "pa_win_ds.h"
 #include "pa_win_ds_dynlink.h"
+#include "pa_win_waveformat.h"
+#include "pa_win_wdmks_utils.h"
+
 
 #if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */
 #pragma comment( lib, "dsound.lib" )
@@ -168,9 +187,12 @@
 
 typedef struct PaWinDsDeviceInfo
 {
-    GUID                             guid;
-    GUID                            *lpGUID;
-    double                           sampleRates[3];
+    PaDeviceInfo        inheritedDeviceInfo;
+    GUID                guid;
+    GUID                *lpGUID;
+    double              sampleRates[3];
+    char deviceInputChannelCountIsKnown; /**<< if the system returns 0xFFFF then we don't really know the number of supported channels (1=>known, 0=>unknown)*/
+    char deviceOutputChannelCountIsKnown; /**<< if the system returns 0xFFFF then we don't really know the number of supported channels (1=>known, 0=>unknown)*/
 } PaWinDsDeviceInfo;
 
 typedef struct
@@ -182,7 +204,8 @@
     PaUtilAllocationGroup   *allocations;
 
     /* implementation specific data goes here */
-    PaWinDsDeviceInfo       *winDsDeviceInfos;
+
+    char                    comWasInitialized;
 
 } PaWinDsHostApiRepresentation;
 
@@ -269,6 +292,7 @@
     char *name; // allocated from parent's allocations, never deleted by this structure
     GUID guid;
     LPGUID lpGUID;
+    void *pnpInterface;  // wchar_t* interface path, allocated using the DS host api's allocation group
 } DSDeviceNameAndGUID;
 
 typedef struct DSDeviceNameAndGUIDVector{
@@ -280,6 +304,12 @@
     DSDeviceNameAndGUID *items; // Allocated using LocalAlloc()
 } DSDeviceNameAndGUIDVector;
 
+typedef struct DSDeviceNamesAndGUIDs{
+    PaWinDsHostApiRepresentation *winDsHostApi;
+    DSDeviceNameAndGUIDVector inputNamesAndGUIDs;
+    DSDeviceNameAndGUIDVector outputNamesAndGUIDs;
+} DSDeviceNamesAndGUIDs;
+
 static PaError InitializeDSDeviceNameAndGUIDVector(
         DSDeviceNameAndGUIDVector *guidVector, PaUtilAllocationGroup *allocations )
 {
@@ -326,6 +356,7 @@
                 newItems[i].lpGUID = &newItems[i].guid;
                 memcpy( &newItems[i].guid, guidVector->items[i].lpGUID, sizeof(GUID) );;
             }
+            newItems[i].pnpInterface = guidVector->items[i].pnpInterface;
         }
 
         LocalFree( guidVector->items );
@@ -397,12 +428,153 @@
         return FALSE;
     }
 
+    namesAndGUIDs->items[namesAndGUIDs->count].pnpInterface = 0;
+
     ++namesAndGUIDs->count;
     --namesAndGUIDs->free;
     
     return TRUE;
 }
 
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+
+static void *DuplicateWCharString( PaUtilAllocationGroup *allocations, wchar_t *source )
+{
+    size_t len;
+    wchar_t *result;
+
+    len = wcslen( source );
+    result = (wchar_t*)PaUtil_GroupAllocateMemory( allocations, (long) ((len+1) * sizeof(wchar_t)) );
+    wcscpy( result, source );
+    return result;
+}
+
+static BOOL CALLBACK KsPropertySetEnumerateCallback( PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data, LPVOID context )
+{
+    int i;
+    DSDeviceNamesAndGUIDs *deviceNamesAndGUIDs = (DSDeviceNamesAndGUIDs*)context;
+
+    if( data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER )
+    {
+        for( i=0; i < deviceNamesAndGUIDs->outputNamesAndGUIDs.count; ++i )
+        {
+            if( deviceNamesAndGUIDs->outputNamesAndGUIDs.items[i].lpGUID
+                && memcmp( &data->DeviceId, deviceNamesAndGUIDs->outputNamesAndGUIDs.items[i].lpGUID, sizeof(GUID) ) == 0 )
+            {
+                deviceNamesAndGUIDs->outputNamesAndGUIDs.items[i].pnpInterface = 
+                        (char*)DuplicateWCharString( deviceNamesAndGUIDs->winDsHostApi->allocations, data->Interface );
+                break;
+            }
+        }
+    }
+    else if( data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE )
+    {
+        for( i=0; i < deviceNamesAndGUIDs->inputNamesAndGUIDs.count; ++i )
+        {
+            if( deviceNamesAndGUIDs->inputNamesAndGUIDs.items[i].lpGUID
+                && memcmp( &data->DeviceId, deviceNamesAndGUIDs->inputNamesAndGUIDs.items[i].lpGUID, sizeof(GUID) ) == 0 )
+            {
+                deviceNamesAndGUIDs->inputNamesAndGUIDs.items[i].pnpInterface = 
+                        (char*)DuplicateWCharString( deviceNamesAndGUIDs->winDsHostApi->allocations, data->Interface );
+                break;
+            }
+        }
+    }
+
+    return TRUE;
+}
+
+
+static GUID pawin_CLSID_DirectSoundPrivate = 
+{ 0x11ab3ec0, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x00, 0xc0, 0x4f, 0xc2, 0x8a, 0xca };
+
+static GUID pawin_DSPROPSETID_DirectSoundDevice = 
+{ 0x84624f82, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x00, 0xc0, 0x4f, 0xc2, 0x8a, 0xca };
+
+static GUID pawin_IID_IKsPropertySet = 
+{ 0x31efac30, 0x515c, 0x11d0, 0xa9, 0xaa, 0x00, 0xaa, 0x00, 0x61, 0xbe, 0x93 };
+
+
+/*
+    FindDevicePnpInterfaces fills in the pnpInterface fields in deviceNamesAndGUIDs
+    with UNICODE file paths to the devices. The DS documentation mentions
+    at least two techniques by which these Interface paths can be found using IKsPropertySet on
+    the DirectSound class object. One is using the DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION 
+    property, and the other is using DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE.
+    I tried both methods and only the second worked. I found two postings on the
+    net from people who had the same problem with the first method, so I think the method used here is 
+    more common/likely to work. The probem is that IKsPropertySet_Get returns S_OK
+    but the fields of the device description are not filled in.
+
+    The mechanism we use works by registering an enumeration callback which is called for 
+    every DSound device. Our callback searches for a device in our deviceNamesAndGUIDs list
+    with the matching GUID and copies the pointer to the Interface path.
+    Note that we could have used this enumeration callback to perform the original 
+    device enumeration, however we choose not to so we can disable this step easily.
+
+    Apparently the IKsPropertySet mechanism was added in DirectSound 9c 2004
+    http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.mmedia/2004-12/0099.html
+
+        -- rossb
+*/
+static void FindDevicePnpInterfaces( DSDeviceNamesAndGUIDs *deviceNamesAndGUIDs )
+{
+    IClassFactory *pClassFactory;
+   
+    if( paWinDsDSoundEntryPoints.DllGetClassObject(&pawin_CLSID_DirectSoundPrivate, &IID_IClassFactory, (PVOID *) &pClassFactory) == S_OK ){
+        IKsPropertySet *pPropertySet;
+        if( pClassFactory->lpVtbl->CreateInstance( pClassFactory, NULL, &pawin_IID_IKsPropertySet, (PVOID *) &pPropertySet) == S_OK ){
+            
+            DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data;
+            ULONG bytesReturned;
+
+            data.Callback = KsPropertySetEnumerateCallback;
+            data.Context = deviceNamesAndGUIDs;
+
+            IKsPropertySet_Get( pPropertySet,
+                &pawin_DSPROPSETID_DirectSoundDevice,
+                DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W,
+                NULL,
+                0,
+                &data,
+                sizeof(data),
+                &bytesReturned
+            );
+            
+            IKsPropertySet_Release( pPropertySet );
+        }
+        pClassFactory->lpVtbl->Release( pClassFactory );
+    }
+
+    /*
+        The following code fragment, which I chose not to use, queries for the 
+        device interface for a device with a specific GUID:
+
+        ULONG BytesReturned;
+        DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA Property;
+
+        memset (&Property, 0, sizeof(Property));
+        Property.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
+        Property.DeviceId = *lpGUID;  
+
+        hr = IKsPropertySet_Get( pPropertySet,
+            &pawin_DSPROPSETID_DirectSoundDevice,
+            DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W,
+            NULL,
+            0,
+            &Property,
+            sizeof(Property),
+            &BytesReturned
+        );
+
+        if( hr == S_OK )
+        {
+            //pnpInterface = Property.Interface;
+        }
+    */
+}
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
+
 
 /* 
     GUIDs for emulated devices which we blacklist below.
@@ -418,7 +590,6 @@
     { 44100.0, 48000.0, 32000.0, 24000.0, 22050.0, 88200.0, 96000.0, 192000.0,
         16000.0, 12000.0, 11025.0, 9600.0, 8000.0 };
 
-
 /************************************************************************************
 ** Extract capabilities from an output device, and add it to the device info list
 ** if successful. This function assumes that there is enough room in the
@@ -427,18 +598,18 @@
 ** The device will not be added to the device list if any errors are encountered.
 */
 static PaError AddOutputDeviceInfoFromDirectSound(
-        PaWinDsHostApiRepresentation *winDsHostApi, char *name, LPGUID lpGUID )
+        PaWinDsHostApiRepresentation *winDsHostApi, char *name, LPGUID lpGUID, char *pnpInterface )
 {
     PaUtilHostApiRepresentation  *hostApi = &winDsHostApi->inheritedHostApiRep;
-    PaDeviceInfo                 *deviceInfo = hostApi->deviceInfos[hostApi->info.deviceCount];
-    PaWinDsDeviceInfo            *winDsDeviceInfo = &winDsHostApi->winDsDeviceInfos[hostApi->info.deviceCount];
+    PaWinDsDeviceInfo            *winDsDeviceInfo = (PaWinDsDeviceInfo*) hostApi->deviceInfos[hostApi->info.deviceCount];
+    PaDeviceInfo                 *deviceInfo = &winDsDeviceInfo->inheritedDeviceInfo;
     HRESULT                       hr;
     LPDIRECTSOUND                 lpDirectSound;
     DSCAPS                        caps;
     int                           deviceOK = TRUE;
     PaError                       result = paNoError;
     int                           i;
-    
+
     /* Copy GUID to the device info structure. Set pointer. */
     if( lpGUID == NULL )
     {
@@ -449,7 +620,6 @@
         memcpy( &winDsDeviceInfo->guid, lpGUID, sizeof(GUID) );
         winDsDeviceInfo->lpGUID = &winDsDeviceInfo->guid;
     }
-
     
     if( lpGUID )
     {
@@ -529,8 +699,39 @@
             if( deviceOK )
             {
                 deviceInfo->maxInputChannels = 0;
-                /* Mono or stereo device? */
-                deviceInfo->maxOutputChannels = ( caps.dwFlags & DSCAPS_PRIMARYSTEREO ) ? 2 : 1;
+                winDsDeviceInfo->deviceInputChannelCountIsKnown = 1;
+
+                /* DS output capabilities only indicate supported number of channels
+                   using two flags which indicate mono and/or stereo.
+                   We assume that stereo devices may support more than 2 channels
+                   (as is the case with 5.1 devices for example) and so
+                   set deviceOutputChannelCountIsKnown to 0 (unknown).
+                   In this case OpenStream will try to open the device
+                   when the user requests more than 2 channels, rather than
+                   returning an error. 
+                */
+                if( caps.dwFlags & DSCAPS_PRIMARYSTEREO )
+                {
+                    deviceInfo->maxOutputChannels = 2;
+                    winDsDeviceInfo->deviceOutputChannelCountIsKnown = 0;
+                }
+                else
+                {
+                    deviceInfo->maxOutputChannels = 1;
+                    winDsDeviceInfo->deviceOutputChannelCountIsKnown = 1;
+                }
+
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+                if( pnpInterface )
+                {
+                    int count = PaWin_WDMKS_QueryFilterMaximumChannelCount( pnpInterface, /* isInput= */ 0  );
+                    if( count > 0 )
+                    {
+                        deviceInfo->maxOutputChannels = count;
+                        winDsDeviceInfo->deviceOutputChannelCountIsKnown = 1;
+                    }
+                }
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
 
                 deviceInfo->defaultLowInputLatency = 0.;    /** @todo IMPLEMENT ME */
                 deviceInfo->defaultLowOutputLatency = 0.;   /** @todo IMPLEMENT ME */
@@ -547,8 +748,8 @@
                     for( i = 0; i < PA_DEFAULTSAMPLERATESEARCHORDER_COUNT_; ++i )
                     {
                         if( defaultSampleRateSearchOrder_[i] >= caps.dwMinSecondarySampleRate
-                                && defaultSampleRateSearchOrder_[i] <= caps.dwMaxSecondarySampleRate ){
-
+                                && defaultSampleRateSearchOrder_[i] <= caps.dwMaxSecondarySampleRate )
+                        {
                             deviceInfo->defaultSampleRate = defaultSampleRateSearchOrder_[i];
                             break;
                         }
@@ -614,11 +815,11 @@
 ** The device will not be added to the device list if any errors are encountered.
 */
 static PaError AddInputDeviceInfoFromDirectSoundCapture(
-        PaWinDsHostApiRepresentation *winDsHostApi, char *name, LPGUID lpGUID )
+        PaWinDsHostApiRepresentation *winDsHostApi, char *name, LPGUID lpGUID, char *pnpInterface )
 {
     PaUtilHostApiRepresentation  *hostApi = &winDsHostApi->inheritedHostApiRep;
-    PaDeviceInfo                 *deviceInfo = hostApi->deviceInfos[hostApi->info.deviceCount];
-    PaWinDsDeviceInfo            *winDsDeviceInfo = &winDsHostApi->winDsDeviceInfos[hostApi->info.deviceCount];
+    PaWinDsDeviceInfo            *winDsDeviceInfo = (PaWinDsDeviceInfo*) hostApi->deviceInfos[hostApi->info.deviceCount];
+    PaDeviceInfo                 *deviceInfo = &winDsDeviceInfo->inheritedDeviceInfo;
     HRESULT                       hr;
     LPDIRECTSOUNDCAPTURE          lpDirectSoundCapture;
     DSCCAPS                       caps;
@@ -636,7 +837,6 @@
         memcpy( &winDsDeviceInfo->guid, lpGUID, sizeof(GUID) );
     }
 
-
     hr = paWinDsDSoundEntryPoints.DirectSoundCaptureCreate( lpGUID, &lpDirectSoundCapture, NULL );
 
     /** try using CoCreateInstance because DirectSoundCreate was hanging under
@@ -678,7 +878,22 @@
             if( deviceOK )
             {
                 deviceInfo->maxInputChannels = caps.dwChannels;
+                winDsDeviceInfo->deviceInputChannelCountIsKnown = 1;
+
                 deviceInfo->maxOutputChannels = 0;
+                winDsDeviceInfo->deviceOutputChannelCountIsKnown = 1;
+
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+                if( pnpInterface )
+                {
+                    int count = PaWin_WDMKS_QueryFilterMaximumChannelCount( pnpInterface, /* isInput= */ 1  );
+                    if( count > 0 )
+                    {
+                        deviceInfo->maxInputChannels = count;
+                        winDsDeviceInfo->deviceInputChannelCountIsKnown = 1;
+                    }
+                }
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
 
                 deviceInfo->defaultLowInputLatency = 0.;    /** @todo IMPLEMENT ME */
                 deviceInfo->defaultLowOutputLatency = 0.;   /** @todo IMPLEMENT ME */
@@ -770,17 +985,30 @@
     PaError result = paNoError;
     int i, deviceCount;
     PaWinDsHostApiRepresentation *winDsHostApi;
-    DSDeviceNameAndGUIDVector inputNamesAndGUIDs, outputNamesAndGUIDs;
-    PaDeviceInfo *deviceInfoArray;
+    DSDeviceNamesAndGUIDs deviceNamesAndGUIDs;
+
+    PaWinDsDeviceInfo *deviceInfoArray;
+    char comWasInitialized = 0;
 
-    HRESULT hr = CoInitialize(NULL);        /** @todo: should uninitialize too */
-    if( FAILED(hr) ){
+    /*
+        If COM is already initialized CoInitialize will either return
+        FALSE, or RPC_E_CHANGED_MODE if it was initialised in a different
+        threading mode. In either case we shouldn't consider it an error
+        but we need to be careful to not call CoUninitialize() if 
+        RPC_E_CHANGED_MODE was returned.
+    */
+
+    HRESULT hr = CoInitialize(NULL);
+    if( FAILED(hr) && hr != RPC_E_CHANGED_MODE )
         return paUnanticipatedHostError;
-    }            
+
+    if( hr != RPC_E_CHANGED_MODE )
+        comWasInitialized = 1;
 
     /* initialise guid vectors so they can be safely deleted on error */
-    inputNamesAndGUIDs.items = NULL;
-    outputNamesAndGUIDs.items = NULL;
+    deviceNamesAndGUIDs.winDsHostApi = NULL;
+    deviceNamesAndGUIDs.inputNamesAndGUIDs.items = NULL;
+    deviceNamesAndGUIDs.outputNamesAndGUIDs.items = NULL;
 
     PaWinDs_InitializeDSoundEntryPoints();
 
@@ -791,6 +1019,8 @@
         goto error;
     }
 
+    winDsHostApi->comWasInitialized = comWasInitialized;
+
     winDsHostApi->allocations = PaUtil_CreateAllocationGroup();
     if( !winDsHostApi->allocations )
     {
@@ -810,32 +1040,39 @@
     
 /* DSound - enumerate devices to count them and to gather their GUIDs */
 
-
-    result = InitializeDSDeviceNameAndGUIDVector( &inputNamesAndGUIDs, winDsHostApi->allocations );
+    result = InitializeDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs, winDsHostApi->allocations );
     if( result != paNoError )
         goto error;
 
-    result = InitializeDSDeviceNameAndGUIDVector( &outputNamesAndGUIDs, winDsHostApi->allocations );
+    result = InitializeDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.outputNamesAndGUIDs, winDsHostApi->allocations );
     if( result != paNoError )
         goto error;
 
-    paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerate( (LPDSENUMCALLBACK)CollectGUIDsProc, (void *)&inputNamesAndGUIDs );
+    paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerate( (LPDSENUMCALLBACK)CollectGUIDsProc, (void *)&deviceNamesAndGUIDs.inputNamesAndGUIDs );
 
-    paWinDsDSoundEntryPoints.DirectSoundEnumerate( (LPDSENUMCALLBACK)CollectGUIDsProc, (void *)&outputNamesAndGUIDs );
+    paWinDsDSoundEntryPoints.DirectSoundEnumerate( (LPDSENUMCALLBACK)CollectGUIDsProc, (void *)&deviceNamesAndGUIDs.outputNamesAndGUIDs );
 
-    if( inputNamesAndGUIDs.enumerationError != paNoError )
+    if( deviceNamesAndGUIDs.inputNamesAndGUIDs.enumerationError != paNoError )
     {
-        result = inputNamesAndGUIDs.enumerationError;
+        result = deviceNamesAndGUIDs.inputNamesAndGUIDs.enumerationError;
         goto error;
     }
 
-    if( outputNamesAndGUIDs.enumerationError != paNoError )
+    if( deviceNamesAndGUIDs.outputNamesAndGUIDs.enumerationError != paNoError )
     {
-        result = outputNamesAndGUIDs.enumerationError;
+        result = deviceNamesAndGUIDs.outputNamesAndGUIDs.enumerationError;
         goto error;
     }
 
-    deviceCount = inputNamesAndGUIDs.count + outputNamesAndGUIDs.count;
+    deviceCount = deviceNamesAndGUIDs.inputNamesAndGUIDs.count + deviceNamesAndGUIDs.outputNamesAndGUIDs.count;
+
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+    if( deviceCount > 0 )
+    {
+        deviceNamesAndGUIDs.winDsHostApi = winDsHostApi;
+        FindDevicePnpInterfaces( &deviceNamesAndGUIDs );
+    }
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
 
     if( deviceCount > 0 )
     {
@@ -849,18 +1086,9 @@
         }
 
         /* allocate all PaDeviceInfo structs in a contiguous block */
-        deviceInfoArray = (PaDeviceInfo*)PaUtil_GroupAllocateMemory(
-                winDsHostApi->allocations, sizeof(PaDeviceInfo) * deviceCount );
-        if( !deviceInfoArray )
-        {
-            result = paInsufficientMemory;
-            goto error;
-        }
-
-        /* allocate all DSound specific info structs in a contiguous block */
-        winDsHostApi->winDsDeviceInfos = (PaWinDsDeviceInfo*)PaUtil_GroupAllocateMemory(
+        deviceInfoArray = (PaWinDsDeviceInfo*)PaUtil_GroupAllocateMemory(
                 winDsHostApi->allocations, sizeof(PaWinDsDeviceInfo) * deviceCount );
-        if( !winDsHostApi->winDsDeviceInfos )
+        if( !deviceInfoArray )
         {
             result = paInsufficientMemory;
             goto error;
@@ -868,37 +1096,39 @@
 
         for( i=0; i < deviceCount; ++i )
         {
-            PaDeviceInfo *deviceInfo = &deviceInfoArray[i];
+            PaDeviceInfo *deviceInfo = &deviceInfoArray[i].inheritedDeviceInfo;
             deviceInfo->structVersion = 2;
             deviceInfo->hostApi = hostApiIndex;
             deviceInfo->name = 0;
             (*hostApi)->deviceInfos[i] = deviceInfo;
         }
 
-        for( i=0; i< inputNamesAndGUIDs.count; ++i )
+        for( i=0; i < deviceNamesAndGUIDs.inputNamesAndGUIDs.count; ++i )
         {
             result = AddInputDeviceInfoFromDirectSoundCapture( winDsHostApi,
-                    inputNamesAndGUIDs.items[i].name,
-                    inputNamesAndGUIDs.items[i].lpGUID );
+                    deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].name,
+                    deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].lpGUID,
+                    deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].pnpInterface );
             if( result != paNoError )
                 goto error;
         }
 
-        for( i=0; i< outputNamesAndGUIDs.count; ++i )
+        for( i=0; i < deviceNamesAndGUIDs.outputNamesAndGUIDs.count; ++i )
         {
             result = AddOutputDeviceInfoFromDirectSound( winDsHostApi,
-                    outputNamesAndGUIDs.items[i].name,
-                    outputNamesAndGUIDs.items[i].lpGUID );
+                    deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].name,
+                    deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].lpGUID,
+                    deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].pnpInterface );
             if( result != paNoError )
                 goto error;
         }
     }    
 
-    result = TerminateDSDeviceNameAndGUIDVector( &inputNamesAndGUIDs );
+    result = TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs );
     if( result != paNoError )
         goto error;
 
-    result = TerminateDSDeviceNameAndGUIDVector( &outputNamesAndGUIDs );
+    result = TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.outputNamesAndGUIDs );
     if( result != paNoError )
         goto error;
 
@@ -932,8 +1162,11 @@
         PaUtil_FreeMemory( winDsHostApi );
     }
 
-    TerminateDSDeviceNameAndGUIDVector( &inputNamesAndGUIDs );
-    TerminateDSDeviceNameAndGUIDVector( &outputNamesAndGUIDs );
+    TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs );
+    TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.outputNamesAndGUIDs );
+
+    if( comWasInitialized )
+        CoUninitialize();
 
     return result;
 }
@@ -943,6 +1176,7 @@
 static void Terminate( struct PaUtilHostApiRepresentation *hostApi )
 {
     PaWinDsHostApiRepresentation *winDsHostApi = (PaWinDsHostApiRepresentation*)hostApi;
+    char comWasInitialized = winDsHostApi->comWasInitialized;
 
     /*
         IMPLEMENT ME:
@@ -959,7 +1193,8 @@
 
     PaWinDs_TerminateDSoundEntryPoints();
 
-    CoUninitialize();
+    if( comWasInitialized )
+        CoUninitialize();
 }
 
 
@@ -994,17 +1229,40 @@
     return minLatencyMsec;
 }
 
+static PaError ValidateWinDirectSoundSpecificStreamInfo(
+        const PaStreamParameters *streamParameters,
+        const PaWinDirectSoundStreamInfo *streamInfo )
+{
+	if( streamInfo )
+	{
+	    if( streamInfo->size != sizeof( PaWinDirectSoundStreamInfo )
+	            || streamInfo->version != 1 )
+	    {
+	        return paIncompatibleHostApiSpecificStreamInfo;
+	    }
+	}
+
+	return paNoError;
+}
+
 /***********************************************************************************/
 static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
                                   const PaStreamParameters *inputParameters,
                                   const PaStreamParameters *outputParameters,
                                   double sampleRate )
 {
+    PaError result;
+    PaWinDsDeviceInfo *inputWinDsDeviceInfo, *outputWinDsDeviceInfo;
+    PaDeviceInfo *inputDeviceInfo, *outputDeviceInfo;
     int inputChannelCount, outputChannelCount;
     PaSampleFormat inputSampleFormat, outputSampleFormat;
-    
+    PaWinDirectSoundStreamInfo *inputStreamInfo, *outputStreamInfo;
+
     if( inputParameters )
     {
+        inputWinDsDeviceInfo = (PaWinDsDeviceInfo*) hostApi->deviceInfos[ inputParameters->device ];
+        inputDeviceInfo = &inputWinDsDeviceInfo->inheritedDeviceInfo;
+
         inputChannelCount = inputParameters->channelCount;
         inputSampleFormat = inputParameters->sampleFormat;
 
@@ -1015,12 +1273,14 @@
             return paInvalidDevice;
 
         /* check that input device can support inputChannelCount */
-        if( inputChannelCount > hostApi->deviceInfos[ inputParameters->device ]->maxInputChannels )
+        if( inputWinDsDeviceInfo->deviceInputChannelCountIsKnown
+                && inputChannelCount > inputDeviceInfo->maxInputChannels )
             return paInvalidChannelCount;
 
         /* validate inputStreamInfo */
-        if( inputParameters->hostApiSpecificStreamInfo )
-            return paIncompatibleHostApiSpecificStreamInfo; /* this implementation doesn't use custom stream info */
+        inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
+		result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
+		if( result != paNoError ) return result;
     }
     else
     {
@@ -1029,6 +1289,9 @@
 
     if( outputParameters )
     {
+        outputWinDsDeviceInfo = (PaWinDsDeviceInfo*) hostApi->deviceInfos[ outputParameters->device ];
+        outputDeviceInfo = &outputWinDsDeviceInfo->inheritedDeviceInfo;
+
         outputChannelCount = outputParameters->channelCount;
         outputSampleFormat = outputParameters->sampleFormat;
         
@@ -1039,12 +1302,14 @@
             return paInvalidDevice;
 
         /* check that output device can support inputChannelCount */
-        if( outputChannelCount > hostApi->deviceInfos[ outputParameters->device ]->maxOutputChannels )
+        if( outputWinDsDeviceInfo->deviceOutputChannelCountIsKnown
+                && outputChannelCount > outputDeviceInfo->maxOutputChannels )
             return paInvalidChannelCount;
 
         /* validate outputStreamInfo */
-        if( outputParameters->hostApiSpecificStreamInfo )
-            return paIncompatibleHostApiSpecificStreamInfo; /* this implementation doesn't use custom stream info */
+        outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
+		result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
+		if( result != paNoError ) return result;
     }
     else
     {
@@ -1115,22 +1380,14 @@
 }
 
 
-static HRESULT InitInputBuffer( PaWinDsStream *stream, unsigned long nFrameRate, WORD nChannels, int bytesPerBuffer )
+static HRESULT InitInputBuffer( PaWinDsStream *stream, PaSampleFormat sampleFormat, unsigned long nFrameRate, WORD nChannels, int bytesPerBuffer, PaWinWaveFormatChannelMask channelMask )
 {
     DSCBUFFERDESC  captureDesc;
-    WAVEFORMATEX   wfFormat;
+    PaWinWaveFormat waveFormat;
     HRESULT        result;
     
-    stream->bytesPerInputFrame = nChannels * sizeof(short);
+    stream->bytesPerInputFrame = nChannels * Pa_GetSampleSize(sampleFormat);
 
-    // Define the buffer format
-    wfFormat.wFormatTag      = WAVE_FORMAT_PCM;
-    wfFormat.nChannels       = nChannels;
-    wfFormat.nSamplesPerSec  = nFrameRate;
-    wfFormat.wBitsPerSample  = 8 * sizeof(short);
-    wfFormat.nBlockAlign     = (WORD)(wfFormat.nChannels * (wfFormat.wBitsPerSample / 8));
-    wfFormat.nAvgBytesPerSec = wfFormat.nSamplesPerSec * wfFormat.nBlockAlign;
-    wfFormat.cbSize          = 0;   /* No extended format info. */
     stream->inputSize = bytesPerBuffer;
     // ----------------------------------------------------------------------
     // Setup the secondary buffer description
@@ -1138,34 +1395,50 @@
     captureDesc.dwSize = sizeof(DSCBUFFERDESC);
     captureDesc.dwFlags =  0;
     captureDesc.dwBufferBytes = bytesPerBuffer;
-    captureDesc.lpwfxFormat = &wfFormat;
+    captureDesc.lpwfxFormat = (WAVEFORMATEX*)&waveFormat;
+    
     // Create the capture buffer
-    if ((result = IDirectSoundCapture_CreateCaptureBuffer( stream->pDirectSoundCapture,
-                  &captureDesc, &stream->pDirectSoundInputBuffer, NULL)) != DS_OK) return result;
+
+    // first try WAVEFORMATEXTENSIBLE. if this fails, fall back to WAVEFORMATEX
+    PaWin_InitializeWaveFormatExtensible( &waveFormat, nChannels, 
+                sampleFormat, nFrameRate, channelMask );
+
+    if( IDirectSoundCapture_CreateCaptureBuffer( stream->pDirectSoundCapture,
+                  &captureDesc, &stream->pDirectSoundInputBuffer, NULL) != DS_OK )
+    {
+        PaWin_InitializeWaveFormatEx( &waveFormat, nChannels, sampleFormat, nFrameRate );
+
+        if ((result = IDirectSoundCapture_CreateCaptureBuffer( stream->pDirectSoundCapture,
+                    &captureDesc, &stream->pDirectSoundInputBuffer, NULL)) != DS_OK) return result;
+    }
+
     stream->readOffset = 0;  // reset last read position to start of buffer
     return DS_OK;
 }
 
 
-static HRESULT InitOutputBuffer( PaWinDsStream *stream, unsigned long nFrameRate, WORD nChannels, int bytesPerBuffer )
+static HRESULT InitOutputBuffer( PaWinDsStream *stream, PaSampleFormat sampleFormat, unsigned long nFrameRate, WORD nChannels, int bytesPerBuffer, PaWinWaveFormatChannelMask channelMask )
 {
+    /** @todo FIXME: if InitOutputBuffer returns an error I'm not sure it frees all resources cleanly */
+
     DWORD          dwDataLen;
     DWORD          playCursor;
     HRESULT        result;
     LPDIRECTSOUNDBUFFER pPrimaryBuffer;
     HWND           hWnd;
     HRESULT        hr;
-    WAVEFORMATEX   wfFormat;
+    PaWinWaveFormat waveFormat;
     DSBUFFERDESC   primaryDesc;
     DSBUFFERDESC   secondaryDesc;
     unsigned char* pDSBuffData;
     LARGE_INTEGER  counterFrequency;
+    int bytesPerSample = Pa_GetSampleSize(sampleFormat);
 
     stream->outputBufferSizeBytes = bytesPerBuffer;
     stream->outputIsRunning = FALSE;
     stream->outputUnderflowCount = 0;
     stream->dsw_framesWritten = 0;
-    stream->bytesPerOutputFrame = nChannels * sizeof(short);
+    stream->bytesPerOutputFrame = nChannels * bytesPerSample;
 
     // We were using getForegroundWindow() but sometimes the ForegroundWindow may not be the
     // applications's window. Also if that window is closed before the Buffer is closed
@@ -1199,16 +1472,19 @@
     // Create the buffer
     if ((result = IDirectSound_CreateSoundBuffer( stream->pDirectSound,
                   &primaryDesc, &pPrimaryBuffer, NULL)) != DS_OK) return result;
-    // Define the buffer format
-    wfFormat.wFormatTag = WAVE_FORMAT_PCM;
-    wfFormat.nChannels = nChannels;
-    wfFormat.nSamplesPerSec = nFrameRate;
-    wfFormat.wBitsPerSample = 8 * sizeof(short);
-    wfFormat.nBlockAlign = (WORD)(wfFormat.nChannels * (wfFormat.wBitsPerSample / 8));
-    wfFormat.nAvgBytesPerSec = wfFormat.nSamplesPerSec * wfFormat.nBlockAlign;
-    wfFormat.cbSize = 0;  /* No extended format info. */
+
     // Set the primary buffer's format
-    if((result = IDirectSoundBuffer_SetFormat( pPrimaryBuffer, &wfFormat)) != DS_OK) return result;
+
+    // first try WAVEFORMATEXTENSIBLE. if this fails, fall back to WAVEFORMATEX
+    PaWin_InitializeWaveFormatExtensible( &waveFormat, nChannels, 
+                sampleFormat, nFrameRate, channelMask );
+
+    if( IDirectSoundBuffer_SetFormat( pPrimaryBuffer, (WAVEFORMATEX*)&waveFormat) != DS_OK )
+    {
+        PaWin_InitializeWaveFormatEx( &waveFormat, nChannels, sampleFormat, nFrameRate );
+
+        if((result = IDirectSoundBuffer_SetFormat( pPrimaryBuffer, (WAVEFORMATEX*)&waveFormat)) != DS_OK) return result;
+    }
 
     // ----------------------------------------------------------------------
     // Setup the secondary buffer description
@@ -1216,7 +1492,7 @@
     secondaryDesc.dwSize = sizeof(DSBUFFERDESC);
     secondaryDesc.dwFlags =  DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2;
     secondaryDesc.dwBufferBytes = bytesPerBuffer;
-    secondaryDesc.lpwfxFormat = &wfFormat;
+    secondaryDesc.lpwfxFormat = (WAVEFORMATEX*)&waveFormat;
     // Create the secondary buffer
     if ((result = IDirectSound_CreateSoundBuffer( stream->pDirectSound,
                   &secondaryDesc, &stream->pDirectSoundOutputBuffer, NULL)) != DS_OK) return result;
@@ -1229,7 +1505,7 @@
     if ((result = IDirectSoundBuffer_Unlock( stream->pDirectSoundOutputBuffer, pDSBuffData, dwDataLen, NULL, 0)) != DS_OK) return result;
     if( QueryPerformanceFrequency( &counterFrequency ) )
     {
-        int framesInBuffer = bytesPerBuffer / (nChannels * sizeof(short));
+        int framesInBuffer = bytesPerBuffer / (nChannels * bytesPerSample);
         stream->perfCounterTicksPerBuffer.QuadPart = (counterFrequency.QuadPart * framesInBuffer) / nFrameRate;
     }
     else
@@ -1249,7 +1525,6 @@
     return DS_OK;
 }
 
-
 /***********************************************************************************/
 /* see pa_hostapi.h for a list of validity guarantees made about OpenStream parameters */
 
@@ -1266,13 +1541,20 @@
     PaError result = paNoError;
     PaWinDsHostApiRepresentation *winDsHostApi = (PaWinDsHostApiRepresentation*)hostApi;
     PaWinDsStream *stream = 0;
+    PaWinDsDeviceInfo *inputWinDsDeviceInfo, *outputWinDsDeviceInfo;
+    PaDeviceInfo *inputDeviceInfo, *outputDeviceInfo;
     int inputChannelCount, outputChannelCount;
     PaSampleFormat inputSampleFormat, outputSampleFormat;
     PaSampleFormat hostInputSampleFormat, hostOutputSampleFormat;
     unsigned long suggestedInputLatencyFrames, suggestedOutputLatencyFrames;
+    PaWinDirectSoundStreamInfo *inputStreamInfo, *outputStreamInfo;
+    PaWinWaveFormatChannelMask inputChannelMask, outputChannelMask;
 
     if( inputParameters )
     {
+        inputWinDsDeviceInfo = (PaWinDsDeviceInfo*) hostApi->deviceInfos[ inputParameters->device ];
+        inputDeviceInfo = &inputWinDsDeviceInfo->inheritedDeviceInfo;
+
         inputChannelCount = inputParameters->channelCount;
         inputSampleFormat = inputParameters->sampleFormat;
         suggestedInputLatencyFrames = (unsigned long)(inputParameters->suggestedLatency * sampleRate);
@@ -1286,12 +1568,19 @@
             return paInvalidDevice;
 
         /* check that input device can support inputChannelCount */
-        if( inputChannelCount > hostApi->deviceInfos[ inputParameters->device ]->maxInputChannels )
+        if( inputWinDsDeviceInfo->deviceInputChannelCountIsKnown
+                && inputChannelCount > inputDeviceInfo->maxInputChannels )
             return paInvalidChannelCount;
             
         /* validate hostApiSpecificStreamInfo */
-        if( inputParameters->hostApiSpecificStreamInfo )
-            return paIncompatibleHostApiSpecificStreamInfo; /* this implementation doesn't use custom stream info */
+        inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
+		result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
+		if( result != paNoError ) return result;
+
+        if( inputStreamInfo && inputStreamInfo->flags & paWinDirectSoundUseChannelMask )
+            inputChannelMask = inputStreamInfo->channelMask;
+        else
+            inputChannelMask = PaWin_DefaultChannelMask( inputChannelCount );
     }
     else
     {
@@ -1303,6 +1592,9 @@
 
     if( outputParameters )
     {
+        outputWinDsDeviceInfo = (PaWinDsDeviceInfo*) hostApi->deviceInfos[ outputParameters->device ];
+        outputDeviceInfo = &outputWinDsDeviceInfo->inheritedDeviceInfo;
+
         outputChannelCount = outputParameters->channelCount;
         outputSampleFormat = outputParameters->sampleFormat;
         suggestedOutputLatencyFrames = (unsigned long)(outputParameters->suggestedLatency * sampleRate);
@@ -1312,13 +1604,20 @@
         if( outputParameters->device == paUseHostApiSpecificDeviceSpecification )
             return paInvalidDevice;
 
-        /* check that output device can support inputChannelCount */
-        if( outputChannelCount > hostApi->deviceInfos[ outputParameters->device ]->maxOutputChannels )
+        /* check that output device can support outputChannelCount */
+        if( outputWinDsDeviceInfo->deviceOutputChannelCountIsKnown
+                && outputChannelCount > outputDeviceInfo->maxOutputChannels )
             return paInvalidChannelCount;
 
         /* validate hostApiSpecificStreamInfo */
-        if( outputParameters->hostApiSpecificStreamInfo )
-            return paIncompatibleHostApiSpecificStreamInfo; /* this implementation doesn't use custom stream info */            
+        outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
+		result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
+		if( result != paNoError ) return result;   
+
+        if( outputStreamInfo && outputStreamInfo->flags & paWinDirectSoundUseChannelMask )
+            outputChannelMask = outputStreamInfo->channelMask;
+        else
+            outputChannelMask = PaWin_DefaultChannelMask( outputChannelCount );
     }
     else
     {
@@ -1384,8 +1683,11 @@
     if( inputParameters )
     {
         /* IMPLEMENT ME - establish which  host formats are available */
+        PaSampleFormat nativeInputFormats = paInt16;
+        //PaSampleFormat nativeFormats = paUInt8 | paInt16 | paInt24 | paInt32 | paFloat32;
+
         hostInputSampleFormat =
-            PaUtil_SelectClosestAvailableFormat( paInt16 /* native formats */, inputParameters->sampleFormat );
+            PaUtil_SelectClosestAvailableFormat( nativeInputFormats, inputParameters->sampleFormat );
     }
 	else
 	{
@@ -1395,8 +1697,11 @@
     if( outputParameters )
     {
         /* IMPLEMENT ME - establish which  host formats are available */
+        PaSampleFormat nativeOutputFormats = paInt16;
+        //PaSampleFormat nativeOutputFormats = paUInt8 | paInt16 | paInt24 | paInt32 | paFloat32;
+
         hostOutputSampleFormat =
-            PaUtil_SelectClosestAvailableFormat( paInt16 /* native formats */, outputParameters->sampleFormat );
+            PaUtil_SelectClosestAvailableFormat( nativeOutputFormats, outputParameters->sampleFormat );
     }
     else
 	{
@@ -1474,7 +1779,8 @@
             DBUG(("PaHost_OpenStream: deviceID = 0x%x\n", outputParameters->device));
             */
             
-            bytesPerDirectSoundBuffer = stream->framesPerDSBuffer * outputParameters->channelCount * sizeof(short);
+            int bytesPerSample = Pa_GetSampleSize(hostOutputSampleFormat);
+            bytesPerDirectSoundBuffer = stream->framesPerDSBuffer * outputParameters->channelCount * bytesPerSample;
             if( bytesPerDirectSoundBuffer < DSBSIZE_MIN )
             {
                 result = paBufferTooSmall;
@@ -1486,9 +1792,10 @@
                 goto error;
             }
 
+            hr = paWinDsDSoundEntryPoints.DirectSoundCreate( 
+                ((PaWinDsDeviceInfo*)hostApi->deviceInfos[outputParameters->device])->lpGUID,
+                &stream->pDirectSound, NULL );
 
-            hr = paWinDsDSoundEntryPoints.DirectSoundCreate( winDsHostApi->winDsDeviceInfos[outputParameters->device].lpGUID,
-                        &stream->pDirectSound, NULL );
             if( hr != DS_OK )
             {
                 ERR_RPT(("PortAudio: DirectSoundCreate() failed!\n"));
@@ -1497,8 +1804,10 @@
                 goto error;
             }
             hr = InitOutputBuffer( stream,
+                                       hostOutputSampleFormat,
                                        (unsigned long) (sampleRate + 0.5),
-                                       (WORD)outputParameters->channelCount, bytesPerDirectSoundBuffer );
+                                       (WORD)outputParameters->channelCount, bytesPerDirectSoundBuffer,
+                                       outputChannelMask );
             DBUG(("InitOutputBuffer() returns %x\n", hr));
             if( hr != DS_OK )
             {
@@ -1520,7 +1829,8 @@
             DBUG(("PaHost_OpenStream: deviceID = 0x%x\n", inputParameters->device));
             */
             
-            bytesPerDirectSoundBuffer = stream->framesPerDSBuffer * inputParameters->channelCount * sizeof(short);
+            int bytesPerSample = Pa_GetSampleSize(hostInputSampleFormat);
+            bytesPerDirectSoundBuffer = stream->framesPerDSBuffer * inputParameters->channelCount * bytesPerSample;
             if( bytesPerDirectSoundBuffer < DSBSIZE_MIN )
             {
                 result = paBufferTooSmall;
@@ -1532,8 +1842,9 @@
                 goto error;
             }
 
-            hr = paWinDsDSoundEntryPoints.DirectSoundCaptureCreate( winDsHostApi->winDsDeviceInfos[inputParameters->device].lpGUID,
-                        &stream->pDirectSoundCapture,   NULL );
+            hr = paWinDsDSoundEntryPoints.DirectSoundCaptureCreate( 
+                    ((PaWinDsDeviceInfo*)hostApi->deviceInfos[inputParameters->device])->lpGUID,
+                    &stream->pDirectSoundCapture, NULL );
             if( hr != DS_OK )
             {
                 ERR_RPT(("PortAudio: DirectSoundCaptureCreate() failed!\n"));
@@ -1542,8 +1853,10 @@
                 goto error;
             }
             hr = InitInputBuffer( stream,
+                                      hostInputSampleFormat,
                                       (unsigned long) (sampleRate + 0.5),
-                                      (WORD)inputParameters->channelCount, bytesPerDirectSoundBuffer );
+                                      (WORD)inputParameters->channelCount, bytesPerDirectSoundBuffer,
+                                      inputChannelMask );
             DBUG(("InitInputBuffer() returns %x\n", hr));
             if( hr != DS_OK )
             {
@@ -1885,7 +2198,8 @@
             }
         }
 
-        if( !stream->isActive ){
+        if( !stream->isActive )
+        {
             if( stream->streamRepresentation.streamFinishedCallback != 0 )
                 stream->streamRepresentation.streamFinishedCallback( stream->streamRepresentation.userData );
         }

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.c	Mon Aug  4 21:29:58 2008
@@ -49,6 +49,14 @@
 PaWinDsDSoundEntryPoints paWinDsDSoundEntryPoints = { 0, 0, 0, 0, 0, 0, 0 };
 
 
+static HRESULT WINAPI DummyDllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
+{
+    (void)rclsid; /* unused parameter */
+    (void)riid; /* unused parameter */
+    (void)ppv; /* unused parameter */
+    return CLASS_E_CLASSNOTAVAILABLE;
+}
+
 static HRESULT WINAPI DummyDirectSoundCreate(LPGUID lpcGuidDevice, LPDIRECTSOUND *ppDS, LPUNKNOWN pUnkOuter)
 {
     (void)lpcGuidDevice; /* unused parameter */
@@ -99,6 +107,12 @@
     paWinDsDSoundEntryPoints.hInstance_ = LoadLibrary("dsound.dll");
     if( paWinDsDSoundEntryPoints.hInstance_ != NULL )
     {
+        paWinDsDSoundEntryPoints.DllGetClassObject =
+                (HRESULT (WINAPI *)(REFCLSID, REFIID , LPVOID *))
+                GetProcAddress( paWinDsDSoundEntryPoints.hInstance_, "DllGetClassObject" );
+        if( paWinDsDSoundEntryPoints.DllGetClassObject == NULL )
+            paWinDsDSoundEntryPoints.DllGetClassObject = DummyDllGetClassObject;
+
         paWinDsDSoundEntryPoints.DirectSoundCreate =
                 (HRESULT (WINAPI *)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN))
                 GetProcAddress( paWinDsDSoundEntryPoints.hInstance_, "DirectSoundCreate" );

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/dsound/pa_win_ds_dynlink.h	Mon Aug  4 21:29:58 2008
@@ -48,7 +48,7 @@
 #define INCLUDED_PA_DSOUND_DYNLINK_H
 
 /* on Borland compilers, WIN32 doesn't seem to be defined by default, which
-    breaks DSound.h. Adding the define here fixes the problem. - rossb. */
+    breaks dsound.h. Adding the define here fixes the problem. - rossb. */
 #ifdef __BORLANDC__
 #if !defined(WIN32)
 #define WIN32
@@ -59,8 +59,7 @@
   We are only using DX3 in here, no need to polute the namespace - davidv
 */
 #define DIRECTSOUND_VERSION 0x0300
-
-#include <DSound.h>
+#include <dsound.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -72,6 +71,8 @@
 {
     HINSTANCE hInstance_;
     
+    HRESULT (WINAPI *DllGetClassObject)(REFCLSID , REFIID , LPVOID *);
+
     HRESULT (WINAPI *DirectSoundCreate)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN);
     HRESULT (WINAPI *DirectSoundEnumerateW)(LPDSENUMCALLBACKW, LPVOID);
     HRESULT (WINAPI *DirectSoundEnumerateA)(LPDSENUMCALLBACKA, LPVOID);

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/jack/pa_jack.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/jack/pa_jack.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/jack/pa_jack.c	Mon Aug  4 21:29:58 2008
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_jack.c 1151 2006-11-29 02:11:16Z leland_lucius $
+ * $Id: pa_jack.c 1306 2007-11-27 19:33:53Z aknudsen $
  * PortAudio Portable Real-Time Audio Library
  * Latest Version at: http://www.portaudio.com
  * JACK Implementation by Joshua Haberman
@@ -32,19 +32,19 @@
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
 /**
  @file
- @ingroup hostaip_src
+ @ingroup hostapi_src
 */
 
 #include <string.h>
@@ -69,11 +69,13 @@
 #include "pa_allocation.h"
 #include "pa_cpuload.h"
 #include "pa_ringbuffer.h"
+#include "pa_debugprint.h"
 
 static int aErr_;
 static PaError paErr_;     /* For use with ENSURE_PA */
 static pthread_t mainThread_;
 static char *jackErr_ = NULL;
+static const char* clientName_ = "PortAudio";
 
 #define STRINGIZE_HELPER(expr) #expr
 #define STRINGIZE(expr) STRINGIZE_HELPER(expr)
@@ -381,9 +383,9 @@
         bytesWritten = PaUtil_WriteRingBuffer( &stream->outFIFO, p, numBytes );
         numBytes -= bytesWritten;
         p += bytesWritten;
-        if( numBytes > 0 ) 
+        if( numBytes > 0 )
         {
-            /* we use the following algorithm: 
+            /* we use the following algorithm:
              *   (1) write data
              *   (2) if some data didn't fit into the ringbuffer, set data_available to 0
              *       to indicate to the audio that if space becomes available, we want to know
@@ -703,8 +705,7 @@
     PaError result = paNoError;
     PaJackHostApiRepresentation *jackHostApi;
     int activated = 0;
-    char *clientName;
-    int written;
+    jack_status_t jackStatus = 0;
     *hostApi = NULL;    /* Initialize to NULL */
 
     UNLESS( jackHostApi = (PaJackHostApiRepresentation*)
@@ -716,19 +717,21 @@
     ASSERT_CALL( pthread_cond_init( &jackHostApi->cond, NULL ), 0 );
 
     /* Try to become a client of the JACK server.  If we cannot do
-     * this, then this API cannot be used. */
+     * this, then this API cannot be used.
+     *
+     * Without the JackNoStartServer option, the jackd server is started
+     * automatically which we do not want.
+     */
 
-    clientName = PaUtil_GroupAllocateMemory( jackHostApi->deviceInfoMemory, jack_client_name_size() );
-    written = snprintf( clientName, jack_client_name_size(), "PortAudio-%d", getpid() );
-    assert( written < jack_client_name_size() );
-    jackHostApi->jack_client = jack_client_new( clientName );
-    if( jackHostApi->jack_client == NULL )
-    {
-       /* the V19 development docs say that if an implementation
-        * detects that it cannot be used, it should return a NULL
-        * interface and paNoError */
-       result = paNoError;
-       goto error;
+    jackHostApi->jack_client = jack_client_open( clientName_, JackNoStartServer, &jackStatus );
+    if( !jackHostApi->jack_client )
+    {
+        /* the V19 development docs say that if an implementation
+         * detects that it cannot be used, it should return a NULL
+         * interface and paNoError */
+        PA_DEBUG(( "%s: Couldn't connect to JACK, status: %d\n", __FUNCTION__, jackStatus ));
+        result = paNoError;
+        goto error;
     }
 
     jackHostApi->hostApiIndex = hostApiIndex;
@@ -739,7 +742,6 @@
     (*hostApi)->info.name = "JACK Audio Connection Kit";
 
     /* Build a device list by querying the JACK server */
-
     ENSURE_PA( BuildDeviceList( jackHostApi ) );
 
     /* Register functions */
@@ -772,7 +774,8 @@
     jack_on_shutdown( jackHostApi->jack_client, JackOnShutdown, jackHostApi );
     jack_set_error_function( JackErrorCallback );
     jackHostApi->jack_buffer_size = jack_get_buffer_size ( jackHostApi->jack_client );
-    UNLESS( !jack_set_sample_rate_callback( jackHostApi->jack_client, JackSrCb, jackHostApi ), paUnanticipatedHostError );
+    /* Don't check for error, may not be supported (deprecated in at least jackdmp) */
+    jack_set_sample_rate_callback( jackHostApi->jack_client, JackSrCb, jackHostApi );
     UNLESS( !jack_set_xrun_callback( jackHostApi->jack_client, JackXRunCb, jackHostApi ), paUnanticipatedHostError );
     UNLESS( !jack_set_process_callback( jackHostApi->jack_client, JackCallback, jackHostApi ), paUnanticipatedHostError );
     UNLESS( !jack_activate( jackHostApi->jack_client ), paUnanticipatedHostError );
@@ -883,7 +886,7 @@
 
     /*
         The following check is not necessary for JACK.
-        
+
             - if a full duplex stream is requested, check that the combination
                 of input and output parameters is supported
 
@@ -891,7 +894,7 @@
         Because the buffer adapter handles conversion between all standard
         sample formats, the following checks are only required if paCustomFormat
         is implemented, or under some other unusual conditions.
-        
+
             - check that input device can support inputSampleFormat, or that
                 we have the capability to convert from outputSampleFormat to
                 a native format
@@ -902,7 +905,7 @@
     */
 
     /* check that the device supports sampleRate */
-    
+
 #define ABS(x) ( (x) > 0 ? (x) : -(x) )
     if( ABS(sampleRate - jack_get_sample_rate(((PaJackHostApiRepresentation *) hostApi)->jack_client )) > 1 )
        return paInvalidSampleRate;
@@ -1052,7 +1055,7 @@
     return result;
 }
 
-/* Add stream to processing queue */
+/* Add stream to JACK callback processing queue */
 static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                            PaStream** s,
                            const PaStreamParameters *inputParameters,
@@ -1224,15 +1227,15 @@
     if( inputChannelCount > 0 )
     {
         int err = 0;
-        
-        /* ... remote output ports (that we input from) */
+
+        /* Get output ports of our capture device */
         snprintf( regex_pattern, regexSz, "%s:.*", hostApi->deviceInfos[ inputParameters->device ]->name );
         UNLESS( jack_ports = jack_get_ports( jackHostApi->jack_client, regex_pattern,
                                      NULL, JackPortIsOutput ), paUnanticipatedHostError );
         for( i = 0; i < inputChannelCount && jack_ports[i]; i++ )
         {
             if( (stream->remote_output_ports[i] = jack_port_by_name(
-                 jackHostApi->jack_client, jack_ports[i] )) == NULL ) 
+                 jackHostApi->jack_client, jack_ports[i] )) == NULL )
             {
                 err = 1;
                 break;
@@ -1249,7 +1252,7 @@
     {
         int err = 0;
 
-        /* ... remote input ports (that we output to) */
+        /* Get input ports of our playback device */
         snprintf( regex_pattern, regexSz, "%s:.*", hostApi->deviceInfos[ outputParameters->device ]->name );
         UNLESS( jack_ports = jack_get_ports( jackHostApi->jack_client, regex_pattern,
                                      NULL, JackPortIsInput ), paUnanticipatedHostError );
@@ -1298,8 +1301,9 @@
     stream->streamRepresentation.streamInfo.sampleRate = jackSr;
     stream->t0 = jack_frame_time( jackHostApi->jack_client );   /* A: Time should run from Pa_OpenStream */
 
-    ENSURE_PA( AddStream( stream ) );  /* Add to queue over opened streams */
-    
+    /* Add to queue of opened streams */
+    ENSURE_PA( AddStream( stream ) );
+
     *s = (PaStream*)stream;
 
     return result;
@@ -1407,7 +1411,7 @@
     return result;
 }
 
-/* Alter the processing queue if necessary */
+/* Update the JACK callback's stream processing queue. */
 static PaError UpdateQueue( PaJackHostApiRepresentation *hostApi )
 {
     PaError result = paNoError;
@@ -1433,7 +1437,10 @@
             node->next = hostApi->toAdd;
         }
         else
+        {
+            /* The only queue entry. */
             hostApi->processQueue = (PaJackStream *)hostApi->toAdd;
+        }
 
         /* If necessary, update stream state */
         if( hostApi->toAdd->streamRepresentation.streamInfo.sampleRate != jackSr )
@@ -1482,6 +1489,7 @@
     return result;
 }
 
+/* Audio processing callback invoked periodically from JACK. */
 static int JackCallback( jack_nframes_t frames, void *userData )
 {
     PaError result = paNoError;
@@ -1583,24 +1591,27 @@
     /* Ready the processor */
     PaUtil_ResetBufferProcessor( &stream->bufferProcessor );
 
-    /* connect the ports */
+    /* Connect the ports. Note that the ports may already have been connected by someone else in
+     * the meantime, in which case JACK returns EEXIST. */
 
-    /* NOTE: I would rather use jack_port_connect which uses jack_port_t's
-     * instead of port names, but it is not implemented yet. */
     if( stream->num_incoming_connections > 0 )
     {
         for( i = 0; i < stream->num_incoming_connections; i++ )
-            UNLESS( jack_connect( stream->jack_client,
-                    jack_port_name( stream->remote_output_ports[i] ),
-                    jack_port_name( stream->local_input_ports[i] ) ) == 0, paUnanticipatedHostError );
+        {
+            int r = jack_connect( stream->jack_client, jack_port_name( stream->remote_output_ports[i] ),
+                    jack_port_name( stream->local_input_ports[i] ) );
+           UNLESS( 0 == r || EEXIST == r, paUnanticipatedHostError );
+        }
     }
 
     if( stream->num_outgoing_connections > 0 )
     {
         for( i = 0; i < stream->num_outgoing_connections; i++ )
-            UNLESS( jack_connect( stream->jack_client,
-                    jack_port_name( stream->local_output_ports[i] ),
-                    jack_port_name( stream->remote_input_ports[i] ) ) == 0, paUnanticipatedHostError );
+        {
+            int r = jack_connect( stream->jack_client, jack_port_name( stream->local_output_ports[i] ),
+                    jack_port_name( stream->remote_input_ports[i] ) );
+           UNLESS( 0 == r || EEXIST == r, paUnanticipatedHostError );
+        }
     }
 
     stream->xrun = FALSE;
@@ -1654,7 +1665,7 @@
     ENSURE_PA( result );
 
     UNLESS( !stream->is_active, paInternalError );
-    
+
     PA_DEBUG(( "%s: Stream stopped\n", __FUNCTION__ ));
 
 error:
@@ -1666,27 +1677,19 @@
     {
         for( i = 0; i < stream->num_incoming_connections; i++ )
         {
-            UNLESS( !jack_port_lock( stream->jack_client, stream->local_input_ports[i] ),
-                    paUnanticipatedHostError );
             if( jack_port_connected( stream->local_input_ports[i] ) )
             {
                 UNLESS( !jack_port_disconnect( stream->jack_client, stream->local_input_ports[i] ),
                         paUnanticipatedHostError );
             }
-            UNLESS( !jack_port_unlock( stream->jack_client, stream->local_input_ports[i] ),
-                    paUnanticipatedHostError );
         }
         for( i = 0; i < stream->num_outgoing_connections; i++ )
         {
-            UNLESS( !jack_port_lock( stream->jack_client, stream->local_output_ports[i] ),
-                    paUnanticipatedHostError );
             if( jack_port_connected( stream->local_output_ports[i] ) )
             {
                 UNLESS( !jack_port_disconnect( stream->jack_client, stream->local_output_ports[i] ),
                         paUnanticipatedHostError );
             }
-            UNLESS( !jack_port_unlock( stream->jack_client, stream->local_output_ports[i] ),
-                    paUnanticipatedHostError );
         }
     }
 
@@ -1733,3 +1736,26 @@
     PaJackStream *stream = (PaJackStream*)s;
     return PaUtil_GetCpuLoad( &stream->cpuLoadMeasurer );
 }
+
+PaError PaJack_SetClientName( const char* name )
+{
+    if( strlen( name ) > jack_client_name_size() )
+    {
+        /* OK, I don't know any better error code */
+        return paInvalidFlag;
+    }
+    clientName_ = name;
+    return paNoError;
+}
+
+PaError PaJack_GetClientName(const char** clientName)
+{
+    PaError result = paNoError;
+    PaJackHostApiRepresentation* jackHostApi = NULL;
+    PaJackHostApiRepresentation** ref = &jackHostApi;
+    ENSURE_PA( PaUtil_GetHostApiRepresentation( (PaUtilHostApiRepresentation**)ref, paJACK ) );
+    *clientName = jack_get_client_name( jackHostApi->jack_client );
+
+error:
+    return result;
+}

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/oss/pa_unix_oss.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/oss/pa_unix_oss.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/oss/pa_unix_oss.c	Mon Aug  4 21:29:58 2008
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_unix_oss.c 1103 2006-08-29 20:56:04Z aknudsen $
+ * $Id: pa_unix_oss.c 1296 2007-10-28 22:43:50Z aknudsen $
  * PortAudio Portable Real-Time Audio Library
  * Latest Version at: http://www.portaudio.com
  * OSS implementation by:
@@ -32,19 +32,19 @@
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
 /**
  @file
- @ingroup hostaip_src
+ @ingroup hostapi_src
 */
 
 #include <stdio.h>
@@ -84,6 +84,7 @@
 #include "pa_cpuload.h"
 #include "pa_process.h"
 #include "pa_unix_util.h"
+#include "pa_debugprint.h"
 
 static int sysErr_;
 static pthread_t mainThread_;
@@ -113,7 +114,7 @@
  */
 static int Get_AFMT_S16_NE( void )
 {
-    long testData = 1; 
+    long testData = 1;
     char *ptr = (char *) &testData;
     int isLittle = ( *ptr == 1 ); /* Does address point to least significant byte? */
     return isLittle ? AFMT_S16_LE : AFMT_S16_BE;
@@ -278,7 +279,7 @@
             PaUtil_FreeAllAllocations( ossHostApi->allocations );
             PaUtil_DestroyAllocationGroup( ossHostApi->allocations );
         }
-                
+
         PaUtil_FreeMemory( ossHostApi );
     }
     return result;
@@ -289,7 +290,7 @@
         PaTime defaultHighOutputLatency, double defaultSampleRate, PaUtilAllocationGroup *allocations  )
 {
     PaError result = paNoError;
-    
+
     deviceInfo->structVersion = 2;
     if( allocations )
     {
@@ -384,7 +385,7 @@
         {
             maxNumChannels = (stereo) ? 2 : 1;
         }
-        PA_DEBUG(( "%s: use SNDCTL_DSP_STEREO, maxNumChannels = %d\n", __FUNCTION__, maxNumChannels ))
+        PA_DEBUG(( "%s: use SNDCTL_DSP_STEREO, maxNumChannels = %d\n", __FUNCTION__, maxNumChannels ));
     }
 
     /* During channel negotiation, the last ioctl() may have failed. This can
@@ -440,7 +441,7 @@
 
     /* douglas:
        we have to do this querying in a slightly different order. apparently
-       some sound cards will give you different info based on their settins. 
+       some sound cards will give you different info based on their settins.
        e.g. a card might give you stereo at 22kHz but only mono at 44kHz.
        the correct order for OSS is: format, channels, sample rate
     */
@@ -507,9 +508,9 @@
     /* Find devices by calling QueryDevice on each
      * potential device names.  When we find a valid one,
      * add it to a linked list.
-     * A: Can there only be 10 devices? */
+     * A: Set an arbitrary of 100 devices, should probably be a smarter way. */
 
-    for( i = 0; i < 10; i++ )
+    for( i = 0; i < 100; i++ )
     {
        char deviceName[32];
        PaDeviceInfo *deviceInfo;
@@ -596,7 +597,7 @@
     int tempDevHandle = -1;
     int flags;
     PaSampleFormat inputSampleFormat, outputSampleFormat;
-    
+
     if( inputParameters )
     {
         inputChannelCount = inputParameters->channelCount;
@@ -625,7 +626,7 @@
     {
         outputChannelCount = outputParameters->channelCount;
         outputSampleFormat = outputParameters->sampleFormat;
-        
+
         /* unless alternate device specification is supported, reject the use of
             paUseHostApiSpecificDeviceSpecification */
 
@@ -661,7 +662,7 @@
        return paInvalidChannelCount;
 
     /* open the device so we can do more tests */
-    
+
     if( inputChannelCount > 0 )
     {
         result = PaUtil_DeviceIndexToHostApiDeviceIndex(&device, inputParameters->device, hostApi);
@@ -677,7 +678,7 @@
 
     deviceInfo = hostApi->deviceInfos[device];
     deviceName = (char *)deviceInfo->name;
-    
+
     flags = O_NONBLOCK;
     if (inputChannelCount > 0 && outputChannelCount > 0)
        flags |= O_RDWR;
@@ -695,7 +696,7 @@
 
  error:
     if( tempDevHandle >= 0 )
-        close( tempDevHandle );         
+        close( tempDevHandle );
 
     return result;
 }
@@ -882,7 +883,7 @@
     {
         PaUtil_InitializeStreamRepresentation( &stream->streamRepresentation,
                                                &ossApi->blockingStreamInterface, callback, userData );
-    }    
+    }
 
     ENSURE_( sem_init( &stream->semaphore, 0, 0 ), paInternalError );
 
@@ -948,7 +949,7 @@
         frmts |= paInt16;
     else
         result = paSampleFormatNotSupported;
-    
+
     *availableFormats = frmts;
 
 error:
@@ -975,8 +976,8 @@
     return log2;
 }
 
-static PaError PaOssStreamComponent_Configure( PaOssStreamComponent *component, double sampleRate, unsigned long framesPerBuffer,
-        StreamMode streamMode, PaOssStreamComponent *master )
+static PaError PaOssStreamComponent_Configure( PaOssStreamComponent *component, double sampleRate, unsigned long
+        framesPerBuffer, StreamMode streamMode, PaOssStreamComponent *master )
 {
     PaError result = paNoError;
     int temp, nativeFormat;
@@ -986,7 +987,7 @@
     int frgmt;
     int numBufs;
     int bytesPerBuf;
-    double bufSz;
+    unsigned long bufSz;
     unsigned long fragSz;
     audio_buf_info bufInfo;
 
@@ -998,21 +999,21 @@
          * The hardware need not respect the requested fragment size, so we may have to adapt.
          */
         if( framesPerBuffer == paFramesPerBufferUnspecified )
-        { 
-            bufSz = component->latency * sampleRate;
+        {
+            bufSz = (unsigned long)(component->latency * sampleRate);
             fragSz = bufSz / 4;
         }
         else
         {
             fragSz = framesPerBuffer;
-            bufSz = component->latency * sampleRate + fragSz; /* Latency + 1 buffer */
+            bufSz = (unsigned long)(component->latency * sampleRate) + fragSz; /* Latency + 1 buffer */
         }
 
         PA_ENSURE( GetAvailableFormats( component, &availableFormats ) );
         hostFormat = PaUtil_SelectClosestAvailableFormat( availableFormats, component->userFormat );
 
         /* OSS demands at least 2 buffers, and 16 bytes per buffer */
-        numBufs = PA_MAX( bufSz / fragSz, 2 );
+        numBufs = (int)PA_MAX( bufSz / fragSz, 2 );
         bytesPerBuf = PA_MAX( fragSz * Pa_GetSampleSize( hostFormat ) * chans, 16 );
 
         /* The fragment parameters are encoded like this:
@@ -1042,7 +1043,7 @@
         /* reject if there's no sample rate within 1% of the one requested */
         if( (fabs( sampleRate - sr ) / sampleRate) > 0.01 )
         {
-            PA_DEBUG(("%s: Wanted %f, closest sample rate was %d\n", __FUNCTION__, sampleRate, sr ));                 
+            PA_DEBUG(("%s: Wanted %f, closest sample rate was %d\n", __FUNCTION__, sampleRate, sr ));
             PA_ENSURE( paInvalidSampleRate );
         }
 
@@ -1119,7 +1120,8 @@
     if( stream->capture )
     {
         PaOssStreamComponent *component = stream->capture;
-        PaOssStreamComponent_Configure( component, sampleRate, framesPerBuffer, StreamMode_In, NULL );
+        PA_ENSURE( PaOssStreamComponent_Configure( component, sampleRate, framesPerBuffer, StreamMode_In,
+                    NULL ) );
 
         assert( component->hostChannelCount > 0 );
         assert( component->hostFrames > 0 );
@@ -1187,6 +1189,7 @@
     const PaDeviceInfo *inputDeviceInfo = 0, *outputDeviceInfo = 0;
     int bpInitialized = 0;
     double inLatency = 0., outLatency = 0.;
+    int i = 0;
 
     /* validate platform specific flags */
     if( (streamFlags & paPlatformSpecificFlags) != 0 )
@@ -1222,7 +1225,15 @@
                 return paInvalidChannelCount;
         }
     }
-    
+
+    /* Round framesPerBuffer to the next power-of-two to make OSS happy. */
+    if( framesPerBuffer != paFramesPerBufferUnspecified )
+    {
+        framesPerBuffer &= INT_MAX;
+        for (i = 1; framesPerBuffer > i; i <<= 1) ;
+        framesPerBuffer = i;
+    }
+
     /* allocate and do basic initialization of the stream structure */
     PA_UNLESS( stream = (PaOssStream*)PaUtil_AllocateMemory( sizeof(PaOssStream) ), paInsufficientMemory );
     PA_ENSURE( PaOssStream_Initialize( stream, inputParameters, outputParameters, streamCallback, userData, streamFlags, ossHostApi ) );
@@ -1230,7 +1241,7 @@
     PA_ENSURE( PaOssStream_Configure( stream, sampleRate, framesPerBuffer, &inLatency, &outLatency ) );
 
     PaUtil_InitializeCpuLoadMeasurer( &stream->cpuLoadMeasurer, sampleRate );
-        
+
     if( inputParameters )
     {
         inputHostFormat = stream->capture->hostFormat;
@@ -1352,7 +1363,7 @@
                 pollCapture = 0;
             }
             */
-            else if( stream->playback ) /* Timed out, go on with playback? */ 
+            else if( stream->playback ) /* Timed out, go on with playback? */
             {
                 /*PA_DEBUG(( "%s: Trying to poll again for capture frames, pollTimeout: %d\n",
                             __FUNCTION__, stream->pollTimeout ));*/
@@ -1463,7 +1474,7 @@
 
     /* Ok, we have triggered the stream */
     stream->triggered = 1;
-    
+
 error:
     return result;
 }
@@ -1502,7 +1513,7 @@
     PaUtil_ResetCpuLoadMeasurer( &stream->cpuLoadMeasurer );
 
     PaOssStream_Stop( stream, stream->callbackAbort );
-    
+
     PA_DEBUG(( "OnExit: Stoppage\n" ));
 
     /* Eventually notify user all buffers have played */
@@ -1550,13 +1561,13 @@
     int initiateProcessing = triggered;    /* Already triggered? */
     PaStreamCallbackFlags cbFlags = 0;  /* We might want to keep state across iterations */
     PaStreamCallbackTimeInfo timeInfo = {0,0,0}; /* TODO: IMPLEMENT ME */
-    
+
     /*
 #if ( SOUND_VERSION > 0x030904 )
         audio_errinfo errinfo;
 #endif
 */
-    
+
     assert( stream );
 
     pthread_cleanup_push( &OnExit, stream );	/* Execute OnExit when exiting */
@@ -1594,7 +1605,8 @@
          */
         if( !initiateProcessing )
         {
-            PA_ENSURE( PaOssStream_WaitForFrames( stream, &framesAvail ) );  /* Wait on available frames */
+            /* Wait on available frames */
+            PA_ENSURE( PaOssStream_WaitForFrames( stream, &framesAvail ) );
             assert( framesAvail % stream->framesPerHostBuffer == 0 );
         }
         else
@@ -1937,8 +1949,7 @@
 
     if( ioctl( stream->playback->fd, SNDCTL_DSP_GETODELAY, &delay ) < 0 )
         return paUnanticipatedHostError;
-    
+
     return (PaOssStreamComponent_BufferSize( stream->playback ) - delay) / PaOssStreamComponent_FrameSize( stream->playback );
 }
 
-

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wasapi/pa_win_wasapi.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wasapi/pa_win_wasapi.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wasapi/pa_win_wasapi.cpp	Mon Aug  4 21:29:58 2008
@@ -1,6 +1,6 @@
 /*
  * Portable Audio I/O Library WASAPI implementation
- * Copyright (c) 2006 David Viens
+ * Copyright (c) 2006-2007 David Viens
  *
  * Based on the Open Source API proposed by Ross Bencina
  * Copyright (c) 1999-2002 Ross Bencina, Phil Burk
@@ -40,14 +40,9 @@
  @ingroup hostaip_src
  @brief WASAPI implementation of support for a host API.
 
- @note This file is provided as a starting point for implementing support for
- a new host API. IMPLEMENT ME comments are used to indicate functionality
- which much be customised for each implementation.
+ @note pa_wasapi currently requires VC 2005, and the latest Vista SDK
 */
 
-
-
-//these headers are only in Windows SDK CTP Feb 2006 and only work in VC 2005!
 #if _MSC_VER >= 1400
 #include <windows.h>
 #include <MMReg.h>  //must be before other Wasapi headers
@@ -55,18 +50,28 @@
 #include <mmdeviceapi.h>
 #include <Avrt.h>
 #include <audioclient.h>
+#include <Endpointvolume.h>
+
 #include <KsMedia.h>
 #include <functiondiscoverykeys.h>  // PKEY_Device_FriendlyName
 #endif
 
-
-
 #include "pa_util.h"
 #include "pa_allocation.h"
 #include "pa_hostapi.h"
 #include "pa_stream.h"
 #include "pa_cpuload.h"
 #include "pa_process.h"
+#include "pa_debugprint.h"
+
+
+/*
+  davidv : work in progress. try using with 48000 , then 44100
+  and shared mode FIRST.
+ */
+
+#define PORTAUDIO_SHAREMODE     AUDCLNT_SHAREMODE_SHARED
+//#define PORTAUDIO_SHAREMODE   AUDCLNT_SHAREMODE_EXCLUSIVE
 
 
 
@@ -217,17 +222,18 @@
     //input
 	PaWinWasapiSubStream in;
     IAudioCaptureClient *cclient;
-    
+    IAudioEndpointVolume *inVol;
 	//output
 	PaWinWasapiSubStream out;
     IAudioRenderClient  *rclient;
-
+	IAudioEndpointVolume *outVol;
 
     bool running;
     bool closeRequest;
 
     DWORD dwThreadId;
     HANDLE hThread;
+	HANDLE hNotificationEvent; 
 
     GUID  session;
 
@@ -315,6 +321,8 @@
 FAvSetMmThreadCharacteristics  pAvSetMmThreadCharacteristics=0;
 FAvSetMmThreadPriority         pAvSetMmThreadPriority=0;
 
+
+
 #define setupPTR(fun, type, name)  {                                                        \
                                         fun = (type) GetProcAddress(hDInputDLL,name);       \
                                         if(fun == NULL) {                                   \
@@ -379,11 +387,6 @@
     IMMDeviceCollection* spEndpoints=0;
     paWasapi->enumerator = 0;
 
-    if (!setupAVRT()){
-        PRINT(("Windows WASAPI : No AVRT! (not VISTA?)"));
-        goto error;
-    }
-
     hResult = CoCreateInstance(
              __uuidof(MMDeviceEnumerator), NULL,CLSCTX_INPROC_SERVER,
              __uuidof(IMMDeviceEnumerator),
@@ -452,6 +455,7 @@
 
         for( UINT i=0; i < paWasapi->deviceCount; ++i ){
 
+			PA_DEBUG(("i:%d\n",i));
             PaDeviceInfo *deviceInfo = &deviceInfoArray[i];
             deviceInfo->structVersion = 2;
             deviceInfo->hostApi = hostApiIndex;
@@ -585,7 +589,14 @@
 
                 hResult = myClient->GetMixFormat(&paWasapi->devInfo[i].MixFormat);
 
-                IF_FAILED_JUMP(hResult, error);
+				if (hResult != S_OK){
+					/*davidv: this happened with my hardware, previously for that same device in DirectSound:
+					  Digital Output (Realtek AC'97 Audio)'s GUID: {0x38f2cf50,0x7b4c,0x4740,0x86,0xeb,0xd4,0x38,0x66,0xd8,0xc8, 0x9f} 
+					  so something must be _really_ wrong with this device, TODO handle this better. We kind of need GetMixFormat*/
+					logAUDCLNT_E(hResult);
+					goto error;
+				}
+
                 myClient->Release();
             }
 
@@ -690,37 +701,37 @@
 }
 
 static void
-LogWAVEFORMATEXTENSIBLE(const WAVEFORMATEXTENSIBLE &in){
+LogWAVEFORMATEXTENSIBLE(const WAVEFORMATEXTENSIBLE *in){
 
-    const WAVEFORMATEX *old = (WAVEFORMATEX *)&in;
+    const WAVEFORMATEX *old = (WAVEFORMATEX *)in;
 
 	switch (old->wFormatTag){
 		case WAVE_FORMAT_EXTENSIBLE:{
 
 			PRINT(("wFormatTag=WAVE_FORMAT_EXTENSIBLE\n"));
 
-			if (in.SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT){
+			if (in->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT){
 				PRINT(("SubFormat=KSDATAFORMAT_SUBTYPE_IEEE_FLOAT\n"));
 			}
-			else if (in.SubFormat == KSDATAFORMAT_SUBTYPE_PCM){
+			else if (in->SubFormat == KSDATAFORMAT_SUBTYPE_PCM){
 				PRINT(("SubFormat=KSDATAFORMAT_SUBTYPE_PCM\n"));
 			}
 			else{
 				PRINT(("SubFormat=CUSTOM GUID{%d:%d:%d:%d%d%d%d%d%d%d%d}\n",	
-											in.SubFormat.Data1,
-											in.SubFormat.Data2,
-											in.SubFormat.Data3,
-											(int)in.SubFormat.Data4[0],
-											(int)in.SubFormat.Data4[1],
-											(int)in.SubFormat.Data4[2],
-											(int)in.SubFormat.Data4[3],
-											(int)in.SubFormat.Data4[4],
-											(int)in.SubFormat.Data4[5],
-											(int)in.SubFormat.Data4[6],
-											(int)in.SubFormat.Data4[7]));
+											in->SubFormat.Data1,
+											in->SubFormat.Data2,
+											in->SubFormat.Data3,
+											(int)in->SubFormat.Data4[0],
+											(int)in->SubFormat.Data4[1],
+											(int)in->SubFormat.Data4[2],
+											(int)in->SubFormat.Data4[3],
+											(int)in->SubFormat.Data4[4],
+											(int)in->SubFormat.Data4[5],
+											(int)in->SubFormat.Data4[6],
+											(int)in->SubFormat.Data4[7]));
 			}
-			PRINT(("Samples.wValidBitsPerSample=%d\n",  in.Samples.wValidBitsPerSample));
-			PRINT(("dwChannelMask=0x%X\n",in.dwChannelMask));
+			PRINT(("Samples.wValidBitsPerSample=%d\n",  in->Samples.wValidBitsPerSample));
+			PRINT(("dwChannelMask=0x%X\n",in->dwChannelMask));
 		}break;
 		
 		case WAVE_FORMAT_PCM:        PRINT(("wFormatTag=WAVE_FORMAT_PCM\n")); break;
@@ -742,21 +753,21 @@
  WAVEFORMATXXX is always interleaved
  */
 static PaSampleFormat
-waveformatToPaFormat(const WAVEFORMATEXTENSIBLE &in){
+waveformatToPaFormat(const WAVEFORMATEXTENSIBLE *in){
 
-    const WAVEFORMATEX *old = (WAVEFORMATEX *)&in;
+    const WAVEFORMATEX *old = (WAVEFORMATEX*)in;
 
     switch (old->wFormatTag){
 
         case WAVE_FORMAT_EXTENSIBLE:
         {
-            if (in.SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT){
-                if (in.Samples.wValidBitsPerSample == 32)
+            if (in->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT){
+                if (in->Samples.wValidBitsPerSample == 32)
                     return paFloat32;
                 else
                     return paCustomFormat;
             }
-            else if (in.SubFormat == KSDATAFORMAT_SUBTYPE_PCM){
+            else if (in->SubFormat == KSDATAFORMAT_SUBTYPE_PCM){
                 switch (old->wBitsPerSample){
                     case 32: return paInt32; break;
                     case 24: return paInt24;break;
@@ -797,7 +808,7 @@
 
 
 static PaError
-waveformatFromParams(WAVEFORMATEXTENSIBLE &wav,
+waveformatFromParams(WAVEFORMATEXTENSIBLE*wavex,
                           const PaStreamParameters * params,
                           double sampleRate){
 
@@ -813,13 +824,13 @@
         default: return paSampleFormatNotSupported;break;
     }
 
-    memset(&wav,0,sizeof(WAVEFORMATEXTENSIBLE));
+    memset(wavex,0,sizeof(WAVEFORMATEXTENSIBLE));
 
-    WAVEFORMATEX *old    = (WAVEFORMATEX *)&wav;
+    WAVEFORMATEX *old    = (WAVEFORMATEX *)wavex;
     old->nChannels       = (WORD)params->channelCount;
     old->nSamplesPerSec  = (DWORD)sampleRate;
-    old->wBitsPerSample  = bytesPerSample*8;
-    old->nAvgBytesPerSec = old->nSamplesPerSec * old->nChannels * bytesPerSample;
+    old->wBitsPerSample  = (WORD)(bytesPerSample*8);
+    old->nAvgBytesPerSec = (DWORD)(old->nSamplesPerSec * old->nChannels * bytesPerSample);
     old->nBlockAlign     = (WORD)(old->nChannels * bytesPerSample);
 
     //WAVEFORMATEX
@@ -834,19 +845,19 @@
         old->cbSize = sizeof (WAVEFORMATEXTENSIBLE) - sizeof (WAVEFORMATEX);
 
         if ((params->sampleFormat & ~paNonInterleaved) == paFloat32)
-            wav.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
+            wavex->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
         else
-            wav.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+            wavex->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
 
-        wav.Samples.wValidBitsPerSample = old->wBitsPerSample; //no extra padding!
+        wavex->Samples.wValidBitsPerSample = old->wBitsPerSample; //no extra padding!
 
         switch(params->channelCount){
-            case 1:  wav.dwChannelMask = SPEAKER_FRONT_CENTER; break;
-            case 2:  wav.dwChannelMask = 0x1 | 0x2; break;
-            case 4:  wav.dwChannelMask = 0x1 | 0x2 | 0x10 | 0x20; break;
-            case 6:  wav.dwChannelMask = 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20; break;
-            case 8:  wav.dwChannelMask = 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20 | 0x40 | 0x80; break;
-            default: wav.dwChannelMask = 0; break;
+            case 1:  wavex->dwChannelMask = SPEAKER_FRONT_CENTER; break;
+            case 2:  wavex->dwChannelMask = 0x1 | 0x2; break;
+            case 4:  wavex->dwChannelMask = 0x1 | 0x2 | 0x10 | 0x20; break;
+            case 6:  wavex->dwChannelMask = 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20; break;
+            case 8:  wavex->dwChannelMask = 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20 | 0x40 | 0x80; break;
+            default: wavex->dwChannelMask = 0; break;
         }
     }
 
@@ -854,36 +865,160 @@
 }
 
 
-enum PaWasapiFormatAnswer {PWFA_OK,PWFA_NO,PWFA_SUGGESTED};
 
 
-static PaWasapiFormatAnswer 
-IsFormatSupportedInternal(IAudioClient * myClient, WAVEFORMATEXTENSIBLE &wavex){
 
-	PaWasapiFormatAnswer answer = PWFA_OK;
 
-    WAVEFORMATEX *closestMatch=0;
-    HRESULT hResult = myClient->IsFormatSupported(
-        //AUDCLNT_SHAREMODE_EXCLUSIVE,
-        AUDCLNT_SHAREMODE_SHARED,
-        (WAVEFORMATEX*)&wavex,&closestMatch);
+/*
+#define paFloat32        ((PaSampleFormat) 0x00000001) 
+#define paInt32          ((PaSampleFormat) 0x00000002)
+#define paInt24          ((PaSampleFormat) 0x00000004) 
+#define paInt16          ((PaSampleFormat) 0x00000008) 
+*/
+//lifted from pa_wdmks
+static void wasapiFillWFEXT( WAVEFORMATEXTENSIBLE* pwfext, PaSampleFormat sampleFormat, double sampleRate, int channelCount)
+{
+    PA_DEBUG(( "sampleFormat = %lx\n" , sampleFormat ));
+    PA_DEBUG(( "sampleRate = %f\n" , sampleRate ));
+    PA_DEBUG(( "chanelCount = %d\n", channelCount ));
+
+    pwfext->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+    pwfext->Format.nChannels = channelCount;
+    pwfext->Format.nSamplesPerSec = (int)sampleRate;
+    if(channelCount == 1)
+        pwfext->dwChannelMask = KSAUDIO_SPEAKER_DIRECTOUT;
+    else
+        pwfext->dwChannelMask = KSAUDIO_SPEAKER_STEREO;
+    if(sampleFormat == paFloat32)
+    {
+        pwfext->Format.nBlockAlign = channelCount * 4;
+        pwfext->Format.wBitsPerSample = 32;
+        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
+        pwfext->Samples.wValidBitsPerSample = 32;
+        pwfext->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
+    }
+    else if(sampleFormat == paInt32)
+    {
+        pwfext->Format.nBlockAlign = channelCount * 4;
+        pwfext->Format.wBitsPerSample = 32;
+        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
+        pwfext->Samples.wValidBitsPerSample = 32;
+        pwfext->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+    }
+    else if(sampleFormat == paInt24)
+    {
+        pwfext->Format.nBlockAlign = channelCount * 3;
+        pwfext->Format.wBitsPerSample = 24;
+        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
+        pwfext->Samples.wValidBitsPerSample = 24;
+        pwfext->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+    }
+    else if(sampleFormat == paInt16)
+    {
+        pwfext->Format.nBlockAlign = channelCount * 2;
+        pwfext->Format.wBitsPerSample = 16;
+        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
+        pwfext->Samples.wValidBitsPerSample = 16;
+        pwfext->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+    }
+    pwfext->Format.nAvgBytesPerSec = pwfext->Format.nSamplesPerSec * pwfext->Format.nBlockAlign;
+}
+
+
+
+/*
+#define FORMATTESTS 4
+const int BestToWorst[FORMATTESTS]={paFloat32,paInt32,paInt24,paInt16};
+*/
+
+#define FORMATTESTS 3
+const int BestToWorst[FORMATTESTS]={paFloat32,paInt24,paInt16};
+
+
+static PaError
+GetClosestFormat(IAudioClient * myClient, double sampleRate,const  PaStreamParameters * params, 
+				 AUDCLNT_SHAREMODE *shareMode, WAVEFORMATEXTENSIBLE *outWavex)
+{
+	//TODO we should try exclusive first and shared after
+	*shareMode = PORTAUDIO_SHAREMODE;
+
+	PaError answer = paInvalidSampleRate;
+
+    waveformatFromParams(outWavex,params,sampleRate);
+	WAVEFORMATEX *sharedClosestMatch=0;
+	HRESULT hResult=!S_OK;
+
+	if (*shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE)
+		hResult = myClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE,(WAVEFORMATEX*)outWavex,NULL);
+	else
+		hResult = myClient->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED,   (WAVEFORMATEX*)&outWavex,&sharedClosestMatch);
 
 	if (hResult == S_OK)
-		answer = PWFA_OK;
-    else if (closestMatch){
-        WAVEFORMATEXTENSIBLE* ext = (WAVEFORMATEXTENSIBLE*)closestMatch;
+		answer = paFormatIsSupported;
+    else if (sharedClosestMatch){
+        WAVEFORMATEXTENSIBLE* ext = (WAVEFORMATEXTENSIBLE*)sharedClosestMatch;
 		
-		if (closestMatch->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
-			memcpy(&wavex,closestMatch,sizeof(WAVEFORMATEXTENSIBLE));
+		int closestMatchSR = (int)sharedClosestMatch->nSamplesPerSec;
+
+		if (sharedClosestMatch->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+			memcpy(outWavex,sharedClosestMatch,sizeof(WAVEFORMATEXTENSIBLE));
 		else
-			memcpy(&wavex,closestMatch,sizeof(WAVEFORMATEX));
+			memcpy(outWavex,sharedClosestMatch,sizeof(WAVEFORMATEX));
 
-        CoTaskMemFree(closestMatch);
-		answer = PWFA_SUGGESTED;
+        CoTaskMemFree(sharedClosestMatch);
+
+		if ((int)sampleRate == closestMatchSR)
+		answer = paFormatIsSupported;
+		else
+			answer = paInvalidSampleRate;
 	
-	}else if (hResult != S_OK){
+	}else {
+
+		//it doesnt suggest anything?? ok lets show it the MENU!
+
+		//ok fun time as with pa_win_mme, we know only a refusal of the user-requested
+		//sampleRate+num Channel is disastrous, as the portaudio buffer processor converts between anything
+		//so lets only use the number 
+		for (int i=0;i<FORMATTESTS;++i){
+			WAVEFORMATEXTENSIBLE ext;
+			wasapiFillWFEXT(&ext,BestToWorst[i],sampleRate,params->channelCount);		
+			if (*shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE)
+				hResult = myClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE,(WAVEFORMATEX*)&ext,NULL);
+			else
+				hResult = myClient->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED,   (WAVEFORMATEX*)&ext,&sharedClosestMatch);
+
+			if (hResult == S_OK){
+				memcpy(outWavex,&ext,sizeof(WAVEFORMATEXTENSIBLE));
+				answer = paFormatIsSupported;
+				break;
+			}
+		}
+
+		if (answer!=paFormatIsSupported) {
+			//try MIX format?
+			//why did it HAVE to come to this ....
+			WAVEFORMATEX pcm16WaveFormat;
+			memset(&pcm16WaveFormat,0,sizeof(WAVEFORMATEX));
+			pcm16WaveFormat.wFormatTag = WAVE_FORMAT_PCM; 
+			pcm16WaveFormat.nChannels = 2; 
+			pcm16WaveFormat.nSamplesPerSec = (DWORD)sampleRate; 
+			pcm16WaveFormat.nBlockAlign = 4; 
+			pcm16WaveFormat.nAvgBytesPerSec = pcm16WaveFormat.nSamplesPerSec*pcm16WaveFormat.nBlockAlign; 
+			pcm16WaveFormat.wBitsPerSample = 16; 
+			pcm16WaveFormat.cbSize = 0;
+
+			if (*shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE)
+				hResult = myClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE,(WAVEFORMATEX*)&pcm16WaveFormat,NULL);
+			else
+				hResult = myClient->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED,   (WAVEFORMATEX*)&pcm16WaveFormat,&sharedClosestMatch);
+
+			if (hResult == S_OK){
+				memcpy(outWavex,&pcm16WaveFormat,sizeof(WAVEFORMATEX));
+				answer = paFormatIsSupported;
+			}
+		}
+
 		logAUDCLNT_E(hResult);
-		answer = PWFA_NO;
 	}
 
 	return answer;
@@ -891,10 +1026,11 @@
 
 
 static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
-                                  const PaStreamParameters *inputParameters,
-                                  const PaStreamParameters *outputParameters,
+                                  const  PaStreamParameters *inputParameters,
+                                  const  PaStreamParameters *outputParameters,
                                   double sampleRate )
 {
+
     int inputChannelCount, outputChannelCount;
     PaSampleFormat inputSampleFormat, outputSampleFormat;
 
@@ -925,9 +1061,7 @@
 
         PaWinWasapiHostApiRepresentation *paWasapi = (PaWinWasapiHostApiRepresentation*)hostApi;
 
-        WAVEFORMATEXTENSIBLE wavex;
-        waveformatFromParams(wavex,inputParameters,sampleRate);
-	
+
 		IAudioClient *myClient=0;
 		HRESULT hResult = paWasapi->devInfo[inputParameters->device].device->Activate(
 			__uuidof(IAudioClient), CLSCTX_INPROC_SERVER, NULL, (void**)&myClient);
@@ -936,26 +1070,13 @@
 			return paInvalidDevice;
 		}
 
-		PaWasapiFormatAnswer answer = IsFormatSupportedInternal(myClient,wavex);
+        WAVEFORMATEXTENSIBLE wavex;
+		AUDCLNT_SHAREMODE shareMode;
+		PaError answer = GetClosestFormat(myClient,sampleRate,inputParameters,&shareMode,&wavex);
 		myClient->Release();
 
-		switch (answer){
-			case PWFA_OK: break;
-			case PWFA_NO: return paSampleFormatNotSupported;
-			case PWFA_SUGGESTED:
-			{
-				PRINT(("Suggested format:"));
-				LogWAVEFORMATEXTENSIBLE(wavex);
-				if (wavex.Format.nSamplesPerSec == (DWORD)sampleRate){
-					//no problem its a format issue only
-				}
-				else{
-					return paInvalidSampleRate;
-				}
-			}
-		}
-
-
+		if (answer !=paFormatIsSupported)
+			return answer;
     }
     else
     {
@@ -989,9 +1110,6 @@
 
         PaWinWasapiHostApiRepresentation *paWasapi = (PaWinWasapiHostApiRepresentation*)hostApi;
 
-        WAVEFORMATEXTENSIBLE wavex;
-        waveformatFromParams(wavex,outputParameters,sampleRate);
-	
 		IAudioClient *myClient=0;
 		HRESULT hResult = paWasapi->devInfo[outputParameters->device].device->Activate(
 			__uuidof(IAudioClient), CLSCTX_INPROC_SERVER, NULL, (void**)&myClient);
@@ -1000,26 +1118,13 @@
 			return paInvalidDevice;
 		}
 
-		PaWasapiFormatAnswer answer = IsFormatSupportedInternal(myClient,wavex);
+        WAVEFORMATEXTENSIBLE wavex;
+		AUDCLNT_SHAREMODE shareMode;
+		PaError answer = GetClosestFormat(myClient,sampleRate,outputParameters,&shareMode,&wavex);
 		myClient->Release();
 
-		switch (answer){
-			case PWFA_OK: break;
-			case PWFA_NO: return paSampleFormatNotSupported;
-			case PWFA_SUGGESTED:
-			{
-				PRINT(("Suggested format:"));
-				LogWAVEFORMATEXTENSIBLE(wavex);
-				if (wavex.Format.nSamplesPerSec == (DWORD)sampleRate){
-					//no problem its a format issue only
-				}
-				else{
-					return paInvalidSampleRate;
-				}
-			}
-		}
-
-
+		if (answer !=paFormatIsSupported)
+			return answer;		
     }
     else
     {
@@ -1087,35 +1192,26 @@
         if (hResult != S_OK)
             return paInvalidDevice;
 
-        waveformatFromParams(stream->in.wavex,outputParameters,sampleRate);
-		
-		PaWasapiFormatAnswer answer = IsFormatSupportedInternal(stream->in.client,
-			                                                    stream->in.wavex);
+        hResult = info.device->Activate(
+            __uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL,
+            (void**)&stream->inVol);
 
-		switch (answer){
-			case PWFA_OK: break;
-			case PWFA_NO: return paSampleFormatNotSupported;
-			case PWFA_SUGGESTED:
-			{
-				PRINT(("Suggested format:"));
-				LogWAVEFORMATEXTENSIBLE(stream->in.wavex);
-				if (stream->in.wavex.Format.nSamplesPerSec == (DWORD)sampleRate){
-					//no problem its a format issue only
-				}
-				else{
-					return paInvalidSampleRate;
-				}
-			}
-		}
+        if (hResult != S_OK)
+            return paInvalidDevice;
+	
+		AUDCLNT_SHAREMODE shareMode;
+		PaError answer = GetClosestFormat(stream->in.client,sampleRate,inputParameters,&shareMode,&stream->in.wavex);
+		
+		if (answer !=paFormatIsSupported)
+			return answer;
 
         //stream->out.period = info.DefaultDevicePeriod;
         stream->in.period = info.MinimumDevicePeriod;
 
         hResult = stream->in.client->Initialize(
-            AUDCLNT_SHAREMODE_SHARED,
-            //AUDCLNT_SHAREMODE_EXCLUSIVE,
+            shareMode,
             0,  //no flags
-            stream->in.period*3, //tripple buffer
+            stream->in.period,
             0,//stream->out.period,
             (WAVEFORMATEX*)&stream->in.wavex,
             &stream->session
@@ -1142,7 +1238,7 @@
 
         /* IMPLEMENT ME - establish which  host formats are available */
         hostInputSampleFormat =
-            PaUtil_SelectClosestAvailableFormat( waveformatToPaFormat(stream->in.wavex), inputSampleFormat );
+            PaUtil_SelectClosestAvailableFormat( waveformatToPaFormat(&stream->in.wavex), inputSampleFormat );
 	}
     else
     {
@@ -1179,45 +1275,53 @@
         if (hResult != S_OK)
             return paInvalidDevice;
 
-        waveformatFromParams(stream->out.wavex,outputParameters,sampleRate);
+		AUDCLNT_SHAREMODE shareMode;
+		PaError answer = GetClosestFormat(stream->out.client,sampleRate,outputParameters,&shareMode,&stream->out.wavex);
 		
-		PaWasapiFormatAnswer answer = IsFormatSupportedInternal(stream->out.client,
-			                                                    stream->out.wavex);
+		if (answer !=paFormatIsSupported)
+			return answer;
+		LogWAVEFORMATEXTENSIBLE(&stream->out.wavex);
 
-		switch (answer){
-			case PWFA_OK: break;
-			case PWFA_NO: return paSampleFormatNotSupported;
-			case PWFA_SUGGESTED:
-			{
-				PRINT(("Suggested format:"));
-				LogWAVEFORMATEXTENSIBLE(stream->out.wavex);
-				if (stream->out.wavex.Format.nSamplesPerSec == (DWORD)sampleRate){
-					//no problem its a format issue only
-				}
-				else{
-					return paInvalidSampleRate;
-				}
-			}
-		}
-
-        //stream->out.period = info.DefaultDevicePeriod;
+       // stream->out.period = info.DefaultDevicePeriod;
         stream->out.period = info.MinimumDevicePeriod;
 
-        hResult = stream->out.client->Initialize(
-            AUDCLNT_SHAREMODE_SHARED,
-            //AUDCLNT_SHAREMODE_EXCLUSIVE,
-            0,  //no flags
-            stream->out.period*3, //tripple buffer
-            0,//stream->out.period,
-            (WAVEFORMATEX*)&stream->out.wavex,
-            &stream->session
-            );
+		/*For an exclusive-mode stream that uses event-driven buffering, 
+		the caller must specify nonzero values for hnsPeriodicity and hnsBufferDuration, 
+		and the values of these two parameters must be equal */
+		if (shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE){
+			hResult = stream->out.client->Initialize(
+				shareMode,
+				AUDCLNT_STREAMFLAGS_EVENTCALLBACK, 
+				stream->out.period,
+				stream->out.period,
+				(WAVEFORMATEX*)&stream->out.wavex,
+				&stream->session
+				);
+		}
+		else{
+			hResult = stream->out.client->Initialize(
+				shareMode,
+				AUDCLNT_STREAMFLAGS_EVENTCALLBACK, 
+				0,
+				0,
+				(WAVEFORMATEX*)&stream->out.wavex,
+				&stream->session
+				);
+		}
+	
 
         if (hResult != S_OK){
             logAUDCLNT_E(hResult);
             return paInvalidDevice;
         }
 
+        hResult = info.device->Activate(
+            __uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL,
+            (void**)&stream->outVol);
+
+        if (hResult != S_OK)
+            return paInvalidDevice;
+
         hResult = stream->out.client->GetBufferSize(&stream->out.bufferSize);
         if (hResult != S_OK)
             return paInvalidDevice;
@@ -1225,16 +1329,15 @@
         hResult = stream->out.client->GetStreamLatency(&stream->out.latency);
         if (hResult != S_OK)
             return paInvalidDevice;
-
+		
         double periodsPerSecond = 1.0/nano100ToSeconds(stream->out.period);
         double samplesPerPeriod = (double)(stream->out.wavex.Format.nSamplesPerSec)/periodsPerSecond;
 
         //this is the number of samples that are required at each period
-        stream->out.framesPerHostCallback = (unsigned long)samplesPerPeriod;//unrelated to channels
+        stream->out.framesPerHostCallback = stream->out.bufferSize; //(unsigned long)samplesPerPeriod;//unrelated to channels
 
         /* IMPLEMENT ME - establish which  host formats are available */
-        hostOutputSampleFormat =
-            PaUtil_SelectClosestAvailableFormat( waveformatToPaFormat(stream->out.wavex), outputSampleFormat );
+        hostOutputSampleFormat = PaUtil_SelectClosestAvailableFormat( waveformatToPaFormat(&stream->out.wavex), outputSampleFormat );
     }
     else
     {
@@ -1376,7 +1479,10 @@
     SAFE_RELEASE(stream->in.client);
     SAFE_RELEASE(stream->cclient);
     SAFE_RELEASE(stream->rclient);
+	SAFE_RELEASE(stream->inVol);
+	SAFE_RELEASE(stream->outVol);
     CloseHandle(stream->hThread);
+	CloseHandle(stream->hNotificationEvent);
 
     PaUtil_TerminateBufferProcessor( &stream->bufferProcessor );
     PaUtil_TerminateStreamRepresentation( &stream->streamRepresentation );
@@ -1385,7 +1491,7 @@
     return result;
 }
 
-VOID ProcThread(void *client);
+DWORD WINAPI ProcThread(void *client);
 
 static PaError StartStream( PaStream *s )
 {
@@ -1414,7 +1520,7 @@
     stream->hThread = CreateThread(
         NULL,              // no security attribute
         0,                 // default stack size
-        (LPTHREAD_START_ROUTINE) ProcThread,
+        ProcThread,
         (LPVOID) stream,    // thread parameter
         0,                 // not suspended
         &stream->dwThreadId);      // returns thread ID
@@ -1667,11 +1773,8 @@
 }
 
 
-
-VOID
-ProcThread(void *param){
-
-	HRESULT hResult;
+void 
+MMCSS_activate(){
 
     DWORD stuff=0;
     HANDLE thCarac = pAvSetMmThreadCharacteristics("Pro Audio",&stuff);
@@ -1684,31 +1787,6 @@
         PRINT(("AvSetMmThreadPriority failed!\n"));
     }
 
-
-    PaWinWasapiStream *stream = (PaWinWasapiStream*)param;
-
-    HANDLE context;
-    GUID threadOrderGUID;
-    memset(&threadOrderGUID,0,sizeof(GUID));
-    LARGE_INTEGER large;
-
-    large.QuadPart = stream->out.period;
-
-    BOOL ok = pAvRtCreateThreadOrderingGroup(&context,
-        &large,
-        &threadOrderGUID,
-#ifdef _DEBUG
-        0 //THREAD_ORDER_GROUP_INFINITE_TIMEOUT
-#else
-        0 //default is 5 times the 2nd param
-#endif
-        //TEXT("Audio")
-        );
-
-    if (!ok){
-        PRINT(("AvRtCreateThreadOrderingGroup failed!\n"));
-    }
-
 	//debug
     {
         HANDLE hh       = GetCurrentThread();
@@ -1716,9 +1794,23 @@
         DWORD currclass = GetPriorityClass(GetCurrentProcess());
         PRINT(("currprio 0x%X currclass 0x%X\n",currprio,currclass));
     }
+}
 
 
-    //fill up initial buffer latency??
+DWORD WINAPI
+ProcThread(void* param){
+	HRESULT hResult;
+	MMCSS_activate();
+
+    PaWinWasapiStream *stream = (PaWinWasapiStream*)param;
+
+	stream->hNotificationEvent = CreateEvent(NULL, 
+	                                         FALSE,  //bManualReset are we sure??
+											 FALSE, 
+											 "PAWASA");
+	hResult = stream->out.client->SetEventHandle(stream->hNotificationEvent);
+	if (hResult != S_OK)
+		logAUDCLNT_E(hResult);
 
 	if (stream->out.client){
 		hResult = stream->out.client->Start();
@@ -1726,67 +1818,94 @@
 			logAUDCLNT_E(hResult);
 	}
 
-    stream->running = true;
-
-    while(!stream->closeRequest){
-        BOOL answer = pAvRtWaitOnThreadOrderingGroup(context);
-        if (!answer){
-            PRINT(("AvRtWaitOnThreadOrderingGroup failed\n"));
-        }
-
-        unsigned long usingBS = stream->out.framesPerHostCallback;
-
-        UINT32 padding=0;
-        hResult = stream->out.client->GetCurrentPadding(&padding);
-        logAUDCLNT_E(hResult);
-
-        //buffer full dont pursue
-        if (padding == stream->out.bufferSize)
-            continue;
-
-        //if something is already inside
-        if (padding > 0){
-            usingBS = stream->out.bufferSize-padding;
-            if (usingBS > stream->out.framesPerHostCallback){
-                //PRINT(("underflow! %d\n",usingBS));
-            }
-            else if (usingBS < stream->out.framesPerHostCallback){
-                //PRINT(("overflow! %d\n",usingBS));
-            }
-        }
-        else
-            usingBS = stream->out.framesPerHostCallback;
+	stream->running = true;
+	bool bOne = false;
 
+	while( !stream->closeRequest ) 
+    { 
+	    //lets wait but have a 1 second timeout
+        DWORD dwResult = WaitForSingleObject(stream->hNotificationEvent, 1000);
+        switch( dwResult ) {
+		case WAIT_OBJECT_0: {
+
+			unsigned long usingBS = stream->out.framesPerHostCallback;
+
+			BYTE* indata  = 0;
+			BYTE* outdata = 0;
+
+			hResult = stream->rclient->GetBuffer(usingBS, &outdata);
+
+			if (hResult != S_OK || !outdata) {
+				//logAUDCLNT_E(hResult);
+				//most probably shared mode and hResult=AUDCLNT_E_BUFFER_TOO_LARGE
+				UINT32 padding = 0;
+				hResult = stream->out.client->GetCurrentPadding(&padding);
+				if (padding == 0)
+					break;	
+				usingBS = usingBS-padding;
+				if (usingBS == 0)
+					break;//huh?
+				hResult = stream->rclient->GetBuffer(usingBS, &outdata);
+				if (hResult != S_OK)//what can we do NOW??
+					break;
+				//logAUDCLNT_E(hResult);			
+			}
+	
+			WaspiHostProcessingLoop(indata, usingBS ,outdata, usingBS, stream);
 
-        BYTE*indata =0;
-        BYTE*outdata=0;
+			hResult = stream->rclient->ReleaseBuffer(usingBS, 0);
+			if (hResult != S_OK)
+				logAUDCLNT_E(hResult);
+
+			 /*	This was suggested, but in my tests it doesnt seem to improve the 
+                locking behaviour some drivers have running in exclusive mode.
+                if(!ResetEvent(stream->hNotificationEvent)){
+					logAUDCLNT_E(hResult);
+				}
+             */
 
-        hResult = stream->rclient->GetBuffer(usingBS,&outdata);
+		} 
+		break;
 
-        if (hResult != S_OK || !outdata) {
-            logAUDCLNT_E(hResult);
-			continue;
         }
-
-        WaspiHostProcessingLoop(indata, usingBS
-			                   ,outdata,usingBS,stream);
-
-        hResult = stream->rclient->ReleaseBuffer(usingBS,0);
-        if (hResult != S_OK)
-            logAUDCLNT_E(hResult);
-
     }
+	stream->out.client->Stop();
+    stream->closeRequest = false;
+    
+	return 0; 
+}
 
 
-    BOOL bRes = pAvRtDeleteThreadOrderingGroup(context);
-    if (!bRes){
-        PRINT(("AvRtDeleteThreadOrderingGroup failure\n"));
-    }
 
-    stream->closeRequest = false;
-}
+
+#endif //VC 2005
 
 
 
 
-#endif //VC 2005
\ No newline at end of file
+#if 0
+			if(bFirst) {			
+				float masteur;
+				hResult = stream->outVol->GetMasterVolumeLevelScalar(&masteur);
+				if (hResult != S_OK)
+					logAUDCLNT_E(hResult);
+				float chan1, chan2;
+				hResult = stream->outVol->GetChannelVolumeLevelScalar(0, &chan1);
+				if (hResult != S_OK)
+					logAUDCLNT_E(hResult);
+				hResult = stream->outVol->GetChannelVolumeLevelScalar(1, &chan2);
+				if (hResult != S_OK)
+					logAUDCLNT_E(hResult);
+
+				BOOL bMute;
+				hResult = stream->outVol->GetMute(&bMute);
+				if (hResult != S_OK)
+					logAUDCLNT_E(hResult);
+
+				stream->outVol->SetMasterVolumeLevelScalar(0.5, NULL);
+				stream->outVol->SetChannelVolumeLevelScalar(0, 0.5, NULL);
+				stream->outVol->SetChannelVolumeLevelScalar(1, 0.5, NULL);
+				stream->outVol->SetMute(FALSE, NULL);
+				bFirst = false;
+			}
+#endif
\ No newline at end of file

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wdmks/pa_win_wdmks.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wdmks/pa_win_wdmks.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wdmks/pa_win_wdmks.c	Mon Aug  4 21:29:58 2008
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_win_wdmks.c 1097 2006-08-26 08:27:53Z rossb $
+ * $Id: pa_win_wdmks.c 1263 2007-08-27 22:59:09Z rossb $
  * PortAudio Windows WDM-KS interface
  *
  * Author: Andrew Baldwin
@@ -73,6 +73,7 @@
 #include "pa_cpuload.h"
 #include "pa_process.h"
 #include "portaudio.h"
+#include "pa_debugprint.h"
 
 #include <windows.h>
 #include <winioctl.h>
@@ -1558,6 +1559,11 @@
 
 /**
  * Build the list of available filters
+ * Use the SetupDi API to enumerate all devices in the KSCATEGORY_AUDIO which 
+ * have a KSCATEGORY_RENDER or KSCATEGORY_CAPTURE alias. For each of these 
+ * devices initialise a PaWinWdmFilter structure by calling our NewFilter() 
+ * function. We enumerate devices twice, once to count how many there are, 
+ * and once to initialize the PaWinWdmFilter structures.
  */
 static PaError BuildFilterList(PaWinWdmHostApiRepresentation* wdmHostApi)
 {

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wmme/pa_win_wmme.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wmme/pa_win_wmme.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/hostapi/wmme/pa_win_wmme.c	Mon Aug  4 21:29:58 2008
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_win_wmme.c 1097 2006-08-26 08:27:53Z rossb $
+ * $Id: pa_win_wmme.c 1286 2007-09-26 21:34:23Z rossb $
  * pa_win_wmme.c
  * Implementation of PortAudio for Windows MultiMedia Extensions (WMME)       
  *                                                                                         
@@ -88,6 +88,10 @@
     
     @todo define UNICODE and _UNICODE in the project settings and see what breaks
 
+    @todo refactor conversion of MMSYSTEM errors into PA arrors into a single function.
+
+    @todo cleanup WAVEFORMATEXTENSIBLE retry in InitializeWaveHandles to not use a for loop
+
 */
 
 /*
@@ -112,7 +116,9 @@
 #include <math.h>
 #include <windows.h>
 #include <mmsystem.h>
+#ifndef UNDER_CE
 #include <process.h>
+#endif
 #include <assert.h>
 /* PLB20010422 - "memory.h" doesn't work on CodeWarrior for PC. Thanks Mike Berry for the mod. */
 #ifndef __MWERKS__
@@ -128,10 +134,24 @@
 #include "pa_stream.h"
 #include "pa_cpuload.h"
 #include "pa_process.h"
+#include "pa_debugprint.h"
 
 #include "pa_win_wmme.h"
+#include "pa_win_waveformat.h"
+
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+#include "pa_win_wdmks_utils.h"
+#ifndef DRV_QUERYDEVICEINTERFACE
+#define DRV_QUERYDEVICEINTERFACE     (DRV_RESERVED + 12)
+#endif
+#ifndef DRV_QUERYDEVICEINTERFACESIZE
+#define DRV_QUERYDEVICEINTERFACESIZE (DRV_RESERVED + 13)
+#endif
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
 
-#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */
+#if (defined(UNDER_CE))
+#pragma comment(lib, "Coredll.lib")
+#elif (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */
 #pragma comment(lib, "winmm.lib")
 #endif
 
@@ -369,6 +389,8 @@
 {
     PaDeviceInfo inheritedDeviceInfo;
     DWORD dwFormats; /**<< standard formats bitmask from the WAVEINCAPS and WAVEOUTCAPS structures */
+    char deviceInputChannelCountIsKnown; /**<< if the system returns 0xFFFF then we don't really know the number of supported channels (1=>known, 0=>unknown)*/
+    char deviceOutputChannelCountIsKnown; /**<< if the system returns 0xFFFF then we don't really know the number of supported channels (1=>known, 0=>unknown)*/
 }
 PaWinMmeDeviceInfo;
 
@@ -497,7 +519,7 @@
         int winMmeDeviceId, int channels, double sampleRate )
 {
     PaWinMmeDeviceInfo *winMmeDeviceInfo = (PaWinMmeDeviceInfo*)deviceInfo;
-    WAVEFORMATEX waveFormatEx;
+    PaWinWaveFormat waveFormat;
     
     if( sampleRate == 11025.0
         && ( (channels == 1 && (winMmeDeviceInfo->dwFormats & WAVE_FORMAT_1M16))
@@ -520,15 +542,19 @@
         return paNoError;
     }
 
-    waveFormatEx.wFormatTag = WAVE_FORMAT_PCM;
-    waveFormatEx.nChannels = (WORD)channels;
-    waveFormatEx.nSamplesPerSec = (DWORD)sampleRate;
-    waveFormatEx.nAvgBytesPerSec = waveFormatEx.nSamplesPerSec * channels * sizeof(short);
-    waveFormatEx.nBlockAlign = (WORD)(channels * sizeof(short));
-    waveFormatEx.wBitsPerSample = 16;
-    waveFormatEx.cbSize = 0;
+    /* first, attempt to query the device using WAVEFORMATEXTENSIBLE, 
+       if this fails we fall back to WAVEFORMATEX */
+
+    /* @todo at the moment we only query with 16 bit sample format and directout speaker config*/
+    PaWin_InitializeWaveFormatExtensible( &waveFormat, channels, 
+            paInt16, sampleRate, PAWIN_SPEAKER_DIRECTOUT );
+
+    if( waveFormatExQueryFunction( winMmeDeviceId, (WAVEFORMATEX*)&waveFormat ) == paNoError )
+        return paNoError;
+
+    PaWin_InitializeWaveFormatEx( &waveFormat, channels, paInt16, sampleRate );
 
-    return waveFormatExQueryFunction( winMmeDeviceId, &waveFormatEx );
+    return waveFormatExQueryFunction( winMmeDeviceId, (WAVEFORMATEX*)&waveFormat );
 }
 
 
@@ -558,6 +584,40 @@
 }
 
 
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+static int QueryWaveInKSFilterMaxChannels( int waveInDeviceId, int *maxChannels )
+{
+    void *devicePath;
+    DWORD devicePathSize;
+    int result = 0;
+
+    if( waveInMessage((HWAVEIN)waveInDeviceId, DRV_QUERYDEVICEINTERFACESIZE,
+            (DWORD_PTR)&devicePathSize, 0 ) != MMSYSERR_NOERROR )
+        return 0;
+
+    devicePath = PaUtil_AllocateMemory( devicePathSize );
+    if( !devicePath )
+        return 0;
+
+    /* apparently DRV_QUERYDEVICEINTERFACE returns a unicode interface path, although this is undocumented */
+    if( waveInMessage((HWAVEIN)waveInDeviceId, DRV_QUERYDEVICEINTERFACE,
+            (DWORD_PTR)devicePath, devicePathSize ) == MMSYSERR_NOERROR )
+    {
+        int count = PaWin_WDMKS_QueryFilterMaximumChannelCount( devicePath, /* isInput= */ 1  );
+        if( count > 0 )
+        {
+            *maxChannels = count;
+            result = 1;
+        }
+    }
+
+    PaUtil_FreeMemory( devicePath );
+
+    return result;
+}
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
+
+
 static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeHostApi,
         PaWinMmeDeviceInfo *winMmeDeviceInfo, UINT winMmeInputDeviceId, int *success )
 {
@@ -611,17 +671,30 @@
     }
     deviceInfo->name = deviceName;
 
-    deviceInfo->maxInputChannels = wic.wChannels;
-    /* Sometimes a device can return a rediculously large number of channels.
-     * This happened with an SBLive card on a Windows ME box.
-     * If that happens, then force it to 2 channels.  PLB20010413
+    if( wic.wChannels == 0xFFFF || wic.wChannels < 1 || wic.wChannels > 255 ){
+        /* For Windows versions using WDM (possibly Windows 98 ME and later)
+         * the kernel mixer sits between the application and the driver. As a result,
+         * wave*GetDevCaps often kernel mixer channel counts, which are unlimited.
+         * When this happens we assume the device is stereo and set a flag
+         * so that other channel counts can be tried with OpenStream -- i.e. when
+         * device*ChannelCountIsKnown is false, OpenStream will try whatever
+         * channel count you supply.
+         * see also InitializeOutputDeviceInfo() below.
      */
-    if( (deviceInfo->maxInputChannels < 1) || (deviceInfo->maxInputChannels > 256) )
-    {
-        PA_DEBUG(("Pa_GetDeviceInfo: Num input channels reported as %d! Changed to 2.\n", deviceInfo->maxInputChannels ));
+
+        PA_DEBUG(("Pa_GetDeviceInfo: Num input channels reported as %d! Changed to 2.\n", wic.wChannels ));
         deviceInfo->maxInputChannels = 2;
+        winMmeDeviceInfo->deviceInputChannelCountIsKnown = 0;
+    }else{
+        deviceInfo->maxInputChannels = wic.wChannels;
+        winMmeDeviceInfo->deviceInputChannelCountIsKnown = 1;
     }
 
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+    winMmeDeviceInfo->deviceInputChannelCountIsKnown = 
+            QueryWaveInKSFilterMaxChannels( winMmeInputDeviceId, &deviceInfo->maxInputChannels );
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
+
     winMmeDeviceInfo->dwFormats = wic.dwFormats;
 
     DetectDefaultSampleRate( winMmeDeviceInfo, winMmeInputDeviceId,
@@ -634,6 +707,40 @@
 }
 
 
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+static int QueryWaveOutKSFilterMaxChannels( int waveOutDeviceId, int *maxChannels )
+{
+    void *devicePath;
+    DWORD devicePathSize;
+    int result = 0;
+
+    if( waveOutMessage((HWAVEOUT)waveOutDeviceId, DRV_QUERYDEVICEINTERFACESIZE,
+            (DWORD_PTR)&devicePathSize, 0 ) != MMSYSERR_NOERROR )
+        return 0;
+
+    devicePath = PaUtil_AllocateMemory( devicePathSize );
+    if( !devicePath )
+        return 0;
+
+    /* apparently DRV_QUERYDEVICEINTERFACE returns a unicode interface path, although this is undocumented */
+    if( waveOutMessage((HWAVEOUT)waveOutDeviceId, DRV_QUERYDEVICEINTERFACE,
+            (DWORD_PTR)devicePath, devicePathSize ) == MMSYSERR_NOERROR )
+    {
+        int count = PaWin_WDMKS_QueryFilterMaximumChannelCount( devicePath, /* isInput= */ 0  );
+        if( count > 0 )
+        {
+            *maxChannels = count;
+            result = 1;
+        }
+    }
+
+    PaUtil_FreeMemory( devicePath );
+
+    return result;
+}
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
+
+
 static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeHostApi,
         PaWinMmeDeviceInfo *winMmeDeviceInfo, UINT winMmeOutputDeviceId, int *success )
 {
@@ -642,7 +749,7 @@
     MMRESULT mmresult;
     WAVEOUTCAPS woc;
     PaDeviceInfo *deviceInfo = &winMmeDeviceInfo->inheritedDeviceInfo;
-    
+
     *success = 0;
 
     mmresult = waveOutGetDevCaps( winMmeOutputDeviceId, &woc, sizeof( WAVEOUTCAPS ) );
@@ -687,17 +794,30 @@
     }
     deviceInfo->name = deviceName;
 
-    deviceInfo->maxOutputChannels = woc.wChannels;
-    /* Sometimes a device can return a rediculously large number of channels.
-     * This happened with an SBLive card on a Windows ME box.
-     * It also happens on Win XP!
+    if( woc.wChannels == 0xFFFF || woc.wChannels < 1 || woc.wChannels > 255 ){
+        /* For Windows versions using WDM (possibly Windows 98 ME and later)
+         * the kernel mixer sits between the application and the driver. As a result,
+         * wave*GetDevCaps often kernel mixer channel counts, which are unlimited.
+         * When this happens we assume the device is stereo and set a flag
+         * so that other channel counts can be tried with OpenStream -- i.e. when
+         * device*ChannelCountIsKnown is false, OpenStream will try whatever
+         * channel count you supply.
+         * see also InitializeInputDeviceInfo() above.
      */
-    if( (deviceInfo->maxOutputChannels < 1) || (deviceInfo->maxOutputChannels > 256) )
-    {
-        PA_DEBUG(("Pa_GetDeviceInfo: Num output channels reported as %d! Changed to 2.\n", deviceInfo->maxOutputChannels ));
+
+        PA_DEBUG(("Pa_GetDeviceInfo: Num output channels reported as %d! Changed to 2.\n", woc.wChannels ));
         deviceInfo->maxOutputChannels = 2;
+        winMmeDeviceInfo->deviceOutputChannelCountIsKnown = 0;
+    }else{
+        deviceInfo->maxOutputChannels = woc.wChannels;
+        winMmeDeviceInfo->deviceOutputChannelCountIsKnown = 1;
     }
 
+#ifdef PAWIN_USE_WDMKS_DEVICE_INFO
+    winMmeDeviceInfo->deviceOutputChannelCountIsKnown = 
+            QueryWaveOutKSFilterMaxChannels( winMmeOutputDeviceId, &deviceInfo->maxOutputChannels );
+#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
+
     winMmeDeviceInfo->dwFormats = woc.dwFormats;
 
     DetectDefaultSampleRate( winMmeDeviceInfo, winMmeOutputDeviceId,
@@ -743,6 +863,8 @@
     PaWinMmeDeviceInfo *deviceInfoArray;
     int deviceInfoInitializationSucceeded;
     PaTime defaultLowLatency, defaultHighLatency;
+    DWORD waveInPreferredDevice, waveOutPreferredDevice;
+    DWORD preferredDeviceStatusFlags;
 
     winMmeHostApi = (PaWinMmeHostApiRepresentation*)PaUtil_AllocateMemory( sizeof(PaWinMmeHostApiRepresentation) );
     if( !winMmeHostApi )
@@ -774,6 +896,19 @@
     winMmeHostApi->inputDeviceCount = 0;
     winMmeHostApi->outputDeviceCount = 0;
 
+#if !defined(DRVM_MAPPER_PREFERRED_GET)
+/* DRVM_MAPPER_PREFERRED_GET is defined in mmddk.h but we avoid a dependency on the DDK by defining it here */
+#define DRVM_MAPPER_PREFERRED_GET    (0x2000+21)
+#endif
+
+    /* the following calls assume that if wave*Message fails the preferred device parameter won't be modified */
+    preferredDeviceStatusFlags = 0;
+    waveInPreferredDevice = -1;
+    waveInMessage( (HWAVEIN)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET, (DWORD)&waveInPreferredDevice, (DWORD)&preferredDeviceStatusFlags );
+
+    preferredDeviceStatusFlags = 0;
+    waveOutPreferredDevice = -1;
+    waveOutMessage( (HWAVEOUT)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET, (DWORD)&waveOutPreferredDevice, (DWORD)&preferredDeviceStatusFlags );
 
     maximumPossibleDeviceCount = 0;
 
@@ -825,7 +960,9 @@
                 deviceInfo->hostApi = hostApiIndex;
 
                 deviceInfo->maxInputChannels = 0;
+                wmmeDeviceInfo->deviceInputChannelCountIsKnown = 1;
                 deviceInfo->maxOutputChannels = 0;
+                wmmeDeviceInfo->deviceOutputChannelCountIsKnown = 1;
 
                 deviceInfo->defaultLowInputLatency = defaultLowLatency;
                 deviceInfo->defaultLowOutputLatency = defaultLowLatency;
@@ -838,8 +975,14 @@
                     goto error;
 
                 if( deviceInfoInitializationSucceeded ){
-                    if( (*hostApi)->info.defaultInputDevice == paNoDevice )
+                    if( (*hostApi)->info.defaultInputDevice == paNoDevice ){
+                        /* if there is currently no default device, use the first one available */
                         (*hostApi)->info.defaultInputDevice = (*hostApi)->info.deviceCount;
+                    
+                    }else if( winMmeDeviceId == waveInPreferredDevice ){
+                        /* set the default device to the system preferred device */
+                        (*hostApi)->info.defaultInputDevice = (*hostApi)->info.deviceCount;
+                    }
 
                     winMmeHostApi->winMmeDeviceIds[ (*hostApi)->info.deviceCount ] = winMmeDeviceId;
                     (*hostApi)->deviceInfos[ (*hostApi)->info.deviceCount ] = deviceInfo;
@@ -860,7 +1003,9 @@
                 deviceInfo->hostApi = hostApiIndex;
 
                 deviceInfo->maxInputChannels = 0;
+                wmmeDeviceInfo->deviceInputChannelCountIsKnown = 1;
                 deviceInfo->maxOutputChannels = 0;
+                wmmeDeviceInfo->deviceOutputChannelCountIsKnown = 1;
 
                 deviceInfo->defaultLowInputLatency = defaultLowLatency;
                 deviceInfo->defaultLowOutputLatency = defaultLowLatency;
@@ -873,9 +1018,15 @@
                     goto error;
 
                 if( deviceInfoInitializationSucceeded ){
-                    if( (*hostApi)->info.defaultOutputDevice == paNoDevice )
+                    if( (*hostApi)->info.defaultOutputDevice == paNoDevice ){
+                        /* if there is currently no default device, use the first one available */
                         (*hostApi)->info.defaultOutputDevice = (*hostApi)->info.deviceCount;
 
+                    }else if( winMmeDeviceId == waveOutPreferredDevice ){
+                        /* set the default device to the system preferred device */
+                        (*hostApi)->info.defaultOutputDevice = (*hostApi)->info.deviceCount;
+                    }
+
                     winMmeHostApi->winMmeDeviceIds[ (*hostApi)->info.deviceCount ] = winMmeDeviceId;
                     (*hostApi)->deviceInfos[ (*hostApi)->info.deviceCount ] = deviceInfo;
 
@@ -886,7 +1037,6 @@
         }
     }
     
-
     InitializeDefaultDeviceIdsFromEnv( winMmeHostApi );
 
     (*hostApi)->Terminate = Terminate;
@@ -936,6 +1086,34 @@
 }
 
 
+static PaError IsInputChannelCountSupported( PaWinMmeDeviceInfo* deviceInfo, int channelCount )
+{
+    PaError result = paNoError;
+
+    if( channelCount > 0
+            && deviceInfo->deviceInputChannelCountIsKnown
+            && channelCount > deviceInfo->inheritedDeviceInfo.maxInputChannels ){
+
+        result = paInvalidChannelCount; 
+    }
+
+    return result;
+}
+
+static PaError IsOutputChannelCountSupported( PaWinMmeDeviceInfo* deviceInfo, int channelCount )
+{
+    PaError result = paNoError;
+
+    if( channelCount > 0
+            && deviceInfo->deviceOutputChannelCountIsKnown
+            && channelCount > deviceInfo->inheritedDeviceInfo.maxOutputChannels ){
+
+        result = paInvalidChannelCount; 
+    }
+
+    return result;
+}
+
 static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
                                   const PaStreamParameters *inputParameters,
                                   const PaStreamParameters *outputParameters,
@@ -980,10 +1158,14 @@
                 inputDeviceInfo = hostApi->deviceInfos[ inputStreamInfo->devices[i].device ];
 
                 /* check that input device can support inputChannelCount */
-                if( inputStreamInfo->devices[i].channelCount <= 0
-                        || inputStreamInfo->devices[i].channelCount > inputDeviceInfo->maxInputChannels )
+                if( inputStreamInfo->devices[i].channelCount < 1 )
                     return paInvalidChannelCount;
 
+                paerror = IsInputChannelCountSupported( (PaWinMmeDeviceInfo*)inputDeviceInfo, 
+                        inputStreamInfo->devices[i].channelCount );
+                if( paerror != paNoError )
+                    return paerror;
+
                 /* test for valid sample rate, see comment above */
                 winMmeInputDeviceId = LocalDeviceIndexToWinMmeDeviceId( winMmeHostApi, inputStreamInfo->devices[i].device );
                 paerror = QueryFormatSupported( inputDeviceInfo, QueryInputWaveFormatEx, winMmeInputDeviceId, inputStreamInfo->devices[i].channelCount, sampleRate );
@@ -1002,8 +1184,9 @@
             inputDeviceInfo = hostApi->deviceInfos[ inputParameters->device ];
 
             /* check that input device can support inputChannelCount */
-            if( inputChannelCount > inputDeviceInfo->maxInputChannels )
-                return paInvalidChannelCount;
+            paerror = IsInputChannelCountSupported( (PaWinMmeDeviceInfo*)inputDeviceInfo, inputChannelCount );
+            if( paerror != paNoError )
+                return paerror;
 
             /* test for valid sample rate, see comment above */
             winMmeInputDeviceId = LocalDeviceIndexToWinMmeDeviceId( winMmeHostApi, inputParameters->device );
@@ -1035,10 +1218,14 @@
                 outputDeviceInfo = hostApi->deviceInfos[ outputStreamInfo->devices[i].device ];
 
                 /* check that output device can support outputChannelCount */
-                if( outputStreamInfo->devices[i].channelCount <= 0
-                        || outputStreamInfo->devices[i].channelCount > outputDeviceInfo->maxOutputChannels )
+                if( outputStreamInfo->devices[i].channelCount < 1 )
                     return paInvalidChannelCount;
 
+                paerror = IsOutputChannelCountSupported( (PaWinMmeDeviceInfo*)outputDeviceInfo, 
+                        outputStreamInfo->devices[i].channelCount );
+                if( paerror != paNoError )
+                    return paerror;
+
                 /* test for valid sample rate, see comment above */
                 winMmeOutputDeviceId = LocalDeviceIndexToWinMmeDeviceId( winMmeHostApi, outputStreamInfo->devices[i].device );
                 paerror = QueryFormatSupported( outputDeviceInfo, QueryOutputWaveFormatEx, winMmeOutputDeviceId, outputStreamInfo->devices[i].channelCount, sampleRate );
@@ -1057,8 +1244,9 @@
             outputDeviceInfo = hostApi->deviceInfos[ outputParameters->device ];
 
             /* check that output device can support outputChannelCount */
-            if( outputChannelCount > outputDeviceInfo->maxOutputChannels )
-                return paInvalidChannelCount;
+            paerror = IsOutputChannelCountSupported( (PaWinMmeDeviceInfo*)outputDeviceInfo, outputChannelCount );
+            if( paerror != paNoError )
+                return paerror;
 
             /* test for valid sample rate, see comment above */
             winMmeOutputDeviceId = LocalDeviceIndexToWinMmeDeviceId( winMmeHostApi, outputParameters->device );
@@ -1488,7 +1676,7 @@
         PaWinMmeSingleDirectionHandlesAndBuffers *handlesAndBuffers,
         unsigned long bytesPerHostSample,
         double sampleRate, PaWinMmeDeviceAndChannelCount *devices,
-        unsigned int deviceCount, int isInput );
+        unsigned int deviceCount, PaWinWaveFormatChannelMask channelMask, int isInput );
 static PaError TerminateWaveHandles( PaWinMmeSingleDirectionHandlesAndBuffers *handlesAndBuffers, int isInput, int currentlyProcessingAnError );
 static PaError InitializeWaveHeaders( PaWinMmeSingleDirectionHandlesAndBuffers *handlesAndBuffers,
         unsigned long hostBufferCount,
@@ -1512,13 +1700,11 @@
         PaWinMmeSingleDirectionHandlesAndBuffers *handlesAndBuffers,
         unsigned long bytesPerHostSample,
         double sampleRate, PaWinMmeDeviceAndChannelCount *devices,
-        unsigned int deviceCount, int isInput )
+        unsigned int deviceCount, PaWinWaveFormatChannelMask channelMask, int isInput )
 {
     PaError result;
     MMRESULT mmresult;
-    unsigned long bytesPerFrame;
-    WAVEFORMATEX wfx;
-    signed int i;
+    signed int i, j;
 
     /* for error cleanup we expect that InitializeSingleDirectionHandlesAndBuffers()
         has already been called to zero some fields */       
@@ -1546,64 +1732,94 @@
             ((HWAVEOUT*)handlesAndBuffers->waveHandles)[i] = 0;
     }
 
-    wfx.wFormatTag = WAVE_FORMAT_PCM;
-    wfx.nSamplesPerSec = (DWORD) sampleRate;
-    wfx.cbSize = 0;
-    
     for( i = 0; i < (signed int)deviceCount; ++i )
     {
-        UINT winMmeDeviceId;
+        PaWinWaveFormat waveFormat;
+        UINT winMmeDeviceId = LocalDeviceIndexToWinMmeDeviceId( winMmeHostApi, devices[i].device );
+    
+        /* @todo: consider providing a flag or #define to not try waveformat extensible 
+           this could just initialize j to 1 the first time round. */
 
-        winMmeDeviceId = LocalDeviceIndexToWinMmeDeviceId( winMmeHostApi, devices[i].device );
-        wfx.nChannels = (WORD)devices[i].channelCount;
+        for( j = 0; j < 2; ++j )
+        {
+            if( j == 0 )
+            { 
+                /* first, attempt to open the device using WAVEFORMATEXTENSIBLE, 
+                    if this fails we fall back to WAVEFORMATEX */
+
+                /* @todo at the moment we only use 16 bit sample format */
+                PaWin_InitializeWaveFormatExtensible( &waveFormat, devices[i].channelCount, 
+                        paInt16, sampleRate, channelMask );
 
-        bytesPerFrame = wfx.nChannels * bytesPerHostSample;
+            }
+            else
+            {
+                /* retry with WAVEFORMATEX */
 
-        wfx.nAvgBytesPerSec = (DWORD)(bytesPerFrame * sampleRate);
-        wfx.nBlockAlign = (WORD)bytesPerFrame;
-        wfx.wBitsPerSample = (WORD)((bytesPerFrame/wfx.nChannels) * 8);
+                PaWin_InitializeWaveFormatEx( &waveFormat, devices[i].channelCount, paInt16, sampleRate );
+            }
 
-        /* REVIEW: consider not firing an event for input when a full duplex
-            stream is being used. this would probably depend on the
-            neverDropInput flag. */
+            /* REVIEW: consider not firing an event for input when a full duplex
+                stream is being used. this would probably depend on the
+                neverDropInput flag. */
 
-        if( isInput )
-            mmresult = waveInOpen( &((HWAVEIN*)handlesAndBuffers->waveHandles)[i], winMmeDeviceId, &wfx,
+            if( isInput )
+            {
+                mmresult = waveInOpen( &((HWAVEIN*)handlesAndBuffers->waveHandles)[i], winMmeDeviceId, 
+                                    (WAVEFORMATEX*)&waveFormat,
                                (DWORD_PTR)handlesAndBuffers->bufferEvent, (DWORD_PTR)0, CALLBACK_EVENT );
-        else
-            mmresult = waveOutOpen( &((HWAVEOUT*)handlesAndBuffers->waveHandles)[i], winMmeDeviceId, &wfx,
+            }
+            else
+            {
+                mmresult = waveOutOpen( &((HWAVEOUT*)handlesAndBuffers->waveHandles)[i], winMmeDeviceId, 
+                                    (WAVEFORMATEX*)&waveFormat,
                                 (DWORD_PTR)handlesAndBuffers->bufferEvent, (DWORD_PTR)0, CALLBACK_EVENT );
+            }
 
-        if( mmresult != MMSYSERR_NOERROR )
-        {
-            switch( mmresult )
+            if( mmresult == MMSYSERR_NOERROR )
             {
-                case MMSYSERR_ALLOCATED:    /* Specified resource is already allocated. */
-                    result = paDeviceUnavailable;
-                    break;
-                case MMSYSERR_NODRIVER:	    /* No device driver is present. */
-                    result = paDeviceUnavailable;
-                    break;
-                case MMSYSERR_NOMEM:	    /* Unable to allocate or lock memory. */
-                    result = paInsufficientMemory;
-                    break;
+                break; /* success */
+            }
+            else if( j == 0 )
+            {
+                continue; /* try again with WAVEFORMATEX */
+            }
+            else
+            {
+                switch( mmresult )
+                {
+                    case MMSYSERR_ALLOCATED:    /* Specified resource is already allocated. */
+                        result = paDeviceUnavailable;
+                        break;
+                    case MMSYSERR_NODRIVER:	    /* No device driver is present. */
+                        result = paDeviceUnavailable;
+                        break;
+                    case MMSYSERR_NOMEM:	    /* Unable to allocate or lock memory. */
+                        result = paInsufficientMemory;
+                        break;
 
-                case MMSYSERR_BADDEVICEID:	/* Specified device identifier is out of range. */
-                    /* falls through */
-                case WAVERR_BADFORMAT:      /* Attempted to open with an unsupported waveform-audio format. */
-                    /* falls through */
-                default:
-                    result = paUnanticipatedHostError;
-                    if( isInput )
-                    {
-                        PA_MME_SET_LAST_WAVEIN_ERROR( mmresult );
-                    }
-                    else
-                    {
-                        PA_MME_SET_LAST_WAVEOUT_ERROR( mmresult );
-                    }
+                    case MMSYSERR_BADDEVICEID:	/* Specified device identifier is out of range. */
+                        /* falls through */
+
+                    case WAVERR_BADFORMAT:      /* Attempted to open with an unsupported waveform-audio format. */
+                                                    /* This can also occur if we try to open the device with an unsupported
+                                                     * number of channels. This is attempted when device*ChannelCountIsKnown is
+                                                     * set to 0. 
+                                                     */
+                        /* falls through */
+                    default:
+                        result = paUnanticipatedHostError;
+                        if( isInput )
+                        {
+                            PA_MME_SET_LAST_WAVEIN_ERROR( mmresult );
+                        }
+                        else
+                        {
+                            PA_MME_SET_LAST_WAVEOUT_ERROR( mmresult );
+                        }
+                }
+                goto error;
             }
-            goto error;
         }
     }
 
@@ -1921,12 +2137,20 @@
         unsigned long deviceCount )
 {
     unsigned int i;
+    PaWinMmeDeviceInfo *inputDeviceInfo;
+    PaError paerror;
 
 	for( i=0; i < deviceCount; ++i )
 	{
-		if( devices[i].channelCount < 1 || devices[i].channelCount
-					> hostApi->deviceInfos[ devices[i].device ]->maxInputChannels )
+        if( devices[i].channelCount < 1 )
         	return paInvalidChannelCount;
+
+        inputDeviceInfo = 
+                (PaWinMmeDeviceInfo*)hostApi->deviceInfos[ devices[i].device ];
+
+        paerror = IsInputChannelCountSupported( inputDeviceInfo, devices[i].channelCount );
+        if( paerror != paNoError )
+            return paerror;
 	}
 
     return paNoError;
@@ -1938,12 +2162,20 @@
         unsigned long deviceCount )
 {
     unsigned int i;
+    PaWinMmeDeviceInfo *outputDeviceInfo;
+    PaError paerror;
 
 	for( i=0; i < deviceCount; ++i )
 	{
-		if( devices[i].channelCount < 1 || devices[i].channelCount
-					> hostApi->deviceInfos[ devices[i].device ]->maxOutputChannels )
+        if( devices[i].channelCount < 1 )
         	return paInvalidChannelCount;
+
+        outputDeviceInfo = 
+                (PaWinMmeDeviceInfo*)hostApi->deviceInfos[ devices[i].device ];
+
+        paerror = IsOutputChannelCountSupported( outputDeviceInfo, devices[i].channelCount );
+        if( paerror != paNoError )
+            return paerror;
 	}
 
     return paNoError;
@@ -1976,6 +2208,7 @@
     PaSampleFormat inputSampleFormat, outputSampleFormat;
     double suggestedInputLatency, suggestedOutputLatency;
     PaWinMmeStreamInfo *inputStreamInfo, *outputStreamInfo;
+    PaWinWaveFormatChannelMask inputChannelMask, outputChannelMask;
     unsigned long framesPerHostInputBuffer;
     unsigned long hostInputBufferCount;
     unsigned long framesPerHostOutputBuffer;
@@ -2014,6 +2247,18 @@
 
         hostInputSampleFormat =
             PaUtil_SelectClosestAvailableFormat( paInt16 /* native formats */, inputSampleFormat );
+
+        if( inputDeviceCount != 1 ){
+            /* always use direct speakers when using multi-device multichannel mode */
+            inputChannelMask = PAWIN_SPEAKER_DIRECTOUT;           
+        }
+        else
+        {
+            if( inputStreamInfo && inputStreamInfo->flags & paWinMmeUseChannelMask )
+                inputChannelMask = inputStreamInfo->channelMask;
+            else
+                inputChannelMask = PaWin_DefaultChannelMask( inputDevices[0].channelCount );
+        }
 	}
     else
     {
@@ -2051,6 +2296,18 @@
 
         hostOutputSampleFormat =
             PaUtil_SelectClosestAvailableFormat( paInt16 /* native formats */, outputSampleFormat );
+
+        if( outputDeviceCount != 1 ){
+            /* always use direct speakers when using multi-device multichannel mode */
+            outputChannelMask = PAWIN_SPEAKER_DIRECTOUT;           
+        }
+        else
+        {
+            if( outputStreamInfo && outputStreamInfo->flags & paWinMmeUseChannelMask )
+                outputChannelMask = outputStreamInfo->channelMask;
+            else
+                outputChannelMask = PaWin_DefaultChannelMask( outputDevices[0].channelCount );
+        }
     }
     else
     {
@@ -2172,7 +2429,7 @@
     {
         result = InitializeWaveHandles( winMmeHostApi, &stream->input,
                 stream->bufferProcessor.bytesPerHostInputSample, sampleRate,
-                inputDevices, inputDeviceCount, 1 /* isInput */ );
+                inputDevices, inputDeviceCount, inputChannelMask, 1 /* isInput */ );
         if( result != paNoError ) goto error;
     }
     
@@ -2180,7 +2437,7 @@
     {
         result = InitializeWaveHandles( winMmeHostApi, &stream->output,
                 stream->bufferProcessor.bytesPerHostOutputSample, sampleRate,
-                outputDevices, outputDeviceCount, 0 /* isInput */ );
+                outputDevices, outputDeviceCount, outputChannelMask, 0 /* isInput */ );
         if( result != paNoError ) goto error;
     }
 
@@ -2335,6 +2592,7 @@
 
     for( i=0; i < stream->input.deviceCount; ++i )
     {
+        stream->input.waveHeaders[i][ stream->input.currentBufferIndex ].dwFlags &= ~WHDR_DONE;
         mmresult = waveInAddBuffer( ((HWAVEIN*)stream->input.waveHandles)[i],
                                     &stream->input.waveHeaders[i][ stream->input.currentBufferIndex ],
                                     sizeof(WAVEHDR) );
@@ -2637,7 +2895,7 @@
                         for( i=0; i<stream->input.deviceCount; ++i )
                         {
                              /* we have stored the number of channels in the buffer in dwUser */
-                            int channelCount = stream->input.waveHeaders[i][ hostInputBufferIndex ].dwUser;
+                            int channelCount = (int)stream->input.waveHeaders[i][ hostInputBufferIndex ].dwUser;
                             
                             PaUtil_SetInterleavedInputChannels( &stream->bufferProcessor, channel,
                                     stream->input.waveHeaders[i][ hostInputBufferIndex ].lpData +
@@ -2658,7 +2916,7 @@
                         for( i=0; i<stream->output.deviceCount; ++i )
                         {
                             /* we have stored the number of channels in the buffer in dwUser */
-                            int channelCount = stream->output.waveHeaders[i][ hostOutputBufferIndex ].dwUser;
+                            int channelCount = (int)stream->output.waveHeaders[i][ hostOutputBufferIndex ].dwUser;
 
                             PaUtil_SetInterleavedOutputChannels( &stream->bufferProcessor, channel,
                                     stream->output.waveHeaders[i][ hostOutputBufferIndex ].lpData +
@@ -2861,6 +3119,7 @@
         {
             for( j=0; j<stream->input.deviceCount; ++j )
             {
+                stream->input.waveHeaders[j][i].dwFlags &= ~WHDR_DONE;
                 mmresult = waveInAddBuffer( ((HWAVEIN*)stream->input.waveHandles)[j], &stream->input.waveHeaders[j][i], sizeof(WAVEHDR) );
                 if( mmresult != MMSYSERR_NOERROR )
                 {
@@ -2907,7 +3166,7 @@
                     for( j=0; j<stream->output.deviceCount; ++j )
                     {
                         /* we have stored the number of channels in the buffer in dwUser */
-                        int channelCount = stream->output.waveHeaders[j][i].dwUser;
+                        int channelCount = (int)stream->output.waveHeaders[j][i].dwUser;
 
                         PaUtil_SetInterleavedOutputChannels( &stream->bufferProcessor, channel,
                                 stream->output.waveHeaders[j][i].lpData +
@@ -3115,7 +3374,7 @@
                 for( i=0; i<stream->output.deviceCount; ++i )
                 {
                     /* we have stored the number of channels in the buffer in dwUser */
-                    int channelCount = stream->output.waveHeaders[i][ hostOutputBufferIndex ].dwUser;
+                    int channelCount = (int)stream->output.waveHeaders[i][ hostOutputBufferIndex ].dwUser;
 
                     PaUtil_SetInterleavedOutputChannels( &stream->bufferProcessor, channel,
                             stream->output.waveHeaders[i][ hostOutputBufferIndex ].lpData +
@@ -3367,7 +3626,7 @@
                 for( i=0; i<stream->input.deviceCount; ++i )
                 {
                     /* we have stored the number of channels in the buffer in dwUser */
-                    int channelCount = stream->input.waveHeaders[i][ hostInputBufferIndex ].dwUser;
+                    int channelCount = (int)stream->input.waveHeaders[i][ hostInputBufferIndex ].dwUser;
 
                     PaUtil_SetInterleavedInputChannels( &stream->bufferProcessor, channel,
                             stream->input.waveHeaders[i][ hostInputBufferIndex ].lpData +
@@ -3472,7 +3731,7 @@
                 for( i=0; i<stream->output.deviceCount; ++i )
                 {
                     /* we have stored the number of channels in the buffer in dwUser */
-                    int channelCount = stream->output.waveHeaders[i][ hostOutputBufferIndex ].dwUser;
+                    int channelCount = (int)stream->output.waveHeaders[i][ hostOutputBufferIndex ].dwUser;
 
                     PaUtil_SetInterleavedOutputChannels( &stream->bufferProcessor, channel,
                             stream->output.waveHeaders[i][ hostOutputBufferIndex ].lpData +

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/unix/pa_unix_util.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/unix/pa_unix_util.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/unix/pa_unix_util.c	Mon Aug  4 21:29:58 2008
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_unix_util.c 1097 2006-08-26 08:27:53Z rossb $
+ * $Id: pa_unix_util.c 1232 2007-06-16 14:49:43Z rossb $
  * Portable Audio I/O Library
  * UNIX platform-specific support functions
  *
@@ -53,6 +53,7 @@
 
 #include "pa_util.h"
 #include "pa_unix_util.h"
+#include "pa_debugprint.h"
 
 /*
    Track memory allocations to avoid leaks.

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/unix/pa_unix_util.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/unix/pa_unix_util.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/unix/pa_unix_util.h	Mon Aug  4 21:29:58 2008
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_unix_util.h 1097 2006-08-26 08:27:53Z rossb $
+ * $Id: pa_unix_util.h 1241 2007-07-23 20:08:31Z aknudsen $
  * Portable Audio I/O Library
  * UNIX platform-specific support functions
  *
@@ -187,6 +187,7 @@
  * @param threadFunc: The function to be executed in the child thread.
  * @param waitForChild: If not 0, wait for child thread to call PaUnixThread_NotifyParent. Less than 0 means
  * wait for ever, greater than 0 wait for the specified time.
+ * @param rtSched: Enable realtime scheduling?
  * @return: If timed out waiting on child, paTimedOut.
  */
 PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), void* threadArg, PaTime waitForChild,

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/win/pa_win_util.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/win/pa_win_util.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/win/pa_win_util.c	Mon Aug  4 21:29:58 2008
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_win_util.c 1097 2006-08-26 08:27:53Z rossb $
+ * $Id: pa_win_util.c 1197 2007-05-04 13:07:10Z gordon_gidluck $
  * Portable Audio I/O Library
  * Win32 platform-specific support functions
  *
@@ -138,6 +138,10 @@
     }
     else
     {
+#ifndef UNDER_CE    	
         return timeGetTime() * .001;
+#else
+        return GetTickCount() * .001;
+#endif                
     }
 }

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/win/pa_x86_plain_converters.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/win/pa_x86_plain_converters.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/src/os/win/pa_x86_plain_converters.c	Mon Aug  4 21:29:58 2008
@@ -124,7 +124,7 @@
 
 #define PA_DITHER_BITS_   (15)
 /* Multiply by PA_FLOAT_DITHER_SCALE_ to get a float between -2.0 and +1.99999 */
-#define PA_FLOAT_DITHER_SCALE_  (1.0f / ((1<<PA_DITHER_BITS_)-1))
+#define PA_FLOAT_DITHER_SCALE_  (1.0 / ((1<<PA_DITHER_BITS_)-1))
 static const float const_float_dither_scale_ = PA_FLOAT_DITHER_SCALE_;
 #define PA_DITHER_SHIFT_  ((32 - PA_DITHER_BITS_) + 1)
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_callbackstop.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_callbackstop.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_callbackstop.c	Mon Aug  4 21:29:58 2008
@@ -4,7 +4,7 @@
 	@author Ross Bencina <rossb at audiomulch.com>
 */
 /*
- * $Id: patest_callbackstop.c 1162 2006-12-18 20:40:35Z bjornroche $
+ * $Id: patest_callbackstop.c 1294 2007-10-24 20:51:22Z bjornroche $
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com/
@@ -62,6 +62,7 @@
     unsigned long generatedFramesCount;
     volatile int callbackReturnedPaComplete;
     volatile int callbackInvokedAfterReturningPaComplete;
+    char message[100];
 }
 TestData;
 
@@ -113,6 +114,16 @@
     }
 }
 
+/*
+ * This routine is called by portaudio when playback is done.
+ */
+static void StreamFinished( void* userData )
+{
+   TestData *data = (TestData *) userData;
+   printf( "Stream Completed: %s\n", data->message );
+}
+
+
 /*----------------------------------------------------------------------------*/
 int main(void);
 int main(void)
@@ -153,6 +164,10 @@
               &data );
     if( err != paNoError ) goto error;
 
+    sprintf( data.message, "Loop: XX" );
+    err = Pa_SetStreamFinishedCallback( stream, &StreamFinished );
+    if( err != paNoError ) goto error;
+
     printf("Repeating test %d times.\n", NUM_LOOPS );
     
     for( i=0; i < NUM_LOOPS; ++i )
@@ -161,6 +176,7 @@
         data.generatedFramesCount = 0;
         data.callbackReturnedPaComplete = 0;
         data.callbackInvokedAfterReturningPaComplete = 0;
+        sprintf( data.message, "Loop: %d", i );
 
         err = Pa_StartStream( stream );
         if( err != paNoError ) goto error;

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_read_write_wire.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_read_write_wire.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_read_write_wire.c	Mon Aug  4 21:29:58 2008
@@ -45,6 +45,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <strings.h>
 #include "portaudio.h"
 
 /* #define SAMPLE_RATE  (17932) // Test failure to open with this value. */
@@ -55,25 +56,39 @@
 #define DITHER_FLAG     (0) /**/
 
 /* Select sample format. */
-#if 1
+#if 0
 #define PA_SAMPLE_TYPE  paFloat32
-typedef float SAMPLE;
+#define SAMPLE_SIZE (4)
 #define SAMPLE_SILENCE  (0.0f)
+#define CLEAR(a) bzero( (a),  FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
 #define PRINTF_S_FORMAT "%.8f"
-#elif 1
+#elif 0
 #define PA_SAMPLE_TYPE  paInt16
-typedef short SAMPLE;
+#define SAMPLE_SIZE (2)
+#define SAMPLE_SILENCE  (0)
+#define CLEAR(a) bzero( (a),  FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
+#define PRINTF_S_FORMAT "%d"
+#elif 1
+#define PA_SAMPLE_TYPE  paInt24
+#define SAMPLE_SIZE (3)
 #define SAMPLE_SILENCE  (0)
+#define CLEAR(a) bzero( (a),  FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
 #define PRINTF_S_FORMAT "%d"
 #elif 0
 #define PA_SAMPLE_TYPE  paInt8
-typedef char SAMPLE;
+#define SAMPLE_SIZE (1)
 #define SAMPLE_SILENCE  (0)
+#define CLEAR(a) bzero( (a),  FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
 #define PRINTF_S_FORMAT "%d"
 #else
 #define PA_SAMPLE_TYPE  paUInt8
-typedef unsigned char SAMPLE;
+#define SAMPLE_SIZE (1)
 #define SAMPLE_SILENCE  (128)
+#define CLEAR( a ) { \
+    int i; \
+    for( i=0; i<FRAMES_PER_BUFFER*NUM_CHANNELS; i++ ) \
+        ((unsigned char *)a)[i] = (SAMPLE_SILENCE); \
+}
 #define PRINTF_S_FORMAT "%d"
 #endif
 
@@ -85,22 +100,21 @@
     PaStreamParameters inputParameters, outputParameters;
     PaStream *stream = NULL;
     PaError err;
-    SAMPLE *sampleBlock;
+    char *sampleBlock;
     int i;
     int numBytes;
     
     
     printf("patest_read_write_wire.c\n"); fflush(stdout);
 
-    numBytes = FRAMES_PER_BUFFER * NUM_CHANNELS * sizeof(SAMPLE);
-    sampleBlock = (SAMPLE *) malloc( numBytes );
+    numBytes = FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE ;
+    sampleBlock = (char *) malloc( numBytes );
     if( sampleBlock == NULL )
     {
         printf("Could not allocate record array.\n");
         exit(1);
     }
-    for( i=0; i<FRAMES_PER_BUFFER*NUM_CHANNELS; i++ )
-        sampleBlock[i] = (SAMPLE_SILENCE);
+    CLEAR( sampleBlock );
 
     err = Pa_Initialize();
     if( err != paNoError ) goto error;
@@ -150,8 +164,7 @@
     err = Pa_StopStream( stream );
     if( err != paNoError ) goto error;
 
-    for( i=0; i<FRAMES_PER_BUFFER*NUM_CHANNELS; i++ )
-        sampleBlock[i] = (SAMPLE_SILENCE);
+    CLEAR( sampleBlock );
 
     err = Pa_StartStream( stream );
     if( err != paNoError ) goto error;

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_record.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_record.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_record.c	Mon Aug  4 21:29:58 2008
@@ -4,7 +4,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: patest_record.c 1097 2006-08-26 08:27:53Z rossb $
+ * $Id: patest_record.c 1281 2007-09-16 11:06:51Z aknudsen $
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com

Modified: freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_sine.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_sine.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/portaudio/test/patest_sine.c	Mon Aug  4 21:29:58 2008
@@ -5,7 +5,7 @@
     @author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_sine.c 1097 2006-08-26 08:27:53Z rossb $
+ * $Id: patest_sine.c 1294 2007-10-24 20:51:22Z bjornroche $
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com/
@@ -59,6 +59,7 @@
     float sine[TABLE_SIZE];
     int left_phase;
     int right_phase;
+    char message[20];
 }
 paTestData;
 
@@ -93,6 +94,15 @@
     return paContinue;
 }
 
+/*
+ * This routine is called by portaudio when playback is done.
+ */
+static void StreamFinished( void* userData )
+{
+   paTestData *data = (paTestData *) userData;
+   printf( "Stream Completed: %s\n", data->message );
+}
+
 /*******************************************************************/
 int main(void);
 int main(void)
@@ -133,6 +143,10 @@
               &data );
     if( err != paNoError ) goto error;
 
+    sprintf( data.message, "No Message" );
+    err = Pa_SetStreamFinishedCallback( stream, &StreamFinished );
+    if( err != paNoError ) goto error;
+
     err = Pa_StartStream( stream );
     if( err != paNoError ) goto error;
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update	Mon Aug  4 21:29:58 2008
@@ -1 +1 @@
-Mon May 26 20:18:27 EDT 2008
+Tue Jul  8 00:36:02 EDT 2008

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE	Mon Aug  4 21:29:58 2008
@@ -1,6 +1,6 @@
-======================================
-Release notes for Sofia-SIP 1.12.9pre1
-======================================
+==================================
+Release notes for Sofia-SIP 1.12.9
+==================================
 
 Changes since last release
 --------------------------
@@ -104,3 +104,5 @@
 - Fixed sf.net bug #1930055: nat detection did not un-REGISTER natted contact
   if fist response to REGISTER was 200 OK.
 - Fixed crashes in soa if m= lines were removed from user sdp.
+- Fixed problem detecting CANCEL with To-tag copied from a provisional
+  response

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac	Mon Aug  4 21:29:58 2008
@@ -11,7 +11,7 @@
 dnl ---------------------------
 
 dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
-AC_INIT([sofia-sip], [1.12.8pre1.12.9.1])
+AC_INIT([sofia-sip], [1.12.9])
 AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
 AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.12])
 dnl Includedir specific to this sofia version

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	Mon Aug  4 21:29:58 2008
@@ -5402,14 +5402,8 @@
 
       /* From tag, Call-ID, and CSeq number has been matched above */
 
-      /* Match To tag  */
-      if (str0casecmp(irq->irq_to->a_tag, to->a_tag) &&
-	  /* Ignore failing match if tag has been set */
-	  /* and retransmitted request had no to tag */
-	  !(irq->irq_tag_set && to->a_tag == NULL))
-	;
       /* Match top Via header field */
-      else if (str0casecmp(irq->irq_via->v_branch, v->v_branch) != 0 ||
+      if (str0casecmp(irq->irq_via->v_branch, v->v_branch) != 0 ||
 	       strcasecmp(irq->irq_via->v_host, v->v_host) != 0 ||
 	       str0cmp(irq->irq_via->v_port, v->v_port) != 0)
 	;
@@ -5420,10 +5414,18 @@
 	/* Match CSeq */
 	if (irq->irq_method == cseq->cs_method &&
 	    strcmp(irq->irq_cseq->cs_method_name, 
-		   cseq->cs_method_name) == 0)
-	  return irq;		/* found */
-
-	if (return_ack && irq->irq_method == sip_method_invite)
+		   cseq->cs_method_name) == 0) {
+	  /* Match To tag  */
+	  if (!str0casecmp(irq->irq_to->a_tag, to->a_tag))
+	    return irq;		/* found */
+	}
+	else if (
+	  /* Tag set by UAS */
+	  str0casecmp(irq->irq_tag, to->a_tag) &&
+	  /* Original tag */
+	  str0casecmp(irq->irq_to->a_tag, to->a_tag))
+	  ;
+	else if (return_ack && irq->irq_method == sip_method_invite)
 	  return *return_ack = irq, NULL;
 	else if (return_cancel && irq->irq_method != sip_method_ack)
 	  return *return_cancel = irq, NULL;

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	Mon Aug  4 21:29:58 2008
@@ -636,16 +636,16 @@
     *m->m_url = *ag->ag_contact->m_url;
 
     if (host_is_ip4_address(m->m_url->url_host)) {
-      inet_pton(su->su_family = AF_INET,
-		m->m_url->url_host,
-		&su->su_sin.sin_addr);
+      su_inet_pton(su->su_family = AF_INET,
+		   m->m_url->url_host,
+		   &su->su_sin.sin_addr);
       ag->ag_su_nta_len = (sizeof su->su_sin);
     }
     else {
       TEST_1(host_is_ip_address(m->m_url->url_host));
-      inet_pton(su->su_family = AF_INET6,
-		m->m_url->url_host,
-		&su->su_sin6.sin6_addr);
+      su_inet_pton(su->su_family = AF_INET6,
+		   m->m_url->url_host,
+		   &su->su_sin6.sin6_addr);
       ag->ag_su_nta_len = (sizeof su->su_sin6);
     }
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c	Mon Aug  4 21:29:58 2008
@@ -185,7 +185,7 @@
   t->t_addr->su_len = (sizeof t->t_addr->su_sin);
   s = su_socket(t->t_addr->su_family = AF_INET, SOCK_STREAM, 0);
   TEST_1(s != INVALID_SOCKET);
-  TEST_1(inet_pton(AF_INET, "127.0.0.1", &t->t_addr->su_sin.sin_addr) >= 0);
+  TEST_1(su_inet_pton(AF_INET, "127.0.0.1", &t->t_addr->su_sin.sin_addr) >= 0);
   TEST_1(bind(s, &t->t_addr->su_sa, 
 	      t->t_addrlen = (sizeof t->t_addr->su_sin)) != -1);
   TEST_1(getsockname(s, &t->t_addr->su_sa, &t->t_addrlen) != -1);

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c	Mon Aug  4 21:29:58 2008
@@ -761,18 +761,18 @@
 {
   nua_handle_t *nh = cr->cr_owner;
   nua_dialog_usage_t *du = cr->cr_usage;
-  nua_session_usage_t *ss = nua_dialog_usage_private(du);
+  nua_session_usage_t *ss;
   int offer_sent = 0, retval;
   sip_time_t invite_timeout;
 
   if (du == NULL)		/* Call terminated */ 
     return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
 
+  ss = NUA_DIALOG_USAGE_PRIVATE(du);
+
   if (ss->ss_state >= nua_callstate_terminating)
     return nua_client_return(cr, 900, "Session is terminating", msg);
 
-  assert(ss);
-
   invite_timeout = NH_PGET(nh, invite_timeout);
   if (invite_timeout == 0)
     invite_timeout = UINT_MAX;
@@ -868,7 +868,7 @@
   nua_dialog_usage_t *du = cr->cr_usage;
   nua_session_usage_t *ss = nua_dialog_usage_private(du);
 
-  assert(sip); assert(ss);
+  assert(sip);
 
   if (ss && sip && sip->sip_rseq) {
     /* Handle 100rel responses */
@@ -1683,7 +1683,7 @@
 {
   nua_handle_t *nh = cr->cr_owner;
   nua_dialog_usage_t *du = cr->cr_usage;
-  nua_session_usage_t *ss = nua_dialog_usage_private(du);
+  nua_session_usage_t *ss;
   nua_client_request_t *cri;
   int offer_sent = 0, answer_sent = 0, retval;
   int status = 0; char const *phrase = "PRACK Sent";
@@ -1691,7 +1691,8 @@
 
   if (du == NULL)		/* Call terminated */
     return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
-  assert(ss);
+
+  ss = NUA_DIALOG_USAGE_PRIVATE(du);
   if (ss->ss_state >= nua_callstate_terminating)
     return nua_client_return(cr, 900, "Session is terminating", msg);
 
@@ -2371,8 +2372,6 @@
     return retval;
   }
 
-  assert(ss);
-
   /* Update session state */
   if (status < 300 || application != 0) {
     assert(ss->ss_state != nua_callstate_calling);
@@ -3148,14 +3147,15 @@
 {
   nua_handle_t *nh = cr->cr_owner;
   nua_dialog_usage_t *du = cr->cr_usage;
-  nua_session_usage_t *ss = nua_dialog_usage_private(du);
+  nua_session_usage_t *ss;
   nua_server_request_t *sr;
   nua_client_request_t *cri;
   int offer_sent = 0, retval;
   
   if (du == NULL)		/* Call terminated */
     return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
-  assert(ss);
+
+  ss = NUA_DIALOG_USAGE_PRIVATE(du);
   if (ss->ss_state >= nua_callstate_terminating)
     return nua_client_return(cr, 900, "Session is terminating", msg);
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c	Mon Aug  4 21:29:58 2008
@@ -1365,7 +1365,7 @@
 
   assert(s2->dns.reg != 0);
 
-  inet_pton(AF_INET, "127.0.0.1", &localhost);
+  su_inet_pton(AF_INET, "127.0.0.1", &localhost);
 
   va_start(va0, use_naptr);
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/resolve_sip.c	Mon Aug  4 21:29:58 2008
@@ -221,7 +221,7 @@
     if (a->a_record->r_status)
       continue;			      /* There was an error */
 
-    inet_ntop(AF_INET, &a->a_addr, addr, sizeof(addr));
+    su_inet_ntop(AF_INET, &a->a_addr, addr, sizeof(addr));
     printf("%s@%s:%u\n", sr->sr_tport, addr, sr->sr_port);
     sr->sr_exitcode = 0;
   }

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c	Mon Aug  4 21:29:58 2008
@@ -184,6 +184,11 @@
 #endif
 #endif
 #endif
+
+SOFIAPUBFUN int su_inet_pton(int af, char const *src, void *dst);
+SOFIAPUBFUN const char *su_inet_ntop(int af, void const *src,
+				  char *dst, size_t size);
+
 #else
 
 #define sres_send(s,b,len,flags) send((s),(b),(len),(flags))
@@ -195,6 +200,10 @@
 #define SOCKET_ERROR   (-1)
 #define INVALID_SOCKET ((sres_socket_t)-1)
 #define sres_socket(x,y,z) socket((x),(y),(z))
+
+#define su_inet_pton inet_pton
+#define su_inet_ntop inet_ntop
+
 #endif
 
 #if 1
@@ -264,8 +273,8 @@
       a1len = a2len = a3len = a4len = sizeof (struct sockaddr_in6);
 
     if (af == AF_INET) {
-      TEST_1(inet_pton(af, "127.0.0.1", &sin3->sin_addr) > 0);
-      TEST_1(inet_pton(af, "127.0.0.1", &sin4->sin_addr) > 0);
+      TEST_1(su_inet_pton(af, "127.0.0.1", &sin3->sin_addr) > 0);
+      TEST_1(su_inet_pton(af, "127.0.0.1", &sin4->sin_addr) > 0);
     } else {
     }
 
@@ -734,7 +743,7 @@
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 0);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:210:a4ff:fe8d:6a46");
 
   TEST_P(rr_a6->a6_prename, NULL);
@@ -748,7 +757,7 @@
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 0);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:210:a4ff:fe8d:6a46");
 
   TEST_P(rr_a6->a6_prename, NULL);
@@ -778,7 +787,7 @@
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 64);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
 	 "::a08:20ff:fe7d:e7ac");
 
   TEST_S(rr_a6->a6_prename, "mynet.example.com.");
@@ -795,7 +804,7 @@
   TEST(rr_a6->a6_record->r_class, sres_class_in);
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 0);
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
 	 "3ff0:12:3012:c006:a08:20ff:fe7d:e7ac");
   TEST_P(rr_a6->a6_prename, NULL);
  
@@ -811,7 +820,7 @@
   TEST(rr_a6->a6_record->r_class, sres_class_in);
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 128);
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), "::");
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), "::");
   TEST_S(rr_a6->a6_prename, "a6.example.com.");
  
   sres_free_answers(res, ctx->result), ctx->result = NULL;
@@ -824,7 +833,7 @@
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 64);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)),
 	 "::a08:20ff:fe7d:e7ac");
 
   TEST_S(rr_a6->a6_prename, "mynet.example.com.");
@@ -853,7 +862,7 @@
   TEST(rr_aaaa->aaaa_record->r_class, sres_class_in);
   TEST(rr_aaaa->aaaa_record->r_ttl, 60);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:206:5bff:fe55:4630");
 
   sres_free_answers(res, ctx->result), ctx->result = NULL;
@@ -865,7 +874,7 @@
   TEST(rr_aaaa->aaaa_record->r_class, sres_class_in);
   TEST(rr_aaaa->aaaa_record->r_ttl, 60);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:206:5bff:fe55:4630");
 
   sres_free_answers(res, result), result = NULL;
@@ -1027,7 +1036,7 @@
   const sres_ptr_record_t *rr;
   struct sockaddr_in sin = {0};
   
-  inet_pton(AF_INET, "127.0.0.1", &sin.sin_addr);
+  su_inet_pton(AF_INET, "127.0.0.1", &sin.sin_addr);
   sin.sin_family = AF_INET;
 
   BEGIN();
@@ -1089,8 +1098,8 @@
 
   BEGIN();
 
-  inet_pton(AF_INET6, "3ffe:1200:3012:c000:0a08:20ff:fe7d:e7ac", 
-            &sin6.sin6_addr);
+  su_inet_pton(AF_INET6, "3ffe:1200:3012:c000:0a08:20ff:fe7d:e7ac", 
+	       &sin6.sin6_addr);
 
   sin6.sin6_family = AF_INET6;
 
@@ -1154,9 +1163,9 @@
   sres_query(res, test_answer_multi, ctx,
 	     sres_type_aaaa, "mgw02.example.com");
 
-  inet_pton(AF_INET6, 
-            "3ffe:1200:3012:c000:0a08:20ff:fe7d:e7ac", 
-            &sin6.sin6_addr);
+  su_inet_pton(AF_INET6,
+	       "3ffe:1200:3012:c000:0a08:20ff:fe7d:e7ac",
+	       &sin6.sin6_addr);
 
   sin6.sin6_family = AF_INET6;
 
@@ -1361,7 +1370,7 @@
   TEST(rr_a6->a6_record->r_ttl, 60);
   TEST(rr_a6->a6_prelen, 0);
 
-  TEST_S(inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), "3ff0::");
+  TEST_S(su_inet_ntop(AF_INET6, &rr_a6->a6_suffix, buf, sizeof(buf)), "3ff0::");
 
   TEST_P(rr_a6->a6_prename, NULL);
 
@@ -1373,7 +1382,7 @@
   TEST(rr_aaaa->aaaa_record->r_type, sres_type_aaaa);
   TEST(rr_aaaa->aaaa_record->r_class, sres_class_in);
   TEST(rr_aaaa->aaaa_record->r_ttl, 60);
-  TEST_S(inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:206:5bff:fe55:462f");
   sres_free_answers(res, result);
 
@@ -1416,7 +1425,7 @@
   TEST(rr_aaaa->aaaa_record->r_type, sres_type_aaaa);
   TEST(rr_aaaa->aaaa_record->r_class, sres_class_in);
   TEST(rr_aaaa->aaaa_record->r_ttl, 60);
-  TEST_S(inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)), 
+  TEST_S(su_inet_ntop(AF_INET6, &rr_aaaa->aaaa_addr, buf, sizeof(buf)),
 	 "3ffe:1200:3012:c000:206:5bff:fe55:462f");
 
   TEST_P(result[1], NULL);

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/stun/stunc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/stun/stunc.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/stun/stunc.c	Mon Aug  4 21:29:58 2008
@@ -276,8 +276,8 @@
     }
 
     SU_DEBUG_0(("%s: local address NATed as %s:%u\n", __func__,
-		inet_ntop(sa->su_family, SU_ADDR(sa),
-			  ipaddr, sizeof(ipaddr)),
+		su_inet_ntop(sa->su_family, SU_ADDR(sa),
+			     ipaddr, sizeof(ipaddr)),
 		(unsigned) ntohs(sa->su_port)));
 
   break;
@@ -428,8 +428,8 @@
     err = bind(s, (struct sockaddr *)&sockaddr, socklen);
     if (err < 0) {
       SU_DEBUG_1(("%s: Error %d binding to %s:%u\n", __func__, err,
-		  inet_ntop(sockaddr.su_family, SU_ADDR(&sockaddr), 
-			    ipaddr, sizeof(ipaddr)),
+		  su_inet_ntop(sockaddr.su_family, SU_ADDR(&sockaddr),
+			       ipaddr, sizeof(ipaddr)),
 		  (unsigned) ntohs(sockaddr.su_port)));
       return -1;
     }

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/addrinfo.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/addrinfo.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/addrinfo.c	Mon Aug  4 21:29:58 2008
@@ -143,7 +143,7 @@
 #endif
 
       port = ntohs(su->su_port);
-      inet_ntop(ai->ai_family, SU_ADDR(su), buffer, sizeof(buffer));
+      su_inet_ntop(ai->ai_family, SU_ADDR(su), buffer, sizeof(buffer));
       printf("%d@[%s]:%u", ai->ai_protocol, buffer, port);
 
       if (ai->ai_flags & AI_CANONNAME)

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/localinfo.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/localinfo.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/localinfo.c	Mon Aug  4 21:29:58 2008
@@ -167,8 +167,8 @@
         fputs(li->li_canonname, stdout);
       }
       else {
-        inet_ntop(li->li_family, SU_ADDR(li->li_addr), 
-		  buffer, sizeof(buffer));
+        su_inet_ntop(li->li_family, SU_ADDR(li->li_addr),
+		     buffer, sizeof(buffer));
         printf("%s maddr=[%s]", li->li_canonname, buffer);
       }
       if (li->li_scope & LI_SCOPE_GLOBAL)

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_addrinfo.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_addrinfo.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_addrinfo.c	Mon Aug  4 21:29:58 2008
@@ -223,7 +223,7 @@
 		/* translator hack */
 		{
 			char *q = getenv("GAI");
-			if (q && inet_pton(AF_INET6, q, &faith_prefix) == 1)
+			if (q && su_inet_pton(AF_INET6, q, &faith_prefix) == 1)
 				translate = YES;
 		}
 		firsttime = 0;
@@ -411,7 +411,7 @@
 	
 	/* hostname as numeric name */
 	for (i = 0; gai_afdl[i].a_af; i++) {
-		if (inet_pton(gai_afdl[i].a_af, hostname, pton)) {
+		if (su_inet_pton(gai_afdl[i].a_af, hostname, pton)) {
 			u_long v4a;
 			u_char pfx;
 
@@ -752,7 +752,7 @@
 	if (host == NULL || hostlen == 0) {
 		/* what should we do? */
 	} else if (flags & NI_NUMERICHOST) {
-		if (inet_ntop(gni_afd->a_af, addr, numaddr, sizeof(numaddr))
+		if (su_inet_ntop(gni_afd->a_af, addr, numaddr, sizeof(numaddr))
 		    == NULL)
 			return ENI_SYSTEM;
 		if (strlen(numaddr) > hostlen)
@@ -784,7 +784,8 @@
 		} else {
 			if (flags & NI_NAMEREQD)
 				return ENI_NOHOSTNAME;
-			if (inet_ntop(gni_afd->a_af, addr, numaddr, sizeof(numaddr))
+			if (su_inet_ntop(gni_afd->a_af, addr,
+					 numaddr, sizeof(numaddr))
 			    == NULL)
 				return ENI_NOHOSTNAME;
 			if (strlen(numaddr) > hostlen)

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c	Mon Aug  4 21:29:58 2008
@@ -1047,7 +1047,7 @@
 	sa = calloc(1, sizeof(su_sockaddr_t));
 
 	sa->su_family = AF_INET6;
-	if (inet_pton(AF_INET6, addr, &sa->su_sin6.sin6_addr) <= 0)
+	if (su_inet_pton(AF_INET6, addr, &sa->su_sin6.sin6_addr) <= 0)
 	  goto err;
 	
 	s = su_socket(AF_INET6, SOCK_DGRAM, 0);
@@ -1105,7 +1105,7 @@
       li->li_addrlen = sizeof(*su);
       li->li_addr = su = (su_sockaddr_t *)(li + 1);
       su->su_family = li->li_family = AF_INET6;
-      if (inet_pton(AF_INET6, addr, &su->su_sin6.sin6_addr) <= 0)
+      if (su_inet_pton(AF_INET6, addr, &su->su_sin6.sin6_addr) <= 0)
 	goto err;
       if (li->li_flags & LI_IFNAME) 
 	li->li_ifname = ifname;

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_proxy.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_proxy.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_proxy.c	Mon Aug  4 21:29:58 2008
@@ -373,7 +373,7 @@
       char buf[SU_ADDRSIZE];
       
       SU_DEBUG_3(("accept: connection from %s:%u\n",
-		  inet_ntop(su->su_family, SU_ADDR(su), buf, sizeof(buf)),
+		  su_inet_ntop(su->su_family, SU_ADDR(su), buf, sizeof(buf)),
 		  ntohs(su->su_port)));
 
       if (!su_wait_create(f->f_wait, f->f_socket, SU_WAIT_IN) &&
@@ -628,7 +628,7 @@
   char buf[SU_ADDRSIZE];
   
   SU_DEBUG_3(("forwarder_shutdown: shutdown from %s:%u\n",
-	      inet_ntop(su->su_family, SU_ADDR(su), buf, sizeof(buf)),
+	      su_inet_ntop(su->su_family, SU_ADDR(su), buf, sizeof(buf)),
 	      ntohs(su->su_port)));
   
   if (su_root_unregister(f->f_pr->pr_root, f->f_wait, forwarder_recv, f) < 0) {
@@ -663,9 +663,9 @@
     su2 = f->f_dest, su1 = f->f_peer->f_dest, d2 = "up", d1 = "down";
 
   SU_DEBUG_3(("forwarder_close: connection from %s:%u to %s:%d\n",
-	      inet_ntop(su1->su_family, SU_ADDR(su1), buf1, sizeof(buf1)),
+	      su_inet_ntop(su1->su_family, SU_ADDR(su1), buf1, sizeof(buf1)),
 	      ntohs(su1->su_port),
-	      inet_ntop(su2->su_family, SU_ADDR(su2), buf2, sizeof(buf2)),
+	      su_inet_ntop(su2->su_family, SU_ADDR(su2), buf2, sizeof(buf2)),
 	      ntohs(su2->su_port)));
 
   forwarder_destroy(f);

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/test_su.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/test_su.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/test_su.c	Mon Aug  4 21:29:58 2008
@@ -116,7 +116,7 @@
 
   if (opt_verbatim)
     printf("udpsocket: using address [%s]:%u\n",
-	   inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port));
 
   return s;
@@ -183,7 +183,7 @@
 
   if (opt_verbatim)
     printf("do_rtt: %d bytes from [%s]:%u: \"%s\", rtt = %lg ms\n",
-	   n, inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   n, su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port), buf, rtt / 1000);
 
   do_ping(p, p->t, NULL);
@@ -237,7 +237,7 @@
 
   if (opt_verbatim)
     printf("do_recv: %d bytes from [%s]:%u: \"%s\" at %s\n",
-	   n, inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   n, su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port), buf, snow(now));
 
   fflush(stdout);

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/test_su_osx.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/test_su_osx.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/test_su_osx.c	Mon Aug  4 21:29:58 2008
@@ -127,7 +127,7 @@
 
   if (opt_verbatim)
     printf("udpsocket: using address [%s]:%u\n",
-	   inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port));
 
   return s;
@@ -202,7 +202,7 @@
 
   if (opt_verbatim)
     printf("do_rtt: %d bytes from [%s]:%u: \"%s\", rtt = %lg ms\n",
-	   n, inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   n, su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port), buf, rtt / 1000);
 
   do_ping(p, p->t, NULL);
@@ -260,7 +260,7 @@
 
   if (opt_verbatim)
     printf("do_recv: %d bytes from [%s]:%u: \"%s\" at %s\n",
-	   n, inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
+	   n, su_inet_ntop(su.su_family, SU_ADDR(&su), nbuf, sizeof(nbuf)),
 	   ntohs(su.su_sin.sin_port), buf, snow(now));
 
   fflush(stdout);

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c	Mon Aug  4 21:29:58 2008
@@ -177,7 +177,7 @@
   memset(&su, 0, sulen);
   su.su_len = sulen;
   su.su_family = AF_INET;
-  TEST(inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
+  TEST(su_inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
 
   TEST(bind(s, &su.su_sa, sulen), 0);
   TEST(getsockname(s, &su.su_sa, &sulen), 0);
@@ -197,7 +197,7 @@
   memset(&su, 0, sulen);
   su.su_len = sulen;
   su.su_family = AF_INET;
-  TEST(inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
+  TEST(su_inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
 
   TEST(bind(l, &su.su_sa, sulen), 0);
   TEST(bind(s, &su.su_sa, sulen), 0);
@@ -304,7 +304,7 @@
   memset(&su, 0, sulen);
   su.su_len = sulen;
   su.su_family = AF_INET;
-  TEST(inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
+  TEST(su_inet_pton(AF_INET, "127.0.0.1", &su.su_sin.sin_addr), 1);
   TEST(bind(s, &su.su_sa, sulen), 0);
   TEST(getsockname(s, &su.su_sa, &sulen), 0);
   

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c	Mon Aug  4 21:29:58 2008
@@ -239,9 +239,9 @@
     TEST_1(su_wait_create(ep->wait, ep->s, SU_WAIT_IN|SU_WAIT_ERR) != -1);
     TEST_1(getsockname(ep->s, &ep->addr->su_sa, &ep->addrlen) != -1);
     if (SU_HAS_INADDR_ANY(ep->addr)) {
-      inet_pton(su->su_family, 
-	        su->su_family == AF_INET ? "127.0.0.1" : "::1",
-		SU_ADDR(ep->addr));
+      su_inet_pton(su->su_family,
+		   su->su_family == AF_INET ? "127.0.0.1" : "::1",
+		   SU_ADDR(ep->addr));
     }
   }
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root_osx.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root_osx.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root_osx.c	Mon Aug  4 21:29:58 2008
@@ -108,9 +108,9 @@
     TEST_1(su_wait_create(ep->wait, ep->s, SU_WAIT_IN|SU_WAIT_ERR) != -1);
     TEST_1(getsockname(ep->s, &ep->addr->su_sa, &ep->addrlen) != -1);
     if (SU_HAS_INADDR_ANY(ep->addr)) {
-      inet_pton(su->su_family, 
-	        su->su_family == AF_INET ? "127.0.0.1" : "::1",
-		SU_ADDR(ep->addr));
+      su_inet_pton(su->su_family,
+		   su->su_family == AF_INET ? "127.0.0.1" : "::1",
+		   SU_ADDR(ep->addr));
     }
   }
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	Mon Aug  4 21:29:58 2008
@@ -3958,7 +3958,7 @@
 #else
   SU_DEBUG_9(("tport_resolve addrinfo = %s%s%s:%d\n", 
 	      "",
-              inet_ntop(su->su_family, SU_ADDR(su), ipaddr, sizeof(ipaddr)),
+              su_inet_ntop(su->su_family, SU_ADDR(su), ipaddr, sizeof(ipaddr)),
 	      "",
               htons(su->su_port)));
 #endif

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c	Mon Aug  4 21:29:58 2008
@@ -197,7 +197,8 @@
 
     SU_DEBUG_5(("%s: stun_bind() ok: local address NATed as %s:%u\n", 
 		__func__,
-		inet_ntop(su->su_family, SU_ADDR(su), ipname, sizeof(ipname)),
+		su_inet_ntop(su->su_family, SU_ADDR(su),
+			     ipname, sizeof(ipname)),
 		(unsigned) ntohs(su->su_port)));
   }
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_udp.c	Mon Aug  4 21:29:58 2008
@@ -144,7 +144,7 @@
     imr->imr_multiaddr = su->su_sin.sin_addr;
 
     if (host_is_ip4_address(tpn->tpn_canon) &&
-	inet_pton(AF_INET, tpn->tpn_canon, &iface) > 0) {
+	su_inet_pton(AF_INET, tpn->tpn_canon, &iface) > 0) {
       imr->imr_interface = iface;
     }
 
@@ -506,8 +506,8 @@
 		  origin, info));
       if (from->su_family != AF_UNSPEC)
 	SU_DEBUG_3(("\treported by [%s]:%u\n",
-		    inet_ntop(from->su_family, SU_ADDR(from), 
-			      info, sizeof(info)),
+		    su_inet_ntop(from->su_family, SU_ADDR(from),
+				 info, sizeof(info)),
 		    ntohs(from->su_port)));
 
       if (msg->msg_namelen == 0)

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_init.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_init.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_init.c	Mon Aug  4 21:29:58 2008
@@ -217,7 +217,7 @@
     else if (su->su_family == AF_INET6) {
       a_uri = (void *)
 	su_sprintf(ctx->home, "sip:[%s]:%u",
-		   inet_ntop(su->su_family, SU_ADDR(su), b, sizeof b),
+		   su_inet_ntop(su->su_family, SU_ADDR(su), b, sizeof b),
 		   ntohs(su->su_port));
       a_bind = "sip:[::]:*";
     }
@@ -225,7 +225,7 @@
     else if (su->su_family == AF_INET) {
       a_uri = (void *)
 	su_sprintf(ctx->home, "sip:%s:%u",
-		   inet_ntop(su->su_family, SU_ADDR(su), b, sizeof b),
+		   su_inet_ntop(su->su_family, SU_ADDR(su), b, sizeof b),
 		   ntohs(su->su_port));
     }
 
@@ -234,15 +234,15 @@
       su->su_len = sulen = (sizeof su->su_sin6), su->su_family = AF_INET6;
       len = strcspn(p_uri->url_host + 1, "]"); assert(len < sizeof b);
       memcpy(b, p_uri->url_host + 1, len); b[len] = '\0';
-      inet_pton(su->su_family, b, SU_ADDR(su));
+      su_inet_pton(su->su_family, b, SU_ADDR(su));
     }
     else {
       su->su_len = sulen = (sizeof su->su_sin), su->su_family = AF_INET;
-      inet_pton(su->su_family, p_uri->url_host, SU_ADDR(su));
+      su_inet_pton(su->su_family, p_uri->url_host, SU_ADDR(su));
     }
 #else
     su->su_len = sulen = (sizeof su->su_sin), su->su_family = AF_INET;
-    inet_pton(su->su_family, p_uri->url_host, SU_ADDR(su));
+    su_inet_pton(su->su_family, p_uri->url_host, SU_ADDR(su));
 #endif
 
     su->su_port = htons(strtoul(url_port(p_uri), NULL, 10));

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nat.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nat.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nat.c	Mon Aug  4 21:29:58 2008
@@ -531,13 +531,13 @@
     }
 
   getpeername(b->in_socket, (void *)addr, &addrlen);
-  inet_ntop(addr->su_family, SU_ADDR(addr), ipname, sizeof ipname);
+  su_inet_ntop(addr->su_family, SU_ADDR(addr), ipname, sizeof ipname);
   snprintf(b->in_name, sizeof b->in_name,
 	   addr->su_family == AF_INET6 ? "[%s]:%u" : "%s:%u",
 	   ipname, ntohs(addr->su_port));
 
   getsockname(out_socket, (void *)addr, &addrlen);
-  inet_ntop(addr->su_family, SU_ADDR(addr), ipname, sizeof ipname);
+  su_inet_ntop(addr->su_family, SU_ADDR(addr), ipname, sizeof ipname);
   snprintf(b->out_name, sizeof b->out_name,
 	   addr->su_family == AF_INET6 ? "[%s]:%u" : "%s:%u",
 	   ipname, ntohs(addr->su_port));
@@ -617,7 +617,7 @@
   size_t namelen;
   struct binding *b;
 				       
-  inet_ntop(from->su_family, SU_ADDR(from), ipname, sizeof ipname);
+  su_inet_ntop(from->su_family, SU_ADDR(from), ipname, sizeof ipname);
   snprintf(name, sizeof name,
 	   from->su_family == AF_INET6 ? "[%s]:%u" : "%s:%u",
 	   ipname, ntohs(from->su_port));
@@ -915,7 +915,7 @@
   b->out_register = out_register;
 
   getsockname(out, (void *)addr, &addrlen);
-  inet_ntop(addr->su_family, SU_ADDR(addr), name, sizeof name);
+  su_inet_ntop(addr->su_family, SU_ADDR(addr), name, sizeof name);
   snprintf(b->out_name, sizeof b->out_name,
 	   addr->su_family == AF_INET6 ? "[%s]:%u" : "%s:%u",
 	   name, ntohs(addr->su_port));

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua_params.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua_params.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua_params.c	Mon Aug  4 21:29:58 2008
@@ -613,7 +613,7 @@
     TEST(refer_expires, (unsigned)-1);
     TEST(refer_with_id, -1);
     TEST(substate, -1);
-    TEST(sub_expires, -1);
+    TEST(sub_expires, (unsigned)-1);
 
     TEST_P(allow, NONE);
     TEST_S(allow_str, "NONE");

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/utils/sip-dig.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/utils/sip-dig.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/utils/sip-dig.c	Mon Aug  4 21:29:58 2008
@@ -134,13 +134,6 @@
 
 #include "config.h"
 
-#if !defined(HAVE_WIN32)
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#endif
-
 #include "sofia-sip/su.h"
 
 #include "sofia-resolv/sres.h"
@@ -803,7 +796,7 @@
     if (answers[i]->sr_record->r_status != 0)
       continue;
 
-    inet_ntop(af, &answers[i]->sr_a->a_addr, addr, sizeof addr);
+    su_inet_ntop(af, &answers[i]->sr_a->a_addr, addr, sizeof addr);
 
     for (j = 0; tports[j].name; j++) {
       if (strcasecmp(tport, tports[j].name) == 0)

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/README.txt
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/README.txt	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/README.txt	Mon Aug  4 21:29:58 2008
@@ -9,6 +9,7 @@
 shared and static libraries for libsofia-sip-ua, and a few test 
 programs. The test programs can be run with the script check.cmd.
 
+
 Preparing the build tree
 ------------------------
 
@@ -23,29 +24,35 @@
   - plus many sites, a web search for "win32 awk" will
     provide you many more links
 
-Notes pthread support
----------------------
+
+Notes for pthread support
+-------------------------
 
 There is a pthread implementation for Visual C on Win32 included.
 Source code and documentation for the pthread library can also be
 downloaded from http://sources.redhat.com/pthreads-win32/.
 
+
 MS-VC6 specific notes
 ---------------------
 
 The MSVC6 workspace file is "SofiaSIP.dsw".
 
-With Visual Studio 6, and Windows 2000 or older Platform SDK, you 
-need to have so called "IPv6 Technology Preview for Windows 2000" 
-installed, in order to compile Sofia-SIP. This is required even
-if IPv6 support is disabled (the socket APIs of older Platfrom SDKs
-are insufficient).
+With Visual Studio 6, and Windows 2000 or older Platform SDK, you need to
+have the header files from the so called "IPv6 Technology Preview for
+Windows 2000" installed, in order to compile Sofia-SIP. This is required
+even if IPv6 support is disabled (the socket APIs of older Platfrom SDKs are
+insufficient).
 
-You can download the preview SDK from:
-http://msdn.microsoft.com/downloads/sdks/platform/tpipv6.asp
+You can download the preview SDK from Microsoft Download Center:
+
+http://www.microsoft.com/downloads/
+
+Search for "IPv6 Technology Preview for Windows 2000".
 
 With newer Platform SDKs, the IPv6 Preview SDK is not needed.
 
+
 MSVC2005 specific notes
 ------------------------
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.dsp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.dsp	Mon Aug  4 21:29:58 2008
@@ -42,7 +42,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /WX /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /WX /GX /O2 /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /I "..\..\..\libsofia-sip-ua\ipt" /I "..\..\..\libsofia-sip-ua\sresolv" /I "..\..\..\libsofia-sip-ua\bnf" /I "..\..\..\libsofia-sip-ua\url" /I "..\..\..\libsofia-sip-ua\msg" /I "..\..\..\libsofia-sip-ua\sip" /I "..\..\..\libsofia-sip-ua\nta" /I "..\..\..\libsofia-sip-ua\nua" /I "..\..\..\libsofia-sip-ua\iptsec" /I "..\..\..\libsofia-sip-ua\http" /I "..\..\..\libsofia-sip-ua\nth" /I "..\..\..\libsofia-sip-ua\nea" /I "..\..\..\libsofia-sip-ua\sdp" /I "..\..\..\libsofia-sip-ua\soa" /I "..\..\..\libsofia-sip-ua\stun" /I "..\..\..\libsofia-sip-ua\tport" /I "include" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GX /O2 /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /I "..\..\..\libsofia-sip-ua\ipt" /I "..\..\..\libsofia-sip-ua\sresolv" /I "..\..\..\libsofia-sip-ua\bnf" /I "..\..\..\libsofia-sip-ua\url" /I "..\..\..\libsofia-sip-ua\msg" /I "..\..\..\libsofia-sip-ua\sip" /I "..\..\..\libsofia-sip-ua\nta" /I "..\..\..\libsofia-sip-ua\nua" /I "..\..\..\libsofia-sip-ua\iptsec" /I "..\..\..\libsofia-sip-ua\http" /I "..\..\..\libsofia-sip-ua\nth" /I "..\..\..\libsofia-sip-ua\nea" /I "..\..\..\libsofia-sip-ua\sdp" /I "..\..\..\libsofia-sip-ua\soa" /I "..\..\..\libsofia-sip-ua\stun" /I "..\..\..\libsofia-sip-ua\tport" /I "..\..\..\tests" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
 # ADD RSC /l 0x409 /d "NDEBUG"
 BSC32=bscmake.exe
@@ -66,7 +66,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /WX /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /WX /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /I "..\..\..\libsofia-sip-ua\ipt" /I "..\..\..\libsofia-sip-ua\sresolv" /I "..\..\..\libsofia-sip-ua\bnf" /I "..\..\..\libsofia-sip-ua\url" /I "..\..\..\libsofia-sip-ua\msg" /I "..\..\..\libsofia-sip-ua\sip" /I "..\..\..\libsofia-sip-ua\nta" /I "..\..\..\libsofia-sip-ua\nua" /I "..\..\..\libsofia-sip-ua\iptsec" /I "..\..\..\libsofia-sip-ua\http" /I "..\..\..\libsofia-sip-ua\nth" /I "..\..\..\libsofia-sip-ua\nea" /I "..\..\..\libsofia-sip-ua\sdp" /I "..\..\..\libsofia-sip-ua\soa" /I "..\..\..\libsofia-sip-ua\stun" /I "..\..\..\libsofia-sip-ua\tport" /I "include" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /I "..\..\..\libsofia-sip-ua\ipt" /I "..\..\..\libsofia-sip-ua\sresolv" /I "..\..\..\libsofia-sip-ua\bnf" /I "..\..\..\libsofia-sip-ua\url" /I "..\..\..\libsofia-sip-ua\msg" /I "..\..\..\libsofia-sip-ua\sip" /I "..\..\..\libsofia-sip-ua\nta" /I "..\..\..\libsofia-sip-ua\nua" /I "..\..\..\libsofia-sip-ua\iptsec" /I "..\..\..\libsofia-sip-ua\http" /I "..\..\..\libsofia-sip-ua\nth" /I "..\..\..\libsofia-sip-ua\nea" /I "..\..\..\libsofia-sip-ua\sdp" /I "..\..\..\libsofia-sip-ua\soa" /I "..\..\..\libsofia-sip-ua\stun" /I "..\..\..\libsofia-sip-ua\tport" /I "..\..\..\tests" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c
 # SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /d "_DEBUG"

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.vcproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.vcproj	Mon Aug  4 21:29:58 2008
@@ -44,7 +44,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..,..\..\..\libsofia-sip-ua\su,..\..\..\libsofia-sip-ua\ipt,..\..\..\libsofia-sip-ua\sresolv,..\..\..\libsofia-sip-ua\bnf,..\..\..\libsofia-sip-ua\url,..\..\..\libsofia-sip-ua\msg,..\..\..\libsofia-sip-ua\sip,..\..\..\libsofia-sip-ua\nta,..\..\..\libsofia-sip-ua\nua,..\..\..\libsofia-sip-ua\iptsec,..\..\..\libsofia-sip-ua\http,..\..\..\libsofia-sip-ua\nth,..\..\..\libsofia-sip-ua\nea,..\..\..\libsofia-sip-ua\sdp,..\..\..\libsofia-sip-ua\soa,..\..\..\libsofia-sip-ua\stun,..\..\..\libsofia-sip-ua\tport,include,."
+				AdditionalIncludeDirectories="..\..,..\..\..\libsofia-sip-ua\su,..\..\..\libsofia-sip-ua\ipt,..\..\..\libsofia-sip-ua\sresolv,..\..\..\libsofia-sip-ua\bnf,..\..\..\libsofia-sip-ua\url,..\..\..\libsofia-sip-ua\msg,..\..\..\libsofia-sip-ua\sip,..\..\..\libsofia-sip-ua\nta,..\..\..\libsofia-sip-ua\nua,..\..\..\libsofia-sip-ua\iptsec,..\..\..\libsofia-sip-ua\http,..\..\..\libsofia-sip-ua\nth,..\..\..\libsofia-sip-ua\nea,..\..\..\libsofia-sip-ua\sdp,..\..\..\libsofia-sip-ua\soa,..\..\..\libsofia-sip-ua\stun,..\..\..\libsofia-sip-ua\tport,..\..\..\tests,."
 				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -140,7 +140,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..,..\..\..\libsofia-sip-ua\su,..\..\..\libsofia-sip-ua\ipt,..\..\..\libsofia-sip-ua\sresolv,..\..\..\libsofia-sip-ua\bnf,..\..\..\libsofia-sip-ua\url,..\..\..\libsofia-sip-ua\msg,..\..\..\libsofia-sip-ua\sip,..\..\..\libsofia-sip-ua\nta,..\..\..\libsofia-sip-ua\nua,..\..\..\libsofia-sip-ua\iptsec,..\..\..\libsofia-sip-ua\http,..\..\..\libsofia-sip-ua\nth,..\..\..\libsofia-sip-ua\nea,..\..\..\libsofia-sip-ua\sdp,..\..\..\libsofia-sip-ua\soa,..\..\..\libsofia-sip-ua\stun,..\..\..\libsofia-sip-ua\tport,include,."
+				AdditionalIncludeDirectories="..\..,..\..\..\libsofia-sip-ua\su,..\..\..\libsofia-sip-ua\ipt,..\..\..\libsofia-sip-ua\sresolv,..\..\..\libsofia-sip-ua\bnf,..\..\..\libsofia-sip-ua\url,..\..\..\libsofia-sip-ua\msg,..\..\..\libsofia-sip-ua\sip,..\..\..\libsofia-sip-ua\nta,..\..\..\libsofia-sip-ua\nua,..\..\..\libsofia-sip-ua\iptsec,..\..\..\libsofia-sip-ua\http,..\..\..\libsofia-sip-ua\nth,..\..\..\libsofia-sip-ua\nea,..\..\..\libsofia-sip-ua\sdp,..\..\..\libsofia-sip-ua\soa,..\..\..\libsofia-sip-ua\stun,..\..\..\libsofia-sip-ua\tport,..\..\..\tests,."
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
 				StringPooling="true"
 				RuntimeLibrary="2"

Modified: freeswitch/branches/lukedashjr/syslibs/libs/stfu/stfu.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/stfu/stfu.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/stfu/stfu.c	Mon Aug  4 21:29:58 2008
@@ -284,5 +284,5 @@
  * c-basic-offset:4
  * End:
  * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/voipcodecs/INSTALL
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/voipcodecs/INSTALL	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/voipcodecs/INSTALL	Mon Aug  4 21:29:58 2008
@@ -1,27 +1,43 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
 Basic Installation
 ==================
 
-   These are generic installation instructions.
+These are generic installation instructions.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
 those values to create a `Makefile' in each directory of the package.
 It may also create one or more `.h' files containing system-dependent
 definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
 
    If you need to do unusual things to compile the package, please try
 to figure out how `configure' could check whether to do them, and mail
 diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
-
-   The file `configure.ac' is used to create `configure' by a program
-called `autoconf'.  You only need `configure.ac' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
 
 The simplest way to compile this package is:
 
@@ -54,20 +70,22 @@
 Compilers and Options
 =====================
 
-   Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  You can give `configure'
-initial values for variables by setting them in the environment.  Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
-     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
 
-Or on systems that have the `env' program, you can do it like this:
-     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+   *Note Defining Variables::, for more details.
 
 Compiling For Multiple Architectures
 ====================================
 
-   You can compile the package for more than one kind of computer at the
+You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
 own directory.  To do this, you must use a version of `make' that
 supports the `VPATH' variable, such as GNU `make'.  `cd' to the
@@ -75,28 +93,28 @@
 the `configure' script.  `configure' automatically checks for the
 source code in the directory that `configure' is in and in `..'.
 
-   If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory.  After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
 
 Installation Names
 ==================
 
-   By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc.  You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
 
    You can specify separate installation prefixes for
 architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
 
    In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
+options like `--bindir=DIR' to specify different values for particular
 kinds of files.  Run `configure --help' for a list of the directories
 you can set and what kinds of files go in them.
 
@@ -107,7 +125,7 @@
 Optional Features
 =================
 
-   Some packages pay attention to `--enable-FEATURE' options to
+Some packages pay attention to `--enable-FEATURE' options to
 `configure', where FEATURE indicates an optional part of the package.
 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
 is something like `gnu-as' or `x' (for the X Window System).  The
@@ -122,48 +140,86 @@
 Specifying the System Type
 ==========================
 
-   There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on.  Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
      CPU-COMPANY-SYSTEM
 
-See the file `config.sub' for the possible values of each field.  If
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
 `config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
+need to know the machine type.
 
-   If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
 
 Sharing Defaults
 ================
 
-   If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
 `configure' looks for `PREFIX/share/config.site' if it exists, then
 `PREFIX/etc/config.site' if it exists.  Or, you can set the
 `CONFIG_SITE' environment variable to the location of the site script.
 A warning: not all `configure' scripts look for a site script.
 
-Operation Controls
+Defining Variables
 ==================
 
-   `configure' recognizes the following options to control how it
-operates.
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
 
-`--cache-file=FILE'
-     Use and save the results of the tests in FILE instead of
-     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
-     debugging `configure'.
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).  Here is a another example:
+
+     /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
 
 `--help'
+`-h'
      Print a summary of the options to `configure', and exit.
 
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
 `--quiet'
 `--silent'
 `-q'
@@ -175,8 +231,6 @@
      Look for the package's source code in directory DIR.  Usually
      `configure' can determine that directory automatically.
 
-`--version'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
 
-`configure' also accepts some other, not widely useful, options.

Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/util_int.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/util_int.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/util_int.h	Mon Aug  4 21:29:58 2008
@@ -3,8 +3,12 @@
 
 #include "util.h"
 
+#ifndef MIN
 #define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+#ifndef MAX
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
 
 /* When we deallocate a pointer in a struct, we often replace it with
 ** this and throw in a few assertions here and there. */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/http.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/http.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/http.c	Mon Aug  4 21:29:58 2008
@@ -175,7 +175,7 @@
 
     while (!error && !lfPos) {
         int const timeLeft = (int)(deadline - time(NULL));
-        assert(timeLeft == deadline - time(NULL));
+
         if (timeLeft <= 0)
             error = TRUE;
         else {
@@ -426,20 +426,15 @@
    are not able to read the request header, or 0 if we can.
    If we can't, *requestLineP is meaningless.
 -----------------------------------------------------------------------------*/
-    char * line;
-    bool error;
-    bool endOfHeaders;
+    char * line = NULL;
+    bool error = FALSE;
+    bool endOfHeaders = FALSE;
 
     skipToNonemptyLine(sessionP->conn, deadline, &error);
 
     if (!error)
         readHeader(sessionP->conn, deadline, &endOfHeaders, &line, &error);
 
-    /* End of headers is delimited by an empty line, and we skipped all
-       the empty lines above, so we could not have encountered EOH:
-    */
-    assert(!endOfHeaders);
-
     if (error)
         *httpErrorCodeP = 408;  /* Request Timeout */
     else {
@@ -868,9 +863,11 @@
 -----------------------------------------------------------------------------*/
     bool endOfHeaders;
 
-    assert(!sessionP->validRequest);
-        /* Calling us doesn't make sense if there is already a valid request */
-
+    /* Calling us doesn't make sense if there is already a valid request */
+    if (sessionP->validRequest) {
+       return;
+    }
+	
     *httpErrorCodeP = 0;  /* initial assumption */
     endOfHeaders = false;  /* Caller assures us there is at least one header */
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/server.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/server.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/server.c	Mon Aug  4 21:29:58 2008
@@ -529,7 +529,7 @@
                       uint32_t const timeout,
                       bool *   const keepAliveP) {
 
-    TSession session;
+    TSession session = {0};  /* initilization, an afforadble alternative to random memory being misinterpreted! */
 
     RequestInit(&session, connectionP);
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket_unix.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket_unix.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket_unix.c	Mon Aug  4 21:29:58 2008
@@ -40,42 +40,46 @@
 
 #include "socket_unix.h"
 
-
+#define sane_close(_it) if (_it > -1) {close(_it) ; _it = -1; }
 
 typedef struct {
     int interruptorFd;
     int interrupteeFd;
+	int inuse;
 } interruptPipe;
 
 
 
 static void
-initInterruptPipe(interruptPipe * const pipeP,
+initInterruptPipe(interruptPipe * pipeP,
                   const char **   const errorP) {
 
-    int pipeFd[2];
+    int pipeFd[2] = {-1, -1};
     int rc;
 
     rc = pipe(pipeFd);
 
-    if (rc != 0)
+    if (rc != 0) {
         xmlrpc_asprintf(errorP, "Unable to create a pipe to use to interrupt "
                         "waits.  pipe() failed with errno %d (%s)",
                         errno, strerror(errno));
-    else {
+		pipeP->inuse = 0;
+	} else {
         *errorP = NULL;
         pipeP->interruptorFd = pipeFd[1];
         pipeP->interrupteeFd = pipeFd[0];
+		pipeP->inuse = 1;
     }
 }
 
 
 
 static void
-termInterruptPipe(interruptPipe const pipe) {
-
-    close(pipe.interruptorFd);
-    close(pipe.interrupteeFd);
+termInterruptPipe(interruptPipe *pipeP) {
+	if (pipeP->inuse) {
+		sane_close(pipeP->interruptorFd);
+		sane_close(pipeP->interrupteeFd);
+	}
 }
 
 
@@ -150,10 +154,10 @@
 
     struct socketUnix * const socketUnixP = channelP->implP;
 
-    termInterruptPipe(socketUnixP->interruptPipe);
+    termInterruptPipe(&socketUnixP->interruptPipe);
 
     if (!socketUnixP->userSuppliedFd)
-        close(socketUnixP->fd);
+        sane_close(socketUnixP->fd);
 
     free(socketUnixP);
 }
@@ -484,13 +488,13 @@
     struct socketUnix * socketUnixP;
 
     MALLOCVAR(socketUnixP);
-    
+
     if (socketUnixP == NULL)
         xmlrpc_asprintf(errorP, "Unable to allocate memory for Unix "
                         "channel descriptor");
     else {
         TChannel * channelP;
-        
+
         socketUnixP->fd = fd;
         socketUnixP->userSuppliedFd = TRUE;
 
@@ -498,7 +502,6 @@
 
         if (!*errorP) {
             ChannelCreate(&channelVtbl, socketUnixP, &channelP);
-        
             if (channelP == NULL)
                 xmlrpc_asprintf(errorP, "Unable to allocate memory for "
                                 "channel descriptor.");
@@ -507,7 +510,7 @@
                 *errorP = NULL;
             }
             if (*errorP)
-                termInterruptPipe(socketUnixP->interruptPipe);
+                termInterruptPipe(&socketUnixP->interruptPipe);
         }
         if (*errorP)
             free(socketUnixP);
@@ -561,10 +564,10 @@
 
     struct socketUnix * const socketUnixP = chanSwitchP->implP;
 
-    termInterruptPipe(socketUnixP->interruptPipe);
+    termInterruptPipe(&socketUnixP->interruptPipe);
 
     if (!socketUnixP->userSuppliedFd)
-        close(socketUnixP->fd);
+        sane_close(socketUnixP->fd);
 
     free(socketUnixP);
 }
@@ -660,7 +663,7 @@
     struct socketUnix * acceptedSocketP;
 
     MALLOCVAR(acceptedSocketP);
-
+	
     if (!acceptedSocketP)
         xmlrpc_asprintf(errorP, "Unable to allocate memory");
     else {
@@ -728,13 +731,13 @@
             rc = accept(listenSocketP->fd, &peerAddr, &size);
 
             if (rc >= 0) {
-                int const acceptedFd = rc;
+                int acceptedFd = rc;
 
                 createChannelForAccept(acceptedFd, peerAddr,
                                        &channelP, channelInfoPP, errorP);
 
                 if (*errorP)
-                    close(acceptedFd);
+                    sane_close(acceptedFd);
             } else if (errno == EINTR)
                 interrupted = TRUE;
             else
@@ -802,7 +805,7 @@
         if (!*errorP) {
             ChanSwitchCreate(&chanSwitchVtbl, socketUnixP, &chanSwitchP);
             if (*errorP)
-                termInterruptPipe(socketUnixP->interruptPipe);
+                termInterruptPipe(&socketUnixP->interruptPipe);
 
             if (chanSwitchP == NULL)
                 xmlrpc_asprintf(errorP, "Unable to allocate memory for "
@@ -884,7 +887,7 @@
         xmlrpc_asprintf(errorP, "socket() failed with errno %d (%s)",
                         errno, strerror(errno));
     else {
-        int const socketFd = rc;
+        int socketFd = rc;
 
         setSocketOptions(socketFd, errorP);
         if (!*errorP) {
@@ -896,7 +899,7 @@
             }
         }
         if (*errorP)
-            close(socketFd);
+            sane_close(socketFd);
     }
 }
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/mallocvar.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/mallocvar.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/mallocvar.h	Mon Aug  4 21:29:58 2008
@@ -102,7 +102,7 @@
 
 
 #define MALLOCVAR(varName) \
-    varName = malloc(sizeof(*varName))
+    if (varName = malloc(sizeof(*varName))) memset(varName, 0, sizeof(*varName))
 
 #define MALLOCVAR_NOFAIL(varName) \
     do {if ((varName = malloc(sizeof(*varName))) == NULL) abort();} while(0)



More information about the Freeswitch-branches mailing list