[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;
-		in