[Freeswitch-svn] [commit] r8531 - in freeswitch/branches/lukedashjr/syslibs: freeswitch freeswitch/conf/autoload_configs freeswitch/conf/jingle_profiles freeswitch/conf/lang/en/vm freeswitch/conf/sip_profiles freeswitch/debian freeswitch/docs 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_esf freeswitch/src/mod/applications/mod_fifo freeswitch/src/mod/applications/mod_soundtouch freeswitch/src/mod/applications/mod_voicemail freeswitch/src/mod/codecs/mod_ilbc freeswitch/src/mod/dialplans/mod_dialplan_asterisk freeswitch/src/mod/endpoints/mod_alsa freeswitch/src/mod/endpoints/mod_dingaling freeswitch/src/mod/endpoints/mod_iax freeswitch/src/mod/endpoints/mod_portaudio freeswitch/src/mod/endpoints/mod_reference freeswitch/src/mod/endpoints/mod_sofia freeswitch/src/mod/endpoints/mod_wanpipe freeswitch/src/mod/endpoints/mod_woomera freeswitch/src/mod/formats/mod_local_stream freeswitch/src/mod/formats/mod_sndfile 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_perl freeswitch/src/mod/languages/mod_python freeswitch/src/mod/xml_int/mod_xml_curl freeswitch/w32/Library libs/libedit/src libs/sofia-sip libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip libs/sofia-sip/libsofia-sip-ua/nta libs/sofia-sip/libsofia-sip-ua/nua libs/sofia-sip/libsofia-sip-ua/sresolv libs/sofia-sip/tests

Freeswitch SVN lukedashjr at freeswitch.org
Thu May 22 15:05:32 EDT 2008


Author: lukedashjr
Date: Thu May 22 15:05:28 2008
New Revision: 8531

Added:
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.h
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_types.h
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/nua_types.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_100rel.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_100rel.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_basic_call.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_basic_call.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_call_hold.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_call_hold.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_call_reject.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_call_reject.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_cancel_bye.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_cancel_bye.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_extension.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_extension.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_init.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_init.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nat.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nat.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nat.h
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nat.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nat_tags.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nat_tags.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nua.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua.h
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nua.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua_api.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nua_api.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua_params.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nua_params.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_offer_answer.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_offer_answer.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_ops.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_ops.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_proxy.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_proxy.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_proxy.h
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_proxy.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_refer.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_refer.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_register.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_register.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_session_timer.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_session_timer.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_simple.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_simple.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_sip_events.c
      - copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_sip_events.c
Removed:
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_call_hold.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_extension.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_init.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nat.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nat.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nat_tags.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nua_api.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nua_params.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_offer_answer.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_refer.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_session_timer.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c
Modified:
   freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/conference.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/switch.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_curl.conf.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/client.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/server.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/sounds.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/tts.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml
   freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
   freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog
   freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/private/switch_core_pvt.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_core.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_ivr.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.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/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_esf/mod_esf.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.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.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.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_wanpipe/mod_wanpipe.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.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_sndfile/mod_sndfile.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/Makefile
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp
   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/mod_python_wrap.cpp
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.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_db.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.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_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_regex.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c
   freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj
   freeswitch/branches/lukedashjr/syslibs/libs/libedit/src/makelist
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.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/nua_stack.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.h
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am
   freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/suite_for_nua.c

Log:
MERGE to: http://svn.freeswitch.org/svn/freeswitch/tags/1.0.rc6

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am	Thu May 22 15:05:28 2008
@@ -18,7 +18,7 @@
 	 sound_perfix=`echo $@ | sed -e 's|-.*||'`; \
 	 full_sound_dir=`echo $@ | sed -e 's|^sounds||' | sed -e 's|^-||' | sed -e 's|-install$$||'`; \
 	 test ! -z $$full_sound_dir || full_sound_dir=`echo $(DEFAULT_SOUNDS)`; \
-	 soundfile=`echo freeswitch-sounds-$$full_sound_dir-$(PACKAGE_VERSION).tar.gz`; \
+	 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; \
@@ -158,6 +158,13 @@
 $(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
 
+vm-sync:
+	test -d $(DESTDIR)$(prefix)/conf || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf
+	test -d $(DESTDIR)$(prefix)/conf/lang || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/lang
+	test -d $(DESTDIR)$(prefix)/conf/lang/en || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/lang/en
+	test -d $(DESTDIR)$(prefix)/conf/lang/en/vm || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/lang/en/vm
+	$(INSTALL) -m 644 conf/lang/en/vm/* $(DESTDIR)$(prefix)/conf/lang/en/vm
+
 samples-conf:
 	test -d $(DESTDIR)$(prefix)/conf || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf
 	test -d $(DESTDIR)$(prefix)/conf/dialplan/extensions || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/dialplan/extensions
@@ -268,6 +275,11 @@
 	$(MAKE) -j core
 	$(MAKE) -j modules
 
+sofia-reconf:
+	cd libs/sofia-sip && $(MAKE) clean
+	cd libs/sofia-sip && autoreconf -fi
+	cd libs/sofia-sip && ./configure --prefix=$(PREFIX) --with-pic --with-glib=no --disable-shared
+
 current: update-clean
 	svn update
 	$(MAKE) all

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	Thu May 22 15:05:28 2008
@@ -83,6 +83,7 @@
       <param name="pin-sound" value="conference/conf-pin.wav"/>
       <!-- File to play to when the pin is invalid -->
       <param name="bad-pin-sound" value="conference/conf-bad-pin.wav"/>
+      <param name="comfort-noise-level" value="1400"/>
       <!-- Conference pin -->
       <!--<param name="pin" value="12345"/>-->
       <!-- Default Caller ID Name for outbound calls -->

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	Thu May 22 15:05:28 2008
@@ -27,7 +27,7 @@
 
     <!-- Endpoints -->
     <!-- <load module="mod_dingaling"/> -->
-    <load module="mod_iax"/>
+    <!-- <load module="mod_iax"/> -->
     <!-- <load module="mod_portaudio"/> -->
     <!-- <load module="mod_alsa"/> -->
     <load module="mod_sofia"/>

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	Thu May 22 15:05:28 2008
@@ -37,6 +37,7 @@
   <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/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	Thu May 22 15:05:28 2008
@@ -40,6 +40,8 @@
        -->
       <param name="operator-extension" value="operator XML default"/>
       <param name="operator-key" value="9"/>
+      <param name="vmain-extension" value="vmain XML default"/>
+      <param name="vmain-key" value="*"/>
       <email>
 	<param name="template-file" value="voicemail.tpl"/>
 	<!-- this is the format voicemail_time will have -->

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_curl.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_curl.conf.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_curl.conf.xml	Thu May 22 15:05:28 2008
@@ -14,6 +14,8 @@
       <!-- 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" /> -->
+      <!-- one or more of these imply you want to pick the exact variables that are transmitted -->
+      <!--<param name="enable-post-var" value="Unique-ID"/>-->
     </binding>
   </bindings>
 </configuration>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/client.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/client.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/client.xml	Thu May 22 15:05:28 2008
@@ -1,5 +1,6 @@
 <include>
   <!-- Client Profile (Original mode) -->
+  <!-- to use this profile take the x- away from the open and close tags so its <profile> and </profile> -->
   <x-profile type="client">
     <param name="name" value="$${xmpp_client_profile}"/>
     <param name="login" value="myjid at myserver.com/talk"/>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/server.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/server.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/server.xml	Thu May 22 15:05:28 2008
@@ -1,5 +1,6 @@
 <include>
   <!-- Component (Server to Server Login) -->
+  <!-- to use this profile take the x- away from the open and close tags so its <profile> and </profile> -->
   <x-profile type="component">
     <param name="name" value="$${xmpp_server_profile}"/>
     <param name="password" value="secret"/>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/sounds.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/sounds.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/sounds.xml	Thu May 22 15:05:28 2008
@@ -50,7 +50,7 @@
   </macro>
 
   <macro name="voicemail_message_count">
-    <input pattern="^(1):(.*)$">
+    <input pattern="^(1):(.*)$" break_on_match="true">
       <match>
 	<action function="play-file" data="voicemail/vm-you_have.wav"/>
 	<action function="say" data="$1" method="pronounced" type="items"/>
@@ -59,7 +59,7 @@
 	<action function="play-file" data="voicemail/vm-in_folder.wav"/>
       </match>
     </input>
-    <input pattern="^([0,2-9]+):(.*)$">
+    <input pattern="^(\d+):(.*)$">
       <match>
 	<action function="play-file" data="voicemail/vm-you_have.wav"/>
 	<action function="say" data="$1" method="pronounced" type="items"/>

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/tts.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/tts.xml	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/tts.xml	Thu May 22 15:05:28 2008
@@ -48,12 +48,12 @@
   </macro>
 
   <macro name="voicemail_message_count">
-    <input pattern="^1:(.*)$">
+    <input pattern="^1:(.*)$" break_on_match="true">
       <match>
 	<action function="speak-text" data="you have 1 $1 message in folder ${voicemail_current_folder}."/>
       </match>
     </input>
-    <input pattern="^([0,2-9]+):(.*)$">
+    <input pattern="^(\d+):(.*)$">
       <match>
 	<action function="speak-text" data="you have $1 $2 messages in folder ${voicemail_current_folder}."/>
       </match>

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	Thu May 22 15:05:28 2008
@@ -35,10 +35,11 @@
     <!-- ip address to bind to -->
     <param name="sip-ip" value="$${local_ip_v4}"/>
     <param name="hold-music" value="$${hold_music}"/>
+    <param name="apply-nat-acl" value="rfc1918"/>
     <!--<param name="enable-timer" value="false"/>-->
     <!--<param name="enable-100rel" value="false"/>-->
-    <!--<param name="apply-inbound-acl" value="lan"/>-->
-    <!--<param name="apply-register-acl" value="lan"/>-->
+    <!--<param name="apply-inbound-acl" value="rfc1918"/>-->
+    <!--<param name="apply-register-acl" value="rfc1918"/>-->
     <!--<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 -->

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in	Thu May 22 15:05:28 2008
@@ -3,11 +3,12 @@
 
 # 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.rc5], BUG-REPORT-ADDRESS)
+AC_INIT([freeswitch], [1.0.rc6], BUG-REPORT-ADDRESS)
 AC_SUBST(SWITCH_VERSION_MAJOR, [1])
 AC_SUBST(SWITCH_VERSION_MINOR, [0])
-AC_SUBST(SWITCH_VERSION_MICRO, [rc5])
-AC_SUBST(SWITCH_VERSION_REVISION, [8381])
+AC_SUBST(SWITCH_VERSION_MICRO, [rc6])
+AC_SUBST(SWITCH_VERSION_REVISION, [8500])
+AC_SUBST(SOUNDS_VERSION, [1.0.1])
 
 AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
 
@@ -575,16 +576,11 @@
 	[with_python="try"]
 )
 
-AC_ARG_WITH(
-	[python-config],
-	[AS_HELP_STRING([--with-python-config=PATH], [Location of python-config])],
-	[with_python_config="$withval"],
-	[with_python_config="no"]
-)
-
-
 if test "$with_python" != "no"
 then
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+
 	if test "$with_python" != "yes" -a "$with_python" != "try" ; then
 		AC_MSG_CHECKING([for python])
 		if test ! -x "$with_python" ; then
@@ -605,68 +601,78 @@
 		fi
 		AC_MSG_RESULT([$PYTHON_VER])
 
-		AC_MSG_CHECKING([location of site-packages])
-
-		# NOTE: this assumes our desired location is always the last one in the list
-		# (= system package location is searched last)
-		#
-		# needs double brackets because m4 removes one pair
-		PYTHON_SITE_DIR="`$PYTHON -c 'import sys; print sys.path[[-1]];'`"
-
-		if test -z "$PYTHON_SITE_DIR" ; then
-			AC_MSG_ERROR([Unable to detect python site-packages path])
-		elif test ! -d "$PYTHON_SITE_DIR" ; then
-			AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!])
+		AC_MSG_CHECKING([for python distutils])
+		python_result="`$PYTHON -c 'import distutils;' 2>&1`"
+		if test -z "$python_result" ; then
+			python_has_distutils="yes"
+		else
+			python_has_distutils="no"
 		fi
-		AC_MSG_RESULT([$PYTHON_SITE_DIR])
-		AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR])
+		AC_MSG_RESULT([$python_has_distutils])
+
+		if test "$python_has_distutils" != "no" ; then
+			AC_MSG_CHECKING([location of site-packages])
 
-		if test "$with_python_config" != "no" ; then
-			AC_MSG_CHECKING([for python-config])
-			if test ! -x "$with_python_config" ; then
-				AC_MSG_ERROR([Specified python-config does not exist or is not executable: $with_python_config])
+			PYTHON_SITE_DIR="`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_python_lib(0);'`"
+
+			if test -z "$PYTHON_SITE_DIR" ; then
+				AC_MSG_ERROR([Unable to detect python site-packages path])
+			elif test ! -d "$PYTHON_SITE_DIR" ; then
+				AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!])
 			fi
-			AC_MSG_RESULT([$with_python_config])
-			AC_SUBST([PYTHON_CONFIG], ["$with_python_config"])
-		else
-			AC_PATH_PROG([PYTHON_CONFIG], ["python-config"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"])
-		fi
+			AC_MSG_RESULT([$PYTHON_SITE_DIR])
+			AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR])
 
-		# this one is fatal if with_python != try
-		if test "$PYTHON_CONFIG" != "no" ; then
-			PYTHON_CFLAGS="`$PYTHON_CONFIG --cflags`"
-			PYTHON_LDFLAGS="`$PYTHON_CONFIG --ldflags`"
+			#
+			# python distutils found, get settings from python directly
+			#
+			PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print \" \".join(flags);'`"
+			PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\"+sysconfig.get_config_var(\"VERSION\")); print \" \".join(libs);'`"
+			PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print \"python\" + sysconfig.get_config_var(\"VERSION\");'`"
+
+			# check libpython
+			AC_CHECK_LIB([$PYTHON_LIB], [main], [has_libpython="yes"], [has_libpython="no"])
+
+			if test "$has_libpython" = "no" ; then
+				AS_IF([test "$with_python" = "try"],
+				 	[AC_MSG_WARN([$PYTHON_LIB is unusable])],
+					[AC_MSG_ERROR([$PYTHON_LIB is unusable])]
+				)
+			fi
 
 			# check whether system libpython is usable and has threads support
-			save_LIBS="$LIBS"
+			CFLAGS="$PYTHON_CFLAGS"
 			LIBS="$PYTHON_LDFLAGS"
 			AC_CHECK_FUNC([PyThread_init_thread], [python_has_threads="yes"], [python_has_threads="no"])
-			LIBS="$save_LIBS"
-
-			if test "$python_has_threads" = "no" ; then
-				if test "$with_python" = "try" ; then
-					AC_MSG_ERROR([Your python lacks threads support, can not build mod_python])
-				fi
 
-				AC_MSG_WARN([Your python lacks threads support, can not build mod_python])
+			if test "$python_has_threads" = "no"; then
+				AS_IF([test "$with_python" = "try"],
+					[AC_MSG_WARN([Your python lacks threads support, can not build mod_python])],
+					[AC_MSG_ERROR([Your python lacks threads support, can not build mod_python])]
+				)
 			else
 				AC_MSG_NOTICE([Your python seems OK, do not forget to enable mod_python in modules.conf])
-				AC_SUBST([PYTHON_CFLAGS], [$PYTHON_CFLAGS])
+				AC_SUBST([PYTHON_CFLAGS],  [$PYTHON_CFLAGS])
 				AC_SUBST([PYTHON_LDFLAGS], [$PYTHON_LDFLAGS])
 			fi
 		else
-			if test "$with_python" != "try" ; then
-				AC_MSG_ERROR([python-config could not be found, use --with-python-config to specify the location])
-			fi
-
-			AC_MSG_WARN([python-config could not be found, mod_python will not build, use --with-python-config to specify the location])
-		fi
-	else
-		if test "$with_python" != "try" ; then
-			AC_MSG_ERROR([Could not find python, use --with-python to specify the location])
+			AS_IF([test "$with_python" = "try"],
+				[AC_MSG_WARN([Could not find or use python distutils module: $python_result])],
+				[AC_MSG_ERROR([Could not find or use python distutils module: $python_result])]
+			)
 		fi
 
-		AC_MSG_WARN([Could not find python, mod_python will not build, use --with-python to specify the location])
+		LIBS="$save_LIBS"
+		CFLAGS="$save_CFLAGS"
+
+		unset python_has_threads
+		unset python_has_distutils
+		unset python_result
+	else
+		AS_IF([test "$with_python" = "try"],
+			[AC_MSG_WARN([Could not find python, mod_python will not build, use --with-python to specify the location])],
+			[AC_MSG_ERROR([Could not find python, use --with-python to specify the location])]
+		)
 	fi
 else
 	AC_MSG_WARN([python support disabled, building mod_python will fail!])

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog	Thu May 22 15:05:28 2008
@@ -1,3 +1,22 @@
+freeswitch (1.0~rc6-1) unstable; urgency=low
+
+   * 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
+
+-- Michael Jerris <mike at jerris.com>  Tue, 13 May 2008 02:01:00 -0400
+
 freeswitch (1.0~rc5-1) unstable; urgency=low
 
    * Changed internal state names to avoid confusion

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog	Thu May 22 15:05:28 2008
@@ -1,3 +1,19 @@
+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

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	Thu May 22 15:05:28 2008
@@ -85,7 +85,8 @@
 
 typedef enum {
 	SSF_NONE = 0,
-	SSF_DESTROYED = (1 << 0)
+	SSF_DESTROYED = (1 << 0),
+	SSF_WARN_TRANSCODE = (1 << 1)
 } switch_session_flag_t;
 
 

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	Thu May 22 15:05:28 2008
@@ -254,7 +254,7 @@
   \param flags or'd list of channel flags to test
   \return TRUE if flags were present
 */
-SWITCH_DECLARE(int) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags);
+SWITCH_DECLARE(uint32_t) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags);
 
 /*!
   \brief Set given flag(s) on a given channel

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	Thu May 22 15:05:28 2008
@@ -65,7 +65,7 @@
 	/*! FILE stream buffer to the opened file */
 	FILE *file;
 	/*! path to the file */
-	char *path;
+	char path[512];
 	/*! current category */
 	char category[256];
 	/*! current section */

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	Thu May 22 15:05:28 2008
@@ -732,6 +732,7 @@
   \return the cause code of the attempted call
 */
 SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(_In_opt_ switch_core_session_t *session,
+																		 _In_opt_ switch_event_t *var_event,
 																		 _In_z_ const char *endpoint_name,
 																		 _In_ switch_caller_profile_t *caller_profile,
 																		 _Inout_ switch_core_session_t **new_session,

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	Thu May 22 15:05:28 2008
@@ -48,7 +48,7 @@
 typedef struct switch_io_event_hook_state_change switch_io_event_hook_state_change_t;
 typedef struct switch_io_event_hook_resurrect_session switch_io_event_hook_resurrect_session_t;
 typedef switch_status_t (*switch_outgoing_channel_hook_t)
-(switch_core_session_t *, switch_caller_profile_t *, switch_core_session_t *, switch_originate_flag_t);
+(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t *, switch_originate_flag_t);
 typedef switch_status_t (*switch_receive_message_hook_t) (switch_core_session_t *, switch_core_session_message_t *);
 typedef switch_status_t (*switch_receive_event_hook_t) (switch_core_session_t *, switch_event_t *);
 typedef switch_status_t (*switch_read_frame_hook_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
@@ -56,8 +56,8 @@
 typedef switch_status_t (*switch_write_frame_hook_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
 typedef switch_status_t (*switch_video_write_frame_hook_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
 typedef switch_status_t (*switch_kill_channel_hook_t) (switch_core_session_t *, int);
-typedef switch_status_t (*switch_send_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *);
-typedef switch_status_t (*switch_recv_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *);
+typedef switch_status_t (*switch_send_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *, switch_dtmf_direction_t direction);
+typedef switch_status_t (*switch_recv_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *, switch_dtmf_direction_t direction);
 typedef switch_status_t (*switch_state_change_hook_t) (switch_core_session_t *);
 typedef switch_call_cause_t (*switch_resurrect_session_hook_t)(switch_core_session_t **, switch_memory_pool_t **, void *);
 

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	Thu May 22 15:05:28 2008
@@ -11,10 +11,12 @@
 
 #include <switch.h>
 
+#define this_check(x) do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n"); return x;}} while(0)
+#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 { 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() 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)
 
 
 //
@@ -191,6 +193,8 @@
 	SWITCH_DECLARE(void *)getPrivate(char *var);
 	SWITCH_DECLARE(const char *)getVariable(char *var);
 	SWITCH_DECLARE(switch_status_t) process_callback_result(char *ret);	
+	SWITCH_DECLARE(void) say(const char *tosay, const char *module_name, const char *say_type, const char *say_method);
+	SWITCH_DECLARE(void) sayPhrase(const char *phrase_name, const char *phrase_data = "", const char *phrase_lang = NULL);
 
 	/** \brief Record to a file
 	 * \param filename 
@@ -306,7 +310,7 @@
 
 	SWITCH_DECLARE(bool) ready();
 
-	SWITCH_DECLARE(void) execute(char *app, char *data);
+	SWITCH_DECLARE(void) execute(char *app, char *data=NULL);
 
 	SWITCH_DECLARE(void) sendEvent(Event *sendME);
 

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	Thu May 22 15:05:28 2008
@@ -339,7 +339,7 @@
 */
 #define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, event, data)
 
-SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix);
+SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix,switch_hash_t* vars_map);
 
 ///\}
 

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	Thu May 22 15:05:28 2008
@@ -753,7 +753,7 @@
 												const char *valid_terminators);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key, 
-																  switch_bool_t dial_b, switch_bool_t exec_b, const char *app);
+																  switch_bind_flag_t bind_flags, const char *app);
 SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session);
 SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
 SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type, const char *say_method, switch_input_args_t *args);

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	Thu May 22 15:05:28 2008
@@ -100,7 +100,7 @@
 
 
 typedef switch_call_cause_t (*switch_io_outgoing_channel_t)
-(switch_core_session_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t);
+(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t);
 typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
 typedef switch_status_t (*switch_io_write_frame_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
 typedef switch_status_t (*switch_io_kill_channel_t) (switch_core_session_t *, int);

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	Thu May 22 15:05:28 2008
@@ -233,7 +233,7 @@
   \param flags the flags to test
   \return TRUE or FALSE
 */
-SWITCH_DECLARE(uint8_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags);
+SWITCH_DECLARE(uint32_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags);
 
 /*!
   \brief Clear an RTP Flag

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	Thu May 22 15:05:28 2008
@@ -151,6 +151,20 @@
 } switch_dtmf_t;
 
 typedef enum {
+	SBF_DIAL_ALEG = (1 << 0),
+	SBF_EXEC_ALEG = (1 << 1),
+	SBF_DIAL_BLEG = (1 << 2),
+	SBF_EXEC_BLEG = (1 << 3),
+	SBF_EXEC_OPPOSITE = (1 << 4),
+	SBF_EXEC_SAME = (1 << 5)
+} switch_bind_flag_t;
+
+typedef enum {
+	SWITCH_DTMF_RECV = 0,
+	SWITCH_DTMF_SEND = 1
+} switch_dtmf_direction_t;
+
+typedef enum {
 	SOF_NONE = 0,
 	SOF_NOBLOCK = (1 << 0),
 	SOF_FORKED_DIAL = (1 << 1) 
@@ -513,7 +527,8 @@
 	SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT,
 	SWITCH_MESSAGE_INDICATE_DEFLECT,
 	SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ,
-	SWITCH_MESSAGE_INDICATE_DISPLAY
+	SWITCH_MESSAGE_INDICATE_DISPLAY,
+	SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY
 } switch_core_session_message_types_t;
 
 

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	Thu May 22 15:05:28 2008
@@ -55,6 +55,25 @@
 #define switch_is_file_path(file) (file && ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)))
 #endif
 
+/*!
+  \brief Test for NULL or zero length string
+  \param s the string to test
+  \return true value if the string is NULL or zero length
+*/
+#define switch_strlen_zero(s) (!s || *s == '\0')
+
+
+static inline switch_bool_t switch_is_moh(const char *s)
+{
+	if (switch_strlen_zero(s) || !strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) {
+		return SWITCH_FALSE;
+	}
+	return SWITCH_TRUE;
+}
+
+
+
+
 SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen);
 SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
 SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len);
@@ -73,6 +92,7 @@
 
 SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size_t len);
 
+
 /*!
   \brief Evaluate the truthfullness of a string expression
   \param expr a string expression
@@ -265,13 +285,6 @@
 
 
 /*!
-  \brief Test for NULL or zero length string
-  \param s the string to test
-  \return true value if the string is NULL or zero length
-*/
-#define switch_strlen_zero(s) (!s || *s == '\0')
-
-/*!
   \brief Make a null string a blank string instead
   \param s the string to test
   \return the original string or blank string.

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	Thu May 22 15:05:28 2008
@@ -1513,7 +1513,7 @@
 		timeout = atoi(argv[6]);
 	}
 
-	if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, NULL, cid_name, cid_num, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
+	if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, NULL, cid_name, cid_num, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS || !caller_session) {
 		if (machine) {
 			stream->write_function(stream, "-ERR %s\n", switch_channel_cause2str(cause));
 		} else {
@@ -1555,9 +1555,7 @@
 		stream->write_function(stream, "+OK Created Session: %s\n", switch_core_session_get_uuid(caller_session));
 	}
 
-	if (caller_session) {
-		switch_core_session_rwunlock(caller_session);
-	}
+	switch_core_session_rwunlock(caller_session);
 
 done:
 	switch_safe_free(mycmd);
@@ -1715,6 +1713,11 @@
 	char *reply, *freply = NULL;
 	switch_event_t *event;
 	char *arg;
+	switch_memory_pool_t *pool;
+
+	if (!job) return NULL;
+
+	pool = job->pool;
 
 	SWITCH_STANDARD_STREAM(stream);
 
@@ -1747,12 +1750,9 @@
 	switch_safe_free(stream.data);
 	switch_safe_free(freply);
 
-	if (job) {
-		switch_memory_pool_t *pool = job->pool;
-		job = NULL;
-		switch_core_destroy_memory_pool(&pool);
-		pool = NULL;
-	}
+	job = NULL;
+	switch_core_destroy_memory_pool(&pool);
+	pool = NULL;
 	return NULL;
 }
 
@@ -1921,7 +1921,7 @@
 {
 	char sql[1024];
 	char *errmsg;
-	switch_core_db_t *db = switch_core_db_handle();
+	switch_core_db_t *db;
 	struct holder holder = { 0 };
 	int help = 0;
 	char *mydata = NULL, *argv[6] = {0};
@@ -1933,6 +1933,8 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+	db = switch_core_db_handle();
+
 	if (cmd && (mydata = strdup(cmd))) {
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 		command = argv[0];
@@ -2023,6 +2025,12 @@
 	} else if (!strcasecmp(as, "xml")) {
 		switch_core_db_exec(db, sql, show_as_xml_callback, &holder, &errmsg);
 
+		if (errmsg) {
+			stream->write_function(stream, "-ERR SQL Error [%s]\n", errmsg);
+			switch_core_db_free(errmsg);
+			errmsg = NULL;
+		}
+
 		if (holder.xml) {
 			char count[50];
 			char *xmlstr;
@@ -2207,6 +2215,7 @@
 							switch_xml_free(xml);
 						} else {
 							stream->write_function(stream, "-ERR Unable to create xml!\n");
+							switch_event_destroy(&event);
 							switch_core_session_rwunlock(psession);
 							goto done;
 						}
@@ -2219,7 +2228,7 @@
 					switch_event_destroy(&event);
 					free(buf);
 				} else {
-					abort();
+					stream->write_function(stream, "-ERR Allocation error\n");
 				}
 
 				switch_core_session_rwunlock(psession);

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	Thu May 22 15:05:28 2008
@@ -349,7 +349,7 @@
 static switch_status_t conference_say(conference_obj_t * conference, const char *text, uint32_t leadin);
 static void conference_list(conference_obj_t * conference, switch_stream_handle_t *stream, char *delim);
 SWITCH_STANDARD_API(conf_api_main);
-static switch_status_t audio_bridge_on_routing(switch_core_session_t *session);
+
 static switch_status_t conference_outcall(conference_obj_t * conference,
 										  char *conference_name,
 										  switch_core_session_t *session,
@@ -1755,7 +1755,7 @@
 		}
 
 		for (cp = call_list; cp; cp = cp->next) {
-			conference_outcall_bg(member->conference, NULL, member->session, cp->string, to, switch_str_nil(flags), cid_name, cid_num);
+			conference_outcall_bg(member->conference, NULL, NULL, cp->string, to, switch_str_nil(flags), cid_name, cid_num);
 		}
 	}
 	/* Fair WARNING, If you expect the caller to hear anything or for digit handling to be proccessed,      */
@@ -3726,31 +3726,6 @@
 
 }
 
-/* outbound call bridge progress call state callback handler */
-static switch_status_t audio_bridge_on_routing(switch_core_session_t *session)
-{
-	switch_channel_t *channel = NULL;
-
-	channel = switch_core_session_get_channel(session);
-
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM ROUTING\n");
-
-	/* put the channel in a passive state so we can loop audio to it */
-	switch_channel_set_state(channel, CS_SOFT_EXECUTE);
-	return SWITCH_STATUS_FALSE;
-}
-
-static switch_state_handler_table_t audio_bridge_peer_state_handlers = {
-	/*.on_init */ NULL,
-	/*.on_routing */ audio_bridge_on_routing,
-	/*.on_execute */ NULL,
-	/*.on_hangup */ NULL,
-	/*.on_exchange_media */ NULL,
-	/*.on_soft_execute */ NULL,
-	/*.on_consume_media */ NULL,
-};
-
-
 /* generate an outbound call from the conference */
 static switch_status_t conference_outcall(conference_obj_t * conference,
 										  char *conference_name,
@@ -3769,7 +3744,6 @@
 
 	if (conference == NULL) {
 		char *dialstr = switch_mprintf("{ignore_early_media=true}%s", bridgeto);
-
 		status = switch_ivr_originate(NULL, &peer_session, cause, dialstr, 60, NULL, cid_name, cid_num, NULL, SOF_NONE);
 		switch_safe_free(dialstr);
 
@@ -3802,8 +3776,9 @@
 	}
 
 	/* establish an outbound call leg */
+		
 	if (switch_ivr_originate(session,
-							 &peer_session, cause, bridgeto, timeout, &audio_bridge_peer_state_handlers, cid_name, cid_num,
+							 &peer_session, cause, bridgeto, timeout, NULL,  cid_name, cid_num,
 							 NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n", switch_channel_cause2str(*cause));
 		if (caller_channel) {
@@ -3811,10 +3786,11 @@
 		}
 		goto done;
 	}
-
+	
 	rdlock = 1;
 	peer_channel = switch_core_session_get_channel(peer_session);
-
+	switch_channel_set_state(peer_channel, CS_SOFT_EXECUTE);
+	
 	/* make sure the conference still exists */
 	if (!switch_test_flag(conference, CFLAG_RUNNING)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference is gone now, nevermind..\n");
@@ -4982,7 +4958,7 @@
 		conference->mflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
 	}
 
-	if (!switch_strlen_zero(moh_sound)) {
+	if (!switch_strlen_zero(moh_sound) && switch_is_moh(moh_sound)) {
 		conference->moh_sound = switch_core_strdup(conference->pool, moh_sound);
 	}
 

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	Thu May 22 15:05:28 2008
@@ -160,7 +160,7 @@
 	}
 }
 
-#define BIND_SYNTAX "<key> [a|b] [a|b] <app>"
+#define BIND_SYNTAX "<key> [a|b|ab] [a|b|o|s] <app>"
 SWITCH_STANDARD_APP(dtmf_bind_function)
 {
 	char *argv[4] = { 0 };
@@ -170,10 +170,46 @@
 	if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
 		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
 		int kval = atoi(argv[0]);
-		char a1 = (char)tolower(*argv[1]);
-		char a2 = (char)tolower(*argv[2]);
-		
-		if (switch_ivr_bind_dtmf_meta_session(session, kval, a1 == 'b', a2 == 'b', argv[3]) != SWITCH_STATUS_SUCCESS) {
+		switch_bind_flag_t bind_flags = 0;
+
+		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");
+			} else {
+				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");
+			} else {
+				bind_flags |= SBF_EXEC_BLEG;
+			}
+		}
+
+		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");
+			} else {
+				bind_flags |= SBF_EXEC_OPPOSITE;
+			}
+		}
+
+		if (strchr(argv[2], 's')) {
+			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");
+			} else {
+				bind_flags |= SBF_EXEC_SAME;
+			}
+		}
+
+		if (switch_ivr_bind_dtmf_meta_session(session, kval, bind_flags, argv[3]) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bind Error!\n");
 		}
 	} else {
@@ -714,16 +750,16 @@
 		if (!strcasecmp(name, "caller_id_number")) {
 			caller_profile->caller_id_number = val;
 		}
-		if (!strcasecmp(name, "caller_ton")) {
+		if (val && !strcasecmp(name, "caller_ton")) {
 			caller_profile->caller_ton = (uint8_t)atoi(val);
 		}
-		if (!strcasecmp(name, "caller_numplan")) {
+		if (val && !strcasecmp(name, "caller_numplan")) {
 			caller_profile->caller_numplan = (uint8_t)atoi(val);
 		}
-		if (!strcasecmp(name, "destination_number_ton")) {
+		if (val && !strcasecmp(name, "destination_number_ton")) {
 			caller_profile->destination_number_ton = (uint8_t)atoi(val);
 		}
-		if (!strcasecmp(name, "destination_number_numplan")) {
+		if (val && !strcasecmp(name, "destination_number_numplan")) {
 			caller_profile->destination_number_numplan = (uint8_t)atoi(val);
 		}
 		if (!strcasecmp(name, "ani")) {
@@ -768,7 +804,15 @@
 	} else {
 		exports = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE);
 		var = switch_core_session_strdup(session, data);
-		val = strchr(var, '=');
+		if (var) {
+			val = strchr(var, '=');
+			if (!strncasecmp(var, "nolocal:", 8)) {
+				var_name = var + 8;
+				local = 0;
+			} else {
+				var_name = var;
+			}
+		}
 
 		if (val) {
 			*val++ = '\0';
@@ -777,14 +821,7 @@
 			}
 		}
 
-		if (!strncasecmp(var, "nolocal:", 8)) {
-			var_name = var + 8;
-			local = 0;
-		} else {
-			var_name = var;
-		}
-
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", var_name, val ? val : "UNDEF");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", var_name ? var_name : "", val ? val : "UNDEF");
 		switch_channel_set_variable(channel, var, val);
 
 		if (var && val) {
@@ -864,12 +901,14 @@
 
 			for (x = 0; x < argc; x++) {
 				char *p, *this = argv[x];
-				p = this;
-				while(*p == ' ') *p++ = '\0';
-				this = p;
-				
 				if (this) {
-					char *var = this, *val = NULL;
+					char *var, *val;
+					p = this;
+					while(*p == ' ') *p++ = '\0';
+					this = p;
+				
+					var = this;
+					val = NULL;
 					if ((val = strchr(var, '='))) {
 						p = val - 1;
 						*val++ = '\0';
@@ -1337,6 +1376,7 @@
 				switch_channel_set_caller_extension(peer_channel, extension);
 				switch_channel_set_flag(peer_channel, CF_TRANSFER);
 				switch_channel_set_state(peer_channel, CS_EXECUTE);
+				switch_channel_set_variable(channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE, NULL);
 
 				return SWITCH_STATUS_FALSE;
 			}
@@ -1380,6 +1420,8 @@
 	switch_channel_t *channel, *peer_channel = NULL;
 	const char *bond = NULL;
 	int timelimit = 60;
+	switch_core_session_t *b_session = NULL;
+
 
 	channel = switch_core_session_get_channel(session);
 
@@ -1394,8 +1436,8 @@
 		timelimit = atoi(var);
 	}
 
-	if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
-		return;
+	if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS || !peer_session) {
+		goto end;
 	}
 
 	peer_channel = switch_core_session_get_channel(peer_session);
@@ -1404,18 +1446,27 @@
 	
 	switch_ivr_multi_threaded_bridge(session, peer_session, xfer_on_dtmf, peer_session, NULL);
 	
+	switch_channel_clear_flag(peer_channel, CF_INNER_BRIDGE);
+	switch_channel_clear_flag(channel, CF_INNER_BRIDGE);
+
+	if (!switch_channel_get_state(peer_channel) >= CS_HANGUP) {
+		switch_core_session_rwunlock(peer_session);
+		goto end;
+	}
+
 	if (bond) {
-		switch_core_session_t *b_session;
 		char buf[128] = "";
 
-		if ((b_session = switch_core_session_locate(bond))) {
+		if (!switch_channel_ready(channel)) {
+			switch_ivr_uuid_bridge(switch_core_session_get_uuid(peer_session), bond);
+		} else if ((b_session = switch_core_session_locate(bond))) {
 			switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
 			switch_snprintf(buf, sizeof(buf), "%s %s", switch_core_session_get_uuid(peer_session), switch_core_session_get_uuid(session));
 			switch_channel_set_variable(b_channel, "xfer_uuids", buf);
 
 			switch_snprintf(buf, sizeof(buf), "%s %s", switch_core_session_get_uuid(peer_session), bond);
 			switch_channel_set_variable(channel, "xfer_uuids", buf);
-			
+
 			switch_core_event_hook_add_state_change(session, hanguphook);
 			switch_core_event_hook_add_state_change(b_session, hanguphook);
 
@@ -1424,13 +1475,11 @@
 		
 		switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, bond);
 	}
-
-	if (peer_session) {
-		switch_core_session_rwunlock(peer_session);
-	}
 	
+	switch_core_session_rwunlock(peer_session);
+	
+ end:
 	switch_channel_set_variable(channel, SWITCH_HOLDING_UUID_VARIABLE, NULL);
-
 }
 
 
@@ -1638,7 +1687,10 @@
 	}
 
 	path = switch_core_session_strdup(session, data);
-	if (path && (p = strchr(path, '+'))) {
+
+	if (!path) return;
+
+	if ((p = strchr(path, '+'))) {
 		char *q = p - 1;
 		while(q && *q == ' ') {
 			*q = '\0';
@@ -1771,6 +1823,7 @@
 /* fake chan_user */
 switch_endpoint_interface_t *user_endpoint_interface;
 static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
+												 switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
 												 switch_core_session_t **new_session, 
 												 switch_memory_pool_t **pool,
@@ -1780,6 +1833,7 @@
 };
 
 static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
+												 switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
 												 switch_core_session_t **new_session, 
 												 switch_memory_pool_t **pool,
@@ -1798,6 +1852,8 @@
 
 	user = strdup(outbound_profile->destination_number);
 
+	if (!user) goto done;
+
 	if (!(domain = strchr(user, '@'))) {
 		goto done;
 	}
@@ -1856,7 +1912,18 @@
 			d_dest = switch_channel_expand_variables(channel, dest);
 
 		} else {
-			d_dest = strdup(dest);
+			switch_event_t *event = var_event;
+			if (!event) {
+				switch_event_create(&event, SWITCH_EVENT_MESSAGE);
+				switch_assert(event);
+			}
+			
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", user);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain);
+			d_dest = switch_event_expand_headers(event, dest);
+			if (event && event != var_event) {
+				switch_event_destroy(&event);
+			}
 		}
 		
 		if ((flags & SOF_FORKED_DIAL)) {

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	Thu May 22 15:05:28 2008
@@ -76,6 +76,8 @@
 	switch_port_t mcast_port = 34567;
 	switch_port_t mcast_control_port = 6061;
 	char *mcast_port_str = "34567";
+	const char *esf_broadcast_ip = NULL, *var;
+
 
 	if (!switch_strlen_zero((char *) data)) {
 		mydata = switch_core_session_strdup(session, data);
@@ -83,6 +85,10 @@
 
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 	
+		if ((var = switch_channel_get_variable(channel, "esf_multicast_ip"))) {
+			mcast_ip = switch_core_session_strdup(session, var);
+		}
+
 		if (!switch_strlen_zero(argv[0])) {
 			mcast_ip = argv[0];
 		}
@@ -165,13 +171,20 @@
             }
         }
 
-		switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET);
-		if (!(rtp_port = switch_rtp_request_port(guess_ip))) {
+		if ((var = switch_channel_get_variable(channel, "esf_broadcast_ip"))) {
+			esf_broadcast_ip = switch_core_session_strdup(session, var);
+		} else {
+			switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET);
+			esf_broadcast_ip = guess_ip;
+		}
+
+
+		if (!(rtp_port = switch_rtp_request_port(esf_broadcast_ip))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Port Error\n");
 			goto fail;
 		}
 
-		rtp_session = switch_rtp_new(guess_ip,
+		rtp_session = switch_rtp_new(esf_broadcast_ip,
 									 rtp_port,
 									 mcast_ip,
 									 mcast_port,

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	Thu May 22 15:05:28 2008
@@ -569,7 +569,11 @@
 			switch_core_session_flush_private_events(session);
 
 			if (moh) {
-				switch_ivr_play_file(session, NULL, moh, &args);
+				switch_status_t status = switch_ivr_play_file(session, NULL, moh, &args);
+				if (!SWITCH_READ_ACCEPTABLE(status)) {
+					aborted = 1;
+					goto abort;
+				}
 			} else {
 				switch_ivr_collect_digits_callback(session, &args, 0);
 			}
@@ -736,10 +740,15 @@
 			pop = NULL;
 			
             if (moh && do_wait) {
+				switch_status_t status = switch_ivr_play_file(session, NULL, moh, &args);
 				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);
+				
+				if (!SWITCH_READ_ACCEPTABLE(status)) {
+					break;
+				}
             }
 			
 			for(i = 0; i < node_count; i++) {

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp	Thu May 22 15:05:28 2008
@@ -55,7 +55,7 @@
     int literal;
 };
 
-static switch_status_t on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
+static switch_status_t on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
 {
 
     switch_media_bug_t *bug;

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	Thu May 22 15:05:28 2008
@@ -81,11 +81,13 @@
 	char rew_key[2];
 	char urgent_key[2];
 	char operator_key[2];
+	char vmain_key[2];
 	char file_ext[10];
 	char *record_title;
 	char *record_comment;
 	char *record_copyright;
 	char *operator_ext;
+	char *vmain_ext;
 	char *tone_spec;
 	char *storage_dir;
 	char *callback_dialplan;
@@ -272,6 +274,8 @@
 		char *urgent_key = "*";
 		char *operator_key = "";
 		char *operator_ext = "";
+		char *vmain_key = "";
+		char *vmain_ext = "";
 		char *tone_spec = "%(1000, 0, 640)";
 		char *file_ext = "wav";
 		char *storage_dir = "";
@@ -433,6 +437,10 @@
 				operator_key = val;
 			} else if (!strcasecmp(var, "operator-extension") && !switch_strlen_zero(val)) {
 				operator_ext = val;
+                        } else if (!strcasecmp(var, "vmain-key") && !switch_strlen_zero(val)) {
+                                vmain_key = val;
+                        } else if (!strcasecmp(var, "vmain-extension") && !switch_strlen_zero(val)) {
+                                vmain_ext = val;
 			} else if (!strcasecmp(var, "storage-dir") && !switch_strlen_zero(val)) {
 				storage_dir = val;
 			} else if (!strcasecmp(var, "callback-dialplan") && !switch_strlen_zero(val)) {
@@ -652,11 +660,13 @@
 			*profile->rew_key = *rew_key;
 			*profile->urgent_key = *urgent_key;
 			*profile->operator_key = *operator_key;
+                        *profile->vmain_key = *vmain_key;
 			profile->record_threshold = record_threshold;
 			profile->record_silence_hits = record_silence_hits;
 			profile->record_sample_rate = record_sample_rate;
 
 			profile->operator_ext = switch_core_strdup(globals.pool, operator_ext);
+                        profile->vmain_ext = switch_core_strdup(globals.pool, vmain_ext);
 			profile->storage_dir = switch_core_strdup(globals.pool, storage_dir);
 			profile->tone_spec = switch_core_strdup(globals.pool, tone_spec);
 			profile->callback_dialplan = switch_core_strdup(globals.pool, callback_dialplan);
@@ -1876,6 +1886,20 @@
 					goto end;
 				}
 			}
+		} else if (!strcasecmp(buf, profile->vmain_key) && !switch_strlen_zero(profile->vmain_key)) {
+			int argc;
+			char *argv[4];
+			char *mycmd;
+
+			if (!switch_strlen_zero(profile->vmain_ext) && (mycmd = switch_core_session_strdup(session, profile->vmain_ext))) {
+				argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+				if (argc >= 1 && argc <= 4) {
+					switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
+					/* the application still runs after we leave it so we need to make sure that we dont do anything evil */
+					send_mail=0;
+					goto end;
+				}
+			}
 		} else {
 			goto greet;
 		}
@@ -2153,11 +2177,75 @@
 	}
 }
 
-static void  message_query_handler(switch_event_t *event)
+#define BOXCOUNT_SYNTAX "<user>@<domain>[|[new|saved|new-urgent|saved-urgent|all]]"
+SWITCH_STANDARD_API(boxcount_api_function)
+{
+	char *dup;
+	char *how = "new";
+	int total_new_messages = 0;
+	int total_saved_messages = 0;
+	int total_new_urgent_messages = 0;
+	int total_saved_urgent_messages = 0;
+
+	if (cmd) {
+		switch_hash_index_t *hi;
+		void *val;
+		vm_profile_t *profile;
+		char *id, *domain, *p;
+
+		dup = strdup(cmd);
+		id = dup;
+
+		if (!strncasecmp(cmd, "sip:", 4)) {
+			id += 4;
+		}
+
+		if (!id) {
+			stream->write_function(stream, "%d", 0);
+			free(dup);
+			return SWITCH_STATUS_SUCCESS;
+		}
+		
+		if ((domain = strchr(id, '@'))) {
+			*domain++ = '\0';
+			if ((p = strchr(domain, '|'))) {
+				*p++ = '\0';
+				how = p;
+			}
+			
+			for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+				switch_hash_this(hi, NULL, NULL, &val);
+				profile = (vm_profile_t *) val;
+				total_new_messages =  total_saved_messages = 0;
+				message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
+							  &total_new_urgent_messages, &total_saved_urgent_messages);
+			}
+		}
+
+		switch_safe_free(id);
+	}
+
+	if (!strcasecmp(how, "saved")) {
+		stream->write_function(stream, "%d", total_saved_messages);
+	} else if (!strcasecmp(how, "new-urgent")) {
+		stream->write_function(stream, "%d", total_new_urgent_messages);
+	} else if (!strcasecmp(how, "new-saved")) {
+		stream->write_function(stream, "%d", total_saved_urgent_messages);
+	} else if (!strcasecmp(how, "all")) {
+		stream->write_function(stream, "%d:%d:%d:%d", total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+	} else {
+		stream->write_function(stream, "%d", total_new_messages);
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static void message_query_handler(switch_event_t *event)
 {
 	char *account = switch_event_get_header(event, "message-account");
 	int created = 0;
 	switch_event_t *new_event = NULL;
+	char *dup = NULL;
 
 	if (account) {
 		switch_hash_index_t *hi;
@@ -2169,12 +2257,17 @@
 		vm_profile_t *profile;
 		char *id, *domain;
 
+		dup = strdup(account);
+		id = dup;
+
 		if (!strncasecmp(account, "sip:", 4)) {
-			id = strdup(account + 4);
-		} else {
-			id = strdup(account);
+			id += 4;
+		}
+
+		if (!id) {
+			free(dup);
+			return;
 		}
-		switch_assert(id);
 
 		if ((domain = strchr(id, '@'))) {
 			*domain++ = '\0';
@@ -2200,7 +2293,7 @@
 			}
 		}
 
-		switch_safe_free(id);
+		switch_safe_free(dup);
 
 	}
 
@@ -2784,7 +2877,8 @@
 	}
 
 	SWITCH_ADD_API(commands_api_interface, "voicemail", "voicemail", voicemail_api_function, VOICEMAIL_SYNTAX);
-
+	SWITCH_ADD_API(commands_api_interface, "vm_boxcount", "vm_boxcount", boxcount_api_function, BOXCOUNT_SYNTAX);
+	
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_NOUNLOAD;
 }

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	Thu May 22 15:05:28 2008
@@ -115,7 +115,7 @@
 		float buf[240];
 
 		for (x = 0; x < loops && new_len < *encoded_data_len; x++) {
-			for (y = 0; y < context->dbytes / sizeof(short); y++) {
+			for (y = 0; y < context->dbytes / sizeof(short) && y < 240; y++) {
 				buf[y] = ddp[y];
 			}
 			iLBC_encode(edp, buf, &context->encoder);
@@ -157,7 +157,7 @@
 
 		for (x = 0; x < loops && new_len < *decoded_data_len; x++) {
 			iLBC_decode(buf, edp, &context->decoder, 1);
-			for (y = 0; y < context->dbytes / sizeof(short); y++) {
+			for (y = 0; y < context->dbytes / sizeof(short) && y < 240; y++) {
 				ddp[y] = (short) buf[y];
 			}
 			ddp += context->dbytes / sizeof(short);

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	Thu May 22 15:05:28 2008
@@ -289,7 +289,7 @@
 
 /* fake chan_sip */
 switch_endpoint_interface_t *sip_endpoint_interface;
-static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												switch_caller_profile_t *outbound_profile,
 												switch_core_session_t **new_session, 
 												switch_memory_pool_t **pool,
@@ -298,7 +298,7 @@
 	/*.outgoing_channel */ sip_outgoing_channel
 };
 
-static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												switch_caller_profile_t *outbound_profile,
 												switch_core_session_t **new_session, 
 												switch_memory_pool_t **pool,
@@ -316,7 +316,7 @@
 	}
 
 	outbound_profile->destination_number = switch_core_sprintf(outbound_profile->pool, "%s/%s", profile, outbound_profile->destination_number);
-	return switch_core_session_outgoing_channel(session, "sofia", outbound_profile, new_session, pool, SOF_NONE);
+	return switch_core_session_outgoing_channel(session, var_event, "sofia", outbound_profile, new_session, pool, SOF_NONE);
 }
 
 
@@ -324,7 +324,7 @@
 
 /* fake chan_iax2 */
 switch_endpoint_interface_t *iax2_endpoint_interface;
-static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
 												 switch_core_session_t **new_session, 
 												 switch_memory_pool_t **pool,
@@ -333,13 +333,13 @@
 	/*.outgoing_channel */ iax2_outgoing_channel
 };
 
-static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
 												 switch_core_session_t **new_session, 
 												 switch_memory_pool_t **pool,
 												 switch_originate_flag_t flags)
 {
-	return switch_core_session_outgoing_channel(session, "iax", outbound_profile, new_session, pool, SOF_NONE);
+	return switch_core_session_outgoing_channel(session, var_event, "iax", outbound_profile, new_session, pool, SOF_NONE);
 }
 
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c	Thu May 22 15:05:28 2008
@@ -146,7 +146,7 @@
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -753,7 +753,7 @@
 /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
    that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
 */
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {

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	Thu May 22 15:05:28 2008
@@ -208,7 +208,7 @@
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -1566,7 +1566,7 @@
 /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
    that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
 */
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.c	Thu May 22 15:05:28 2008
@@ -2984,7 +2984,12 @@
 static struct iax_event *iax_net_read(void)
 {
 	unsigned char buf[65536];
-	int res, sinlen;
+	int res;
+#ifndef __Linux__
+	socklen_t sinlen;
+#else
+	unsigned int sinlen;
+#endif
 	struct sockaddr_in sin;
 
 	sinlen = sizeof(sin);

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	Thu May 22 15:05:28 2008
@@ -419,7 +419,7 @@
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -693,7 +693,7 @@
 /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
    that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
 */
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {

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	Thu May 22 15:05:28 2008
@@ -143,7 +143,7 @@
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -631,7 +631,7 @@
 /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
    that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
 */
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.c	Thu May 22 15:05:28 2008
@@ -103,7 +103,7 @@
 static switch_status_t channel_on_routing(switch_core_session_t *session);
 static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -395,7 +395,7 @@
 /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
    that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
 */
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {

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	Thu May 22 15:05:28 2008
@@ -52,7 +52,7 @@
 
 static switch_status_t sofia_on_exchange_media(switch_core_session_t *session);
 static switch_status_t sofia_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												  switch_caller_profile_t *outbound_profile, switch_core_session_t **new_session,
 												  switch_memory_pool_t **pool, switch_originate_flag_t flags);
 static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -339,6 +339,7 @@
 	const char *val;
 	const char *b_sdp = NULL;
 	int is_proxy = 0;
+	char *sticky = NULL;
 
 	if (switch_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) {
 		return SWITCH_STATUS_SUCCESS;
@@ -405,9 +406,20 @@
 			session_timeout = v_session_timeout;
 		}
 	}
+	
+	if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+		(val = switch_channel_get_variable(channel, "sip-force-contact")) || 
+		((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
+		sticky = tech_pvt->record_route;
+		session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
+		switch_channel_set_variable(channel, "sip_nat_detected", "true");
+	}
+
+	
 
 	nua_respond(tech_pvt->nh, SIP_200_OK,
 				NUTAG_AUTOANSWER(0),
+				TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
 				NUTAG_SESSION_TIMER(session_timeout),
 				SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
 				SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
@@ -752,6 +764,12 @@
 			
 		}
 		break;
+	case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY:
+		if (tech_pvt->rtp_session && switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot pass 2833 on a transcoded call.\n");
+			switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
+		}
+		break;
 	case SWITCH_MESSAGE_INDICATE_BROADCAST: {
 		const char *ip = NULL, *port = NULL;
 		ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
@@ -957,7 +975,7 @@
 				code = 488;
 			}
 			
-			if (!reason && code != 407) {
+			if (switch_strlen_zero(reason) && code != 407) {
 				reason = sip_status_phrase(code);
 				if (switch_strlen_zero(reason)) {
 					reason = "Because";
@@ -967,7 +985,7 @@
 			if (code == 407 && !msg->numeric_arg) {
 				const char *to_uri = switch_channel_get_variable(channel, "sip_to_uri");
 				const char *to_host = reason;
-					
+
 				if (switch_strlen_zero(to_host)) {
 					to_host = switch_channel_get_variable(channel, "sip_to_host");
 				}
@@ -996,7 +1014,7 @@
 					switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 				}
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d %s\n", code, reason);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason);
 				
 				if (!switch_strlen_zero(((char *)msg->pointer_arg))) {
 					tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, (char *)msg->pointer_arg);
@@ -1033,6 +1051,9 @@
 		break;
 	case SWITCH_MESSAGE_INDICATE_PROGRESS:
 		{
+			char *sticky = NULL;
+			const char *val = NULL;
+
 			if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
 				
 				switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
@@ -1081,9 +1102,19 @@
 					}
 				}
 				switch_channel_mark_pre_answered(channel);
+
+
+				if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+					(val = switch_channel_get_variable(channel, "sip-force-contact")) || 
+					((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
+					sticky = tech_pvt->record_route;
+					switch_channel_set_variable(channel, "sip_nat_detected", "true");
+				}
+
 				nua_respond(tech_pvt->nh,
 							SIP_183_SESSION_PROGRESS,
 							NUTAG_AUTOANSWER(0),
+							TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
 							SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
 							SOATAG_REUSE_REJECTED(1),
 							SOATAG_ORDERED_USER(1),
@@ -1651,7 +1682,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												  switch_caller_profile_t *outbound_profile, switch_core_session_t **new_session,
 												  switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {
@@ -1663,7 +1694,7 @@
 	private_object_t *tech_pvt = NULL;
 	switch_channel_t *nchannel;
 	char *host = NULL, *dest_to = NULL;
-
+	
 	*new_session = NULL;
 
 	if (!(nsession = switch_core_session_request(sofia_endpoint_interface, pool))) {
@@ -1859,6 +1890,8 @@
 		switch_ivr_transfer_variable(session, nsession, "sip_auto_answer");
 		switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_HEADER_PREFIX_T);
 		switch_ivr_transfer_variable(session, nsession, "sip_video_fmtp");
+		switch_ivr_transfer_variable(session, nsession, "sip-force-contact");
+		switch_ivr_transfer_variable(session, nsession, "sip_sticky_contact");
 
 		if (switch_core_session_compare(session, nsession)) {
 			/* It's another sofia channel! so lets cache what they use as a pt for telephone event so 

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	Thu May 22 15:05:28 2008
@@ -45,7 +45,7 @@
 #ifdef SWITCH_HAVE_ODBC
 #include <switch_odbc.h>
 #endif
-
+#define SOFIA_NAT_SESSION_TIMEOUT 20
 #define SOFIA_MAX_ACL 100
 
 #define MODNAME "mod_sofia"
@@ -65,7 +65,9 @@
 
 #define SOFIA_SESSION_TIMEOUT "sofia_session_timeout"
 #define MY_EVENT_REGISTER "sofia::register"
+#define MY_EVENT_UNREGISTER "sofia::unregister"
 #define MY_EVENT_EXPIRE "sofia::expire"
+
 #define MULTICAST_EVENT "multicast::event"
 #define SOFIA_REPLACES_HEADER "_sofia_replaces_"
 #define SOFIA_USER_AGENT "FreeSWITCH-mod_sofia/" SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO "-" SWITCH_VERSION_REVISION
@@ -172,7 +174,7 @@
 	TFLAG_REFER = (1 << 17),
 	TFLAG_NOHUP = (1 << 18),
 	TFLAG_XFER = (1 << 19),
-	TFLAG_RESERVED = (1 << 20),
+	TFLAG_NAT = (1 << 20),
 	TFLAG_BUGGY_2833 = (1 << 21),
 	TFLAG_SIP_HOLD = (1 << 22),
 	TFLAG_INB_NOMEDIA = (1 << 23),
@@ -330,6 +332,8 @@
 	uint32_t acl_count;
 	char *reg_acl[SOFIA_MAX_ACL];
 	uint32_t reg_acl_count;
+	char *nat_acl[SOFIA_MAX_ACL];
+	uint32_t nat_acl_count;
 
 };
 
@@ -394,6 +398,7 @@
 	char *gateway_name;
 	char *local_crypto_key;
 	char *remote_crypto_key;
+	char *record_route;
 	int crypto_tag;
 	unsigned char local_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
 	unsigned char remote_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
@@ -434,6 +439,8 @@
 	uint32_t video_count;
 	sofia_dtmf_t dtmf_type;
 	int q850_cause;
+	char *remote_ip;
+	int remote_port;
 };
 
 struct callback_t {
@@ -444,7 +451,8 @@
 
 typedef enum {
 	REG_REGISTER,
-	REG_INVITE
+	REG_AUTO_REGISTER,
+	REG_INVITE,
 } sofia_regtype_t;
 
 typedef enum {
@@ -626,3 +634,4 @@
 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);
+

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	Thu May 22 15:05:28 2008
@@ -1304,6 +1304,12 @@
 						profile->username = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "context")) {
 						profile->context = switch_core_strdup(profile->pool, val);
+					} 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);
@@ -1534,6 +1540,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->status = SOFIA_GATEWAY_UP;
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ping failed %s\n", gateway->name);
@@ -2642,7 +2651,8 @@
 	uint32_t sess_max = switch_core_session_limit(0);
 	int is_auth = 0, calling_myself = 0;
 	su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
-	
+	int network_port = 0;
+	char *sticky = NULL, *is_nat = 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());
@@ -2657,30 +2667,77 @@
 
 	
 	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);
+	
+	if (profile->nat_acl_count) {
+		uint32_t x = 0;
+		int ok = 1;
+		char *last_acl = NULL;
+		const char *contact_host = NULL;
+
+		if (sip && sip->sip_contact && sip->sip_contact->m_url) {
+			contact_host = sip->sip_contact->m_url->url_host;
+		}
+
+		if (!switch_strlen_zero(contact_host)) {
+			for (x = 0 ; x < profile->nat_acl_count; x++) {
+				last_acl = profile->nat_acl[x];
+				if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
+					break;
+				}
+			}
+			
+			if (ok) {
+				is_nat = last_acl;
+			}
+		}
+	}
+	
 
 	if (profile->acl_count) {
 		uint32_t x = 0;
+		int ok = 1;
+		char *last_acl = NULL;
+
 		for (x = 0 ; x < profile->acl_count; x++) {
-			if (!switch_check_network_list_ip(network_ip, profile->acl[x])) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip,  profile->acl[x]);
+			last_acl = profile->acl[x];
+			if (!(ok = switch_check_network_list_ip(network_ip, last_acl))) {
+				break;
+			}
+		}
+
+		if (ok) {
+			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));
+				is_auth = 1;
+			}
+		} else {
+			if (!(profile->pflags & PFLAG_AUTH_CALLS)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip, switch_str_nil(last_acl));
 				nua_respond(nh, SIP_403_FORBIDDEN, TAG_END());
 				return;
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Rejected by acl %s. Falling back to Digest auth.\n", 
+								  network_ip, switch_str_nil(last_acl));
 			}
 		}
 	}
 
-
-	if ((profile->pflags & PFLAG_AUTH_CALLS) || (!(profile->pflags & PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization))) {
-		int rport = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
-		if (!strcmp(network_ip, profile->sipip) && rport == profile->sip_port) {
+	
+	if (!is_auth && 
+		((profile->pflags & PFLAG_AUTH_CALLS) || (!(profile->pflags & PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
+		if (!strcmp(network_ip, profile->sipip) && network_port == profile->sip_port) {
 			calling_myself++;
 		} else {
 			if (sofia_reg_handle_register(nua, profile, nh, sip, REG_INVITE, key, sizeof(key), &v_event)) {
 				if (v_event) {
 					switch_event_destroy(&v_event);
 				}
+				switch_safe_free(sticky);
 				return;
 			}
+			switch_safe_free(sticky);
 		}
 		is_auth++;
 	}
@@ -2706,11 +2763,26 @@
 	}
 	switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
 
+	tech_pvt->remote_ip = switch_core_session_strdup(session, network_ip);
+	tech_pvt->remote_port = network_port;
+
+	channel = tech_pvt->channel = switch_core_session_get_channel(session);
+
+	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);
+		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);
+	}
+
 	if (*key != '\0') {
 		tech_pvt->key = switch_core_session_strdup(session, key);
 	}
 
-	channel = tech_pvt->channel = switch_core_session_get_channel(session);
 	
 	if (is_auth) {
 		switch_channel_set_variable(channel, "sip_authorized", "true");
@@ -3119,6 +3191,12 @@
 			switch_assert(sql);
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 		}
+
+		if (is_nat) {
+			switch_set_flag(tech_pvt, TFLAG_NAT);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting NAT mode based on acl %s\n", is_nat);
+			switch_channel_set_variable(channel, "sip_nat_detected", "true");
+		}
 		
 		return;
 	}

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	Thu May 22 15:05:28 2008
@@ -868,6 +868,7 @@
 	uint32_t session_timeout = 0;
 	const char *val;
 	const char *rep;
+	char *sticky;
 
 	rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
 
@@ -1001,6 +1002,18 @@
 								  TAG_END());
 
 
+		if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+			(val = switch_channel_get_variable(channel, "sip-force-contact")) || 
+			((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
+			tech_pvt->record_route = switch_core_session_strdup(tech_pvt->session, url_str);
+			sticky = tech_pvt->record_route;
+			session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
+			switch_channel_set_variable(channel, "sip_nat_detected", "true");
+		}
+
+
+
+
 		/* TODO: We should use the new tags for making an rpid and add profile options to turn this on/off */
 		if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
 			priv = "name";
@@ -1091,6 +1104,7 @@
 		sofia_glue_tech_patch_sdp(tech_pvt);
 	}
 
+
 	nua_invite(tech_pvt->nh,
 			   NUTAG_AUTOANSWER(0),
 			   NUTAG_SESSION_TIMER(session_timeout),
@@ -1519,6 +1533,16 @@
 	if (tech_pvt->cng_pt) {
 		flags |= SWITCH_RTP_FLAG_AUTO_CNG;
 	}
+	
+	if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
+		const char *ip = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
+		const char *port = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
+
+		if (ip && port && !strcmp(ip, tech_pvt->adv_sdp_audio_ip) && atoi(port) == tech_pvt->remote_sdp_audio_port) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio params are unchanged.\n");
+			goto video;
+		}
+	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
 					  switch_channel_get_name(tech_pvt->channel),
@@ -1796,7 +1820,7 @@
 	}
 
 	if (((m = sdp->sdp_media)) && m->m_mode == sdp_sendonly) {
-		sendonly = 1;
+		sendonly = 2; /* global sendonly always wins */
 	}
 
 	for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
@@ -1806,7 +1830,7 @@
 
 		if ((!strcasecmp(attr->a_name, "sendonly")) || (!strcasecmp(attr->a_name, "inactive"))) {
 			sendonly = 1;
-		} else if (!strcasecmp(attr->a_name, "sendrecv")) {
+		} else if (sendonly < 2 && !strcasecmp(attr->a_name, "sendrecv")) {
 			sendonly = 0;
 		} else if (!strcasecmp(attr->a_name, "ptime")) {
 			dptime = atoi(attr->a_value);
@@ -1827,8 +1851,8 @@
 			if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
 				stream = tech_pvt->profile->hold_music;
 			}
-
-			if (stream && strcasecmp(stream, "silence")) {
+			
+			if (stream && switch_is_moh(stream)) {
 				if (!strcasecmp(stream, "indicate_hold")) {
 					switch_channel_set_flag(tech_pvt->channel, CF_SUSPEND);
 					switch_channel_set_flag(tech_pvt->channel, CF_HOLD);

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	Thu May 22 15:05:28 2008
@@ -806,7 +806,7 @@
 	}
 	
 	if (!(nh = nua_handle_by_call_id(profile->nua, call_id))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find handle for %s\n", call_id);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot find handle for %s\n", call_id);
 		return 0;
 	}
 

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	Thu May 22 15:05:28 2008
@@ -269,10 +269,10 @@
 		}   
     } else {
 #endif
-	if (!profile->master_db) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
-		return;
-	}
+		if (!profile->master_db) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
+			return;
+		}
 #ifdef SWITCH_HAVE_ODBC
     }
 #endif
@@ -401,9 +401,13 @@
 		switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", realm, uuid_str, stale ? " stale=\"true\"," : "");
 
 	if (regtype == REG_REGISTER) {
-		nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());
+		nua_respond(nh, 
+					SIP_401_UNAUTHORIZED, 
+					TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());
 	} else if (regtype == REG_INVITE) {
-		nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED, TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END());
+		nua_respond(nh, 
+					SIP_407_PROXY_AUTH_REQUIRED, 
+					TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END());
 	}
 
 	switch_safe_free(auth_str);
@@ -421,6 +425,7 @@
 	const char *to_user = NULL;
 	const char *to_host = NULL;
 	char contact_str[1024] = "";
+	int nat_hack = 0;
 	//char buf[512];
 	uint8_t stale = 0, forbidden = 0;
 	auth_res_t auth_res;
@@ -495,7 +500,8 @@
 		authorization = sip->sip_proxy_authorization;
 	}
 
-	if (regtype == REG_REGISTER && (profile->pflags & PFLAG_BLIND_REG)) {
+	if (regtype == REG_AUTO_REGISTER || (regtype == REG_REGISTER && (profile->pflags & PFLAG_BLIND_REG))) {
+		regtype = REG_REGISTER;
 		goto reg;
 	}
 
@@ -506,7 +512,7 @@
 			stale = 1;
 		}
 		
-		if (v_event && *v_event) {
+		if (exptime && v_event && *v_event) {
 			char *exp_var;
 
 			register_gateway = switch_event_get_header(*v_event, "sip-register-gateway");
@@ -524,7 +530,7 @@
 					!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>",
-								 display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params);
+										display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params);
 					} else {
 						switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>", display, contact->m_url->url_user, network_ip, network_port);
 					}
@@ -534,6 +540,7 @@
 						reg_desc = "Registered(NATHACK)";
 						exptime = 20;
 					}
+					nat_hack = 1;
 				} else {
 					char *p;
 					switch_copy_string(contact_str, v_contact_str, sizeof(contact_str));
@@ -556,9 +563,13 @@
 		if (auth_res != AUTH_OK && !stale) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "send %s for [%s@%s]\n", forbidden ? "forbidden" : "challange", to_user, to_host);
 			if (auth_res == AUTH_FORBIDDEN) {
-				nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
+				nua_respond(nh, 
+							SIP_403_FORBIDDEN, 
+							NUTAG_WITH_THIS(nua), TAG_END());
 			} else {
-				nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END());
+				nua_respond(nh, 
+							SIP_401_UNAUTHORIZED, 
+							NUTAG_WITH_THIS(nua), TAG_END());
 			}
 			return 1;
 		}
@@ -571,7 +582,7 @@
 		}
 		return 1;
 	}
-  reg:
+ reg:
 
 	if (regtype != REG_REGISTER) {
 		return 0;
@@ -580,7 +591,6 @@
 	call_id = sip->sip_call_id->i_id; //sip_header_as_string(profile->home, (void *) sip->sip_call_id);
 	switch_assert(call_id);
 
-	
 	if (exptime) {
 		const char *agent = "dunno";
 
@@ -681,17 +691,23 @@
 
 	
 	/*
-	if (call_id) {
-		su_free(profile->home, call_id);
-	}
+	  if (call_id) {
+	  su_free(profile->home, call_id);
+	  }
 	*/
 
 	if (regtype == REG_REGISTER) {
 		char *new_contact = NULL;
 
 		if (exptime) {
-			new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime);
-			nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
+			if (nat_hack) {
+				new_contact = switch_mprintf("%s;expires=%ld;received=\"%s:%d\"", contact_str, (long)exptime, network_ip, network_port);
+			} else {
+				new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime);
+			}
+			nua_respond(nh, 
+						SIP_200_OK, 
+						SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
 			switch_safe_free(new_contact);
 			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);
@@ -699,7 +715,20 @@
 				switch_event_fire(&event);
 			}
 		} else {
-			nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT(contact), NUTAG_WITH_THIS(nua), TAG_END());
+			nua_respond(nh, 
+						SIP_200_OK, 
+						SIPTAG_CONTACT(contact), NUTAG_WITH_THIS(nua), TAG_END());
+			
+			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);
+			}
 		}
 
 		return 1;
@@ -716,40 +745,58 @@
 	switch_event_t *v_event = NULL;
 	char network_ip[80];
 	su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
+	sofia_regtype_t type = REG_REGISTER;
+	int network_port = 0;
+
+	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);
 	
+
+	if (!(sip->sip_contact && sip->sip_contact->m_url)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n");
+		nua_respond(nh, 400, "Missing Contact Header", TAG_END());
+		goto end;
+	}
+
+	if (!(profile->mflags & MFLAG_REGISTER)) {
+		nua_respond(nh, 
+					SIP_403_FORBIDDEN, 
+					NUTAG_WITH_THIS(nua), TAG_END());
+		goto end;
+	}
+
 	if (profile->reg_acl_count) {
 		uint32_t x = 0;
+		int ok = 1;
+		char *last_acl = NULL;
 
-		get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
-		
 		for (x = 0 ; x < profile->reg_acl_count; x++) {
-			if (!switch_check_network_list_ip(network_ip, profile->reg_acl[x])) {
-				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;
+			last_acl = profile->reg_acl[x];
+			if (!(ok = switch_check_network_list_ip(network_ip, last_acl))) {
+				break;
 			}
 		}
-	}
-
-
-	if (!(profile->mflags & MFLAG_REGISTER)) {
-		nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
-		goto end;
+		
+		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());
+			goto end;
+		}
 	}
 	
 	if (!sip || !sip->sip_request || !sip->sip_request->rq_method_name) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received an invalid packet!\n");
-		nua_respond(nh, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
-		goto end;
-	}
-
-	if (!(sip->sip_contact && sip->sip_contact->m_url)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n");
-		nua_respond(nh, 400, "Missing Contact Header", TAG_END());
+		nua_respond(nh, 
+					SIP_500_INTERNAL_SERVER_ERROR, 
+					TAG_END());
 		goto end;
 	}
 
-	sofia_reg_handle_register(nua, profile, nh, sip, REG_REGISTER, key, sizeof(key), &v_event);
+	sofia_reg_handle_register(nua, profile, nh, sip, type, key, sizeof(key), &v_event);
 
 	if (v_event) {
 		switch_event_fire(&v_event);
@@ -763,8 +810,8 @@
 
 
 void sofia_reg_handle_sip_r_register(int status,
-						   char const *phrase,
-						   nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+									 char const *phrase,
+									 nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
 {
 	if (sofia_private && sofia_private->gateway) {
 		switch (status) {
@@ -866,7 +913,7 @@
 }
 
 auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr, 
-		char *np, size_t nplen, char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user)
+								char *np, size_t nplen, char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user)
 {
 	int indexnum;
 	const char *cur;
@@ -1177,7 +1224,7 @@
 			}
 		}
 	}
-  end:
+ end:
 
 	switch_event_destroy(&params);
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	Thu May 22 15:05:28 2008
@@ -466,7 +466,7 @@
 static switch_status_t wanpipe_on_hangup(switch_core_session_t *session);
 static switch_status_t wanpipe_on_exchange_media(switch_core_session_t *session);
 static switch_status_t wanpipe_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
 static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame,
 										switch_io_flag_t flags, int stream_id);
@@ -1006,7 +1006,7 @@
 	/*.on_soft_execute */ wanpipe_on_soft_execute
 };
 
-static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {
 	char *bchan = NULL;

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	Thu May 22 15:05:28 2008
@@ -173,7 +173,7 @@
 static switch_status_t woomera_on_routing(switch_core_session_t *session);
 static switch_status_t woomera_on_exchange_media(switch_core_session_t *session);
 static switch_status_t woomera_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
 static switch_status_t woomera_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -401,7 +401,7 @@
 /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
    that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
 */
-static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
 {

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	Thu May 22 15:05:28 2008
@@ -184,7 +184,7 @@
 				return NULL;
 			}
 
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Playing [%s] rate: %dhz\n", fname, source->rate);
+			//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Playing [%s] rate: %dhz\n", fname, source->rate);
 
 			while (RUNNING) {
 				switch_core_timer_next(&timer);

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	Thu May 22 15:05:28 2008
@@ -167,7 +167,7 @@
 		}
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening File [%s] rate %dhz\n", path, context->sfinfo.samplerate);
+	//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening File [%s] rate %dhz\n", path, context->sfinfo.samplerate);
 	handle->samples = (unsigned int) context->sfinfo.frames;
 	handle->samplerate = context->sfinfo.samplerate;
 	handle->channels = (uint8_t) context->sfinfo.channels;

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	Thu May 22 15:05:28 2008
@@ -121,6 +121,22 @@
     return new SWIGTYPE_p_switch_status_t(freeswitchJNI.CoreSession_process_callback_result(swigCPtr, this, ret), true);
   }
 
+  public void say(String tosay, String module_name, String say_type, String say_method) {
+    freeswitchJNI.CoreSession_say(swigCPtr, this, tosay, module_name, say_type, say_method);
+  }
+
+  public void sayPhrase(String phrase_name, String phrase_data, String phrase_lang) {
+    freeswitchJNI.CoreSession_sayPhrase__SWIG_0(swigCPtr, this, phrase_name, phrase_data, phrase_lang);
+  }
+
+  public void sayPhrase(String phrase_name, String phrase_data) {
+    freeswitchJNI.CoreSession_sayPhrase__SWIG_1(swigCPtr, this, phrase_name, phrase_data);
+  }
+
+  public void sayPhrase(String phrase_name) {
+    freeswitchJNI.CoreSession_sayPhrase__SWIG_2(swigCPtr, this, phrase_name);
+  }
+
   public int recordFile(String file_name, int max_len, int silence_threshold, int silence_secs) {
     return freeswitchJNI.CoreSession_recordFile__SWIG_0(swigCPtr, this, file_name, max_len, silence_threshold, silence_secs);
   }
@@ -210,7 +226,11 @@
   }
 
   public void execute(String app, String data) {
-    freeswitchJNI.CoreSession_execute(swigCPtr, this, app, data);
+    freeswitchJNI.CoreSession_execute__SWIG_0(swigCPtr, this, app, data);
+  }
+
+  public void execute(String app) {
+    freeswitchJNI.CoreSession_execute__SWIG_1(swigCPtr, this, app);
   }
 
   public void sendEvent(Event sendME) {

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	Thu May 22 15:05:28 2008
@@ -81,6 +81,10 @@
   public final static native long CoreSession_getPrivate(long jarg1, CoreSession jarg1_, String jarg2);
   public final static native String CoreSession_getVariable(long jarg1, CoreSession jarg1_, String jarg2);
   public final static native long CoreSession_process_callback_result(long jarg1, CoreSession jarg1_, String jarg2);
+  public final static native void CoreSession_say(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, String jarg4, String jarg5);
+  public final static native void CoreSession_sayPhrase__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, String jarg4);
+  public final static native void CoreSession_sayPhrase__SWIG_1(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
+  public final static native void CoreSession_sayPhrase__SWIG_2(long jarg1, CoreSession jarg1_, String jarg2);
   public final static native int CoreSession_recordFile__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2, int jarg3, int jarg4, int jarg5);
   public final static native int CoreSession_recordFile__SWIG_1(long jarg1, CoreSession jarg1_, String jarg2, int jarg3, int jarg4);
   public final static native int CoreSession_recordFile__SWIG_2(long jarg1, CoreSession jarg1_, String jarg2, int jarg3);
@@ -103,7 +107,8 @@
   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 void CoreSession_execute(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
+  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_);
   public final static native void CoreSession_setEventData(long jarg1, CoreSession jarg1_, long jarg2, Event jarg2_);
   public final static native String CoreSession_getXMLCDR(long jarg1, CoreSession jarg1_);

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	Thu May 22 15:05:28 2008
@@ -1475,6 +1475,120 @@
 }
 
 
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1say(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return ;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return ;
+  }
+  arg4 = 0;
+  if (jarg4) {
+    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
+    if (!arg4) return ;
+  }
+  arg5 = 0;
+  if (jarg5) {
+    arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0);
+    if (!arg5) return ;
+  }
+  (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
+  if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1sayPhrase_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return ;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return ;
+  }
+  arg4 = 0;
+  if (jarg4) {
+    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
+    if (!arg4) return ;
+  }
+  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1sayPhrase_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(CoreSession **)&jarg1; 
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return ;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return ;
+  }
+  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1sayPhrase_1_1SWIG_12(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 ;
+  }
+  (arg1)->sayPhrase((char const *)arg2);
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
 SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1recordFile_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jint jarg5) {
   jint jresult = 0 ;
   CoreSession *arg1 = (CoreSession *) 0 ;
@@ -2005,7 +2119,7 @@
 }
 
 
-SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1execute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+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 ;
   char *arg3 = (char *) 0 ;
@@ -2030,6 +2144,24 @@
 }
 
 
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1execute_1_1SWIG_11(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 ;
+  }
+  (arg1)->execute(arg2);
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
 SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1sendEvent(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
   CoreSession *arg1 = (CoreSession *) 0 ;
   Event *arg2 = (Event *) 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	Thu May 22 15:05:28 2008
@@ -11,7 +11,7 @@
 local_depend: $(LOCAL_OBJS)
 
 $(LIBLUA_A):
-	cd lua && $(MAKE) CFLAGS="$(ALL_CFLAGS) -DLUA_USE_LINUX -w" liblua.a
+	cd lua && $(MAKE) CC="$(CC)" CFLAGS="$(ALL_CFLAGS) -DLUA_USE_LINUX -w" liblua.a
 
 luaclean:
 	cd lua && $(MAKE) clean

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	Thu May 22 15:05:28 2008
@@ -3750,6 +3750,217 @@
 }
 
 
+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 ;
@@ -4696,7 +4907,7 @@
 }
 
 
-static int _wrap_CoreSession_execute(lua_State* L) {
+static int _wrap_CoreSession_execute__SWIG_0(lua_State* L) {
   int SWIG_arg = -1;
   CoreSession *arg1 = (CoreSession *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -4726,6 +4937,89 @@
 }
 
 
+static int _wrap_CoreSession_execute__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  SWIG_check_num_args("execute",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession);
+  }
+  
+  arg2 = (char *)lua_tostring(L, 2);
+  (arg1)->execute(arg2);
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_CoreSession_execute(lua_State* L) {
+  int argc;
+  int argv[4]={
+    1,2,3,4
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 2) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        return _wrap_CoreSession_execute__SWIG_1(L);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    {
+      void *ptr;
+      if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+        _v = 0;
+      } else {
+        _v = 1;
+      }
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          return _wrap_CoreSession_execute__SWIG_0(L);
+        }
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'CoreSession_execute'");
+  lua_error(L);return 0;
+}
+
+
 static int _wrap_CoreSession_sendEvent(lua_State* L) {
   int SWIG_arg = -1;
   CoreSession *arg1 = (CoreSession *) 0 ;
@@ -4993,6 +5287,8 @@
     {"getPrivate", _wrap_CoreSession_getPrivate}, 
     {"getVariable", _wrap_CoreSession_getVariable}, 
     {"process_callback_result", _wrap_CoreSession_process_callback_result}, 
+    {"say", _wrap_CoreSession_say}, 
+    {"sayPhrase", _wrap_CoreSession_sayPhrase}, 
     {"recordFile", _wrap_CoreSession_recordFile}, 
     {"setCallerData", _wrap_CoreSession_setCallerData}, 
     {"originate", _wrap_CoreSession_originate}, 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm	Thu May 22 15:05:28 2008
@@ -308,6 +308,8 @@
 *getPrivate = *freeswitchc::CoreSession_getPrivate;
 *getVariable = *freeswitchc::CoreSession_getVariable;
 *process_callback_result = *freeswitchc::CoreSession_process_callback_result;
+*say = *freeswitchc::CoreSession_say;
+*sayPhrase = *freeswitchc::CoreSession_sayPhrase;
 *recordFile = *freeswitchc::CoreSession_recordFile;
 *setCallerData = *freeswitchc::CoreSession_setCallerData;
 *originate = *freeswitchc::CoreSession_originate;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp	Thu May 22 15:05:28 2008
@@ -4700,6 +4700,357 @@
 }
 
 
+XS(_wrap_CoreSession_say) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
+    char *arg5 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int res5 ;
+    char *buf5 = 0 ;
+    int alloc5 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: CoreSession_say(self,tosay,module_name,say_type,say_method);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
+    if (!SWIG_IsOK(res5)) {
+      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5"" of type '" "char const *""'");
+    }
+    arg5 = reinterpret_cast< char * >(buf5);
+    (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoreSession_sayPhrase__SWIG_0) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data,phrase_lang);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoreSession_sayPhrase__SWIG_1) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoreSession_sayPhrase__SWIG_2) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    (arg1)->sayPhrase((char const *)arg2);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoreSession_sayPhrase) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+    if (items == 4) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 3;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_3:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_2); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_1); return;
+    case 3:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'CoreSession_sayPhrase'");
+  XSRETURN(0);
+}
+
+
 XS(_wrap_CoreSession_recordFile__SWIG_0) {
   {
     CoreSession *arg1 = (CoreSession *) 0 ;
@@ -6196,7 +6547,7 @@
 }
 
 
-XS(_wrap_CoreSession_execute) {
+XS(_wrap_CoreSession_execute__SWIG_0) {
   {
     CoreSession *arg1 = (CoreSession *) 0 ;
     char *arg2 = (char *) 0 ;
@@ -6245,6 +6596,130 @@
 }
 
 
+XS(_wrap_CoreSession_execute__SWIG_1) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_execute(self,app);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    (arg1)->execute(arg2);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoreSession_execute) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'CoreSession_execute'");
+  XSRETURN(0);
+}
+
+
 XS(_wrap_CoreSession_sendEvent) {
   {
     CoreSession *arg1 = (CoreSession *) 0 ;
@@ -7796,6 +8271,8 @@
 {"freeswitchc::CoreSession_getPrivate", _wrap_CoreSession_getPrivate},
 {"freeswitchc::CoreSession_getVariable", _wrap_CoreSession_getVariable},
 {"freeswitchc::CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result},
+{"freeswitchc::CoreSession_say", _wrap_CoreSession_say},
+{"freeswitchc::CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase},
 {"freeswitchc::CoreSession_recordFile", _wrap_CoreSession_recordFile},
 {"freeswitchc::CoreSession_setCallerData", _wrap_CoreSession_setCallerData},
 {"freeswitchc::CoreSession_originate", _wrap_CoreSession_originate},

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/Makefile.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/Makefile.in	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/Makefile.in	Thu May 22 15:05:28 2008
@@ -4,10 +4,12 @@
 # and define these variables to impact your build
 
 LOCAL_CFLAGS = @PYTHON_CFLAGS@
-LOCAL_LDFLAGS= @PYTHON_LDFLAGS@ -lstdc++
+LOCAL_LDFLAGS= @PYTHON_LDFLAGS@
 LOCAL_OBJS=freeswitch_python.o mod_python_wrap.o
 include ../../../../build/modmake.rules
 
+LINK=$(CXXLINK)
+
 PYMOD=freeswitch
 PYTHON_SITE_DIR=@PYTHON_SITE_DIR@
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch.py	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch.py	Thu May 22 15:05:28 2008
@@ -199,6 +199,8 @@
     def getPrivate(*args): return _freeswitch.CoreSession_getPrivate(*args)
     def getVariable(*args): return _freeswitch.CoreSession_getVariable(*args)
     def process_callback_result(*args): return _freeswitch.CoreSession_process_callback_result(*args)
+    def say(*args): return _freeswitch.CoreSession_say(*args)
+    def sayPhrase(*args): return _freeswitch.CoreSession_sayPhrase(*args)
     def recordFile(*args): return _freeswitch.CoreSession_recordFile(*args)
     def setCallerData(*args): return _freeswitch.CoreSession_setCallerData(*args)
     def originate(*args): return _freeswitch.CoreSession_originate(*args)

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp	Thu May 22 15:05:28 2008
@@ -5289,6 +5289,282 @@
 }
 
 
+SWIGINTERN PyObject *_wrap_CoreSession_say(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  int res5 ;
+  char *buf5 = 0 ;
+  int alloc5 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  PyObject * obj4 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOOO:CoreSession_say",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4"" of type '" "char const *""'");
+  }
+  arg4 = reinterpret_cast< char * >(buf4);
+  res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
+  if (!SWIG_IsOK(res5)) {
+    SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5"" of type '" "char const *""'");
+  }
+  arg5 = reinterpret_cast< char * >(buf5);
+  (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_sayPhrase",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4"" of type '" "char const *""'");
+  }
+  arg4 = reinterpret_cast< char * >(buf4);
+  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_sayPhrase",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_sayPhrase",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  (arg1)->sayPhrase((char const *)arg2);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[5];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_CoreSession_sayPhrase__SWIG_2(self, args);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          return _wrap_CoreSession_sayPhrase__SWIG_1(self, args);
+        }
+      }
+    }
+  }
+  if (argc == 4) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
+          _v = SWIG_CheckState(res);
+          if (_v) {
+            return _wrap_CoreSession_sayPhrase__SWIG_0(self, args);
+          }
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_sayPhrase'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    sayPhrase(CoreSession *,char const *,char const *,char const *)\n"
+    "    sayPhrase(CoreSession *,char const *,char const *)\n"
+    "    sayPhrase(CoreSession *,char const *)\n");
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CoreSession *arg1 = (CoreSession *) 0 ;
@@ -6484,7 +6760,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CoreSession *arg1 = (CoreSession *) 0 ;
   char *arg2 = (char *) 0 ;
@@ -6529,6 +6805,89 @@
 }
 
 
+SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_execute",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'"); 
+  }
+  arg1 = reinterpret_cast< CoreSession * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  (arg1)->execute(arg2);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[4];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_CoreSession_execute__SWIG_1(self, args);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          return _wrap_CoreSession_execute__SWIG_0(self, args);
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_execute'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    execute(CoreSession *,char *,char *)\n"
+    "    execute(CoreSession *,char *)\n");
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_CoreSession_sendEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   CoreSession *arg1 = (CoreSession *) 0 ;
@@ -7358,6 +7717,8 @@
 	 { (char *)"CoreSession_getPrivate", _wrap_CoreSession_getPrivate, METH_VARARGS, NULL},
 	 { (char *)"CoreSession_getVariable", _wrap_CoreSession_getVariable, METH_VARARGS, NULL},
 	 { (char *)"CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_say", _wrap_CoreSession_say, METH_VARARGS, NULL},
+	 { (char *)"CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase, METH_VARARGS, NULL},
 	 { (char *)"CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL},
 	 { (char *)"CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
 	 { (char *)"CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	Thu May 22 15:05:28 2008
@@ -43,6 +43,8 @@
 	char *cred;
 	int disable100continue;
 	uint32_t ignore_cacert_check;
+	switch_hash_t* vars_map;
+	switch_memory_pool_t* vars_map_pool;
 };
 
 static int keep_files_around = 0;
@@ -110,7 +112,7 @@
 	struct curl_slist *headers = NULL;
 	char hostname[256] = "";
 	char basic_data[512];
-	
+
 	gethostname(hostname, sizeof(hostname));
 
 	if (!binding) {
@@ -134,7 +136,7 @@
 					switch_str_nil(key_name),
 					switch_str_nil(key_value));
 
-	data = switch_event_build_param_string(params, basic_data);
+	data = switch_event_build_param_string(params, basic_data,binding->vars_map);
 	switch_assert(data);
 
 	switch_uuid_get(&uuid);
@@ -204,14 +206,17 @@
 
 	return xml;
 }
-
+#define ENABLE_PARAM_VALUE "enabled"
 static switch_status_t do_config(void)
 {
 	char *cf = "xml_curl.conf";
 	switch_xml_t cfg, xml, bindings_tag, binding_tag, param;
 	xml_binding_t *binding = NULL;
 	int x = 0;
-
+	int need_vars_map = 0;
+	switch_hash_t* vars_map = NULL;
+	switch_memory_pool_t* vars_map_pool = NULL;
+	
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
 		return SWITCH_STATUS_TERM;
@@ -244,7 +249,29 @@
 				disable100continue = 1;
 			} else if (!strcasecmp(var, "ignore-cacert-check") && switch_true(val)) {
 				ignore_cacert_check = 1;
-			}
+			} else if(!strcasecmp(var, "enable-post-var")) {
+				if (!vars_map && need_vars_map == 0) {
+				    if (switch_core_new_memory_pool(&vars_map_pool) != SWITCH_STATUS_SUCCESS) {
+					need_vars_map = -1;
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant create memory pool!\n");
+					continue;
+				    }
+	
+				    if (switch_core_hash_init(&vars_map,vars_map_pool) != SWITCH_STATUS_SUCCESS) {
+					need_vars_map = -1;
+					switch_core_destroy_memory_pool(&vars_map_pool);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant init params hash!\n");
+					continue;
+				    }
+				    need_vars_map = 1;
+				}
+				
+				if (vars_map && val)
+				    if (switch_core_hash_insert(vars_map, val, ENABLE_PARAM_VALUE) != SWITCH_STATUS_SUCCESS) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant add %s to params hash!\n",val);
+				    }
+				
+		        }	
 		}
 
 		if (!url) {
@@ -269,6 +296,9 @@
 
 		binding->disable100continue = disable100continue;
 		binding->ignore_cacert_check = ignore_cacert_check;
+		
+		binding->vars_map = vars_map;
+		binding->vars_map_pool = vars_map_pool;
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
 						  switch_strlen_zero(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all");

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c	Thu May 22 15:05:28 2008
@@ -404,6 +404,10 @@
 			x++;
 			if (argv[x] && strlen(argv[x])) {
 				SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(argv[x]) + 1);
+				if (!SWITCH_GLOBAL_dirs.conf_dir) {
+					fprintf(stderr, "Allocation error\n");
+					return 255;
+				}
 				strcpy(SWITCH_GLOBAL_dirs.conf_dir, argv[x]);
 				alt_dirs++;
 			} else {
@@ -417,6 +421,10 @@
 			x++;
 			if (argv[x] && strlen(argv[x])) {
 				SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(argv[x]) + 1);
+				if (!SWITCH_GLOBAL_dirs.log_dir) {
+					fprintf(stderr, "Allocation error\n");
+					return 255;
+				}
 				strcpy(SWITCH_GLOBAL_dirs.log_dir, argv[x]);
 				alt_dirs++;
 			} else {
@@ -430,6 +438,10 @@
 			x++;
 			if (argv[x] && strlen(argv[x])) {
 				SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(argv[x]) + 1);
+				if (!SWITCH_GLOBAL_dirs.db_dir) {
+					fprintf(stderr, "Allocation error\n");
+					return 255;
+				}
 				strcpy(SWITCH_GLOBAL_dirs.db_dir, argv[x]);
 				alt_dirs++;
 			} else {
@@ -443,6 +455,10 @@
 			x++;
 			if (argv[x] && strlen(argv[x])) {
 				SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(argv[x]) + 1);
+				if (!SWITCH_GLOBAL_dirs.script_dir) {
+					fprintf(stderr, "Allocation error\n");
+					return 255;
+				}
 				strcpy(SWITCH_GLOBAL_dirs.script_dir, argv[x]);
 			} else {
 				fprintf(stderr, "When using -scripts you must specify a scripts directory\n");

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c	Thu May 22 15:05:28 2008
@@ -130,7 +130,7 @@
 	uint8_t x;
 	const char *str = "UNKNOWN";
 
-	for (x = 0; CAUSE_CHART[x].name; x++) {
+	for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) ; x++) {
 		if (CAUSE_CHART[x].cause == cause) {
 			str = CAUSE_CHART[x].name;
 		}
@@ -147,7 +147,7 @@
 	if (*str > 47 && *str < 58) {
 		cause = atoi(str);
 	} else {
-		for (x = 0; CAUSE_CHART[x].name; x++) {
+		for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) && CAUSE_CHART[x].name; x++) {
 			if (!strcasecmp(CAUSE_CHART[x].name, str)) {
 				cause = CAUSE_CHART[x].cause;
 			}
@@ -585,7 +585,7 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(int) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags)
+SWITCH_DECLARE(uint32_t) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags)
 {
 	switch_assert(channel != NULL);
 	return switch_test_flag(channel, flags) ? 1 : 0;
@@ -776,6 +776,8 @@
 		channel->state_flags = 0;
 	}
 
+	switch_clear_flag(channel, CF_TAGGED);
+
 	if (channel->state >= CS_ROUTING) {
 		switch_clear_flag(channel, CF_TRANSFER);
 		switch_channel_presence(channel, "unknown", (char *) state_names[state]);
@@ -1270,10 +1272,9 @@
 	int index, i = channel->state_handler_index;
 	const switch_state_handler_table_t *new_handlers[SWITCH_MAX_STATE_HANDLERS] = { 0 };
 
+	switch_assert(channel != NULL);
 
 	switch_mutex_lock(channel->flag_mutex);
-
-	switch_assert(channel != NULL);
 	channel->state_handler_index = 0;
 
 	if (state_handler) {

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c	Thu May 22 15:05:28 2008
@@ -66,7 +66,7 @@
 			}
 
 			cfg->file = f;
-			cfg->path = path;
+			switch_set_string(cfg->path, path);
 
 			while (switch_config_next_pair(cfg, &var, &val)) {
 				if (file_path && (cfg->sectno != last) && !strcmp(cfg->section, file_path)) {
@@ -83,7 +83,7 @@
 		return 0;
 	} else {
 		cfg->file = f;
-		cfg->path = path;
+		switch_set_string(cfg->path, path);
 		return 1;
 	}
 }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c	Thu May 22 15:05:28 2008
@@ -824,7 +824,7 @@
 		for (x = 0; x < (sizeof(cmd) - 1); x++) {
 			int c = getchar();
 			if (c < 0) {
-				int y = read(fileno(stdin), cmd, sizeof(cmd));
+				int y = read(fileno(stdin), cmd, sizeof(cmd) - 1);
 				cmd[y - 1] = '\0';
 				break;
 			}

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c	Thu May 22 15:05:28 2008
@@ -369,6 +369,16 @@
 							  runtime.memory_pool);
 	switch_safe_free(dir_path);
 
+	switch_assert(SWITCH_GLOBAL_dirs.base_dir);
+	switch_assert(SWITCH_GLOBAL_dirs.mod_dir);
+	switch_assert(SWITCH_GLOBAL_dirs.conf_dir);
+	switch_assert(SWITCH_GLOBAL_dirs.log_dir);
+	switch_assert(SWITCH_GLOBAL_dirs.db_dir);
+	switch_assert(SWITCH_GLOBAL_dirs.script_dir);
+	switch_assert(SWITCH_GLOBAL_dirs.htdocs_dir);
+	switch_assert(SWITCH_GLOBAL_dirs.grammar_dir);
+	switch_assert(SWITCH_GLOBAL_dirs.temp_dir);
+
 	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.base_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
 	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.mod_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
 	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.conf_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
@@ -571,12 +581,14 @@
 
 SWITCH_DECLARE(switch_status_t) switch_core_mime_add_type(const char *type, const char *ext)
 {
-	const char *check = (const char *) switch_core_hash_find(runtime.mime_types, ext);
+	const char *check;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
 	switch_assert(type);
 	switch_assert(ext);
 
+	check = (const char *) switch_core_hash_find(runtime.mime_types, ext);
+
 	if (!check) {
 		char *ptype = switch_core_permanent_strdup(type);
 		char *ext_list = strdup(ext);

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c	Thu May 22 15:05:28 2008
@@ -96,6 +96,10 @@
 
 	if (errmsg) {
 		*errmsg = err;
+	} else if (err) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR [%s]\n", err);
+		switch_core_db_free(err);
+		err = NULL;
 	}
 
 	return ret;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c	Thu May 22 15:05:28 2008
@@ -61,6 +61,8 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_io_event_hook_video_read_frame_t *ptr;
 
+	switch_assert(session != NULL);
+
 	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -84,7 +86,6 @@
 		goto done;
 	}
 
-	switch_assert(session != NULL);
 	switch_assert(*frame != NULL);
 
 	if (switch_test_flag(*frame, SFF_CNG)) {
@@ -104,7 +105,9 @@
 	int need_codec, perfect, do_bugs = 0, do_resample = 0, is_cng = 0;
 	unsigned int flag = 0;
 
-  top:
+	switch_assert(session != NULL);
+
+top:
 
 	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
 		*frame = NULL;
@@ -115,7 +118,6 @@
 	status = SWITCH_STATUS_FALSE;
 	need_codec = perfect = 0;
 
-	switch_assert(session != NULL);
 	*frame = NULL;
 
 	if (switch_channel_test_flag(session->channel, CF_HOLD)) {
@@ -142,7 +144,6 @@
 		goto done;
 	}
 
-	switch_assert(session != NULL);
 	switch_assert(*frame != NULL);
 
 	if (switch_test_flag(*frame, SFF_PROXY_PACKET)) {
@@ -192,6 +193,14 @@
 	if (status == SWITCH_STATUS_SUCCESS && need_codec) {
 		switch_frame_t *enc_frame, *read_frame = *frame;
 
+		if (!switch_test_flag(session, SSF_WARN_TRANSCODE)) {
+			switch_core_session_message_t msg = { 0 };
+			
+			msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
+			switch_core_session_receive_message(session, &msg);
+			switch_set_flag(session, SSF_WARN_TRANSCODE);
+		}
+		
 		if (read_frame->codec || is_cng) {
 			session->raw_read_frame.datalen = session->raw_read_frame.buflen;
 			
@@ -558,6 +567,14 @@
 	}
 
 	if (need_codec) {
+		if (!switch_test_flag(session, SSF_WARN_TRANSCODE)) {
+			switch_core_session_message_t msg = { 0 };
+			
+			msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
+			switch_core_session_receive_message(session, &msg);
+			switch_set_flag(session, SSF_WARN_TRANSCODE);
+		}
+
 		if (frame->codec) {
 			session->raw_write_frame.datalen = session->raw_write_frame.buflen;
 			status = switch_core_codec_decode(frame->codec,
@@ -945,7 +962,7 @@
 	}
 
 	for (ptr = session->event_hooks.recv_dtmf; ptr; ptr = ptr->next) {
-		if ((status = ptr->recv_dtmf(session, &new_dtmf)) != SWITCH_STATUS_SUCCESS) {
+		if ((status = ptr->recv_dtmf(session, &new_dtmf, SWITCH_DTMF_RECV)) != SWITCH_STATUS_SUCCESS) {
 			return status;
 		}
 	}
@@ -976,7 +993,7 @@
 
 
 	for (ptr = session->event_hooks.send_dtmf; ptr; ptr = ptr->next) {
-		if ((status = ptr->send_dtmf(session, dtmf)) != SWITCH_STATUS_SUCCESS) {
+		if ((status = ptr->send_dtmf(session, dtmf, SWITCH_DTMF_SEND)) != SWITCH_STATUS_SUCCESS) {
 			return SWITCH_STATUS_SUCCESS;
 		}
 	}

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c	Thu May 22 15:05:28 2008
@@ -188,12 +188,12 @@
 	return endpoint_interface->io_routines->resurrect_session(new_session, pool, data);
 }
 
-SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_core_session_t *session,
-																		 const char *endpoint_name,
-																		 switch_caller_profile_t *caller_profile,
-																		 switch_core_session_t **new_session, 
-																		 switch_memory_pool_t **pool,
-																		 switch_originate_flag_t flags)
+ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
+																		  const char *endpoint_name,
+																		  switch_caller_profile_t *caller_profile,
+																		  switch_core_session_t **new_session, 
+																		  switch_memory_pool_t **pool,
+																		  switch_originate_flag_t flags)
 {
 	switch_io_event_hook_outgoing_channel_t *ptr;
 	switch_status_t status = SWITCH_STATUS_FALSE;
@@ -217,6 +217,8 @@
 	if (session) {
 		channel = switch_core_session_get_channel(session);
 
+		switch_assert(channel != NULL);
+		
 		forwardvar = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
 		if (!switch_strlen_zero(forwardvar)) {
 			forwardval =  atoi(forwardvar) - 1;
@@ -247,13 +249,13 @@
 		}
 	}
 
-	if ((cause = endpoint_interface->io_routines->outgoing_channel(session, outgoing_profile, new_session, pool, flags)) != SWITCH_CAUSE_SUCCESS) {
+	if ((cause = endpoint_interface->io_routines->outgoing_channel(session, var_event, outgoing_profile, new_session, pool, flags)) != SWITCH_CAUSE_SUCCESS) {
 		return cause;
 	}
 
 	if (session) {
 		for (ptr = session->event_hooks.outgoing_channel; ptr; ptr = ptr->next) {
-			if ((status = ptr->outgoing_channel(session, caller_profile, *new_session, flags)) != SWITCH_STATUS_SUCCESS) {
+			if ((status = ptr->outgoing_channel(session, var_event, caller_profile, *new_session, flags)) != SWITCH_STATUS_SUCCESS) {
 				break;
 			}
 		}
@@ -267,20 +269,20 @@
 		switch_caller_profile_t *profile = NULL, *peer_profile = NULL, *cloned_profile = NULL;
 		switch_event_t *event;
 		switch_channel_t *peer_channel = switch_core_session_get_channel(*new_session);
+		
+		switch_assert(peer_channel);
+		
+		peer_profile = switch_channel_get_caller_profile(peer_channel);
 
-		if (session && channel) {
-			profile = switch_channel_get_caller_profile(channel);
-		}
-		if (peer_channel) {
-			peer_profile = switch_channel_get_caller_profile(peer_channel);
-		}
-
-		if (channel && peer_channel) {
+		if (channel) {
 			const char *export_vars, *val;
 			switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
 			const char *max_forwards = switch_core_session_sprintf(session, "%d", forwardval);
+
 			switch_channel_set_variable(peer_channel, SWITCH_MAX_FORWARDS_VARIABLE, max_forwards);
 
+			profile = switch_channel_get_caller_profile(channel);
+
 			if (read_codec) {
 				char tmp[80];
 				switch_codec2str(read_codec, tmp, sizeof(tmp));
@@ -336,7 +338,7 @@
 			}
 			
 			if (peer_profile) {
-				if (session && (cloned_profile = switch_caller_profile_clone(session, peer_profile)) != 0) {
+				if ((cloned_profile = switch_caller_profile_clone(session, peer_profile)) != 0) {
 					switch_channel_set_originatee_caller_profile(channel, cloned_profile);
 				}
 			}
@@ -571,7 +573,9 @@
 
 SWITCH_DECLARE(uint32_t) switch_core_session_private_event_count(switch_core_session_t *session)
 {
-	if (session->private_event_queue) {
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+
+	if (!switch_channel_test_flag(channel, CF_EVENT_LOCK) && session->private_event_queue) {
 		return switch_queue_size(session->private_event_queue);
 	}
 	
@@ -634,6 +638,7 @@
 		}
 	}
 
+	switch_clear_flag(session, SSF_WARN_TRANSCODE);
 	switch_ivr_deactivate_unicast(session);
 	switch_channel_clear_flag(channel, CF_BREAK);
 }
@@ -1095,7 +1100,10 @@
 			if ((dparg = strchr(dpname, ':'))) {
 				*dparg++ = '\0';
 			}
+		} else {
+			continue;
 		}
+
 		if (!(dialplan_interface = switch_loadable_module_get_dialplan_interface(dpname))) {
 			continue;
 		}

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c	Thu May 22 15:05:28 2008
@@ -71,9 +71,10 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL Retry [%s]\n", errmsg);
 			}
 			switch_core_db_free(errmsg);
+			errmsg = NULL;
 
 			if (again) {
-				switch_core_db_exec(db, "end transaction", NULL, NULL, &errmsg);
+				switch_core_db_exec(db, "end transaction", NULL, NULL, NULL);
 				goto again;
 			}
 
@@ -93,6 +94,7 @@
 		if (errmsg) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR [%s]\n", errmsg);
 			switch_core_db_free(errmsg);
+			errmsg = NULL;
 			switch_yield(100000);
 			retries--;
 			if (retries == 0 && forever) {
@@ -107,7 +109,7 @@
 
   done:
 
-	switch_core_db_exec(db, "end transaction", NULL, NULL, &errmsg);
+	switch_core_db_exec(db, "end transaction", NULL, NULL, NULL);
 
 	return status;
 }
@@ -234,6 +236,8 @@
 {
 	char *sql = NULL;
 
+	switch_assert(event);
+
 	switch (event->event_id) {
 	case SWITCH_EVENT_ADD_SCHEDULE:
 		sql = switch_mprintf("insert into tasks values('%q','%q','%q','%q')",
@@ -282,10 +286,14 @@
 			);
 		break;
 	case SWITCH_EVENT_CHANNEL_STATE:
-		if (event) {
+		{
 			char *state = switch_event_get_header_nil(event, "channel-state-number");
-			switch_channel_state_t state_i = atoi(state);
+			switch_channel_state_t state_i = CS_DONE;
 
+			if (!switch_strlen_zero(state)) {
+				state_i = atoi(state);
+			}
+		
 			switch (state_i) {
 			case CS_HANGUP:
 			case CS_DONE:
@@ -300,18 +308,15 @@
 									 switch_event_get_header_nil(event, "caller-destination-number"), 
 									 switch_event_get_header_nil(event, "caller-dialplan"), 
 									 switch_event_get_header_nil(event, "caller-context"), 
-									 switch_event_get_header_nil(event, "unique-id")
-					);
+									 switch_event_get_header_nil(event, "unique-id"));
 				break;
 			default:
 				sql = switch_mprintf("update channels set state='%s' where uuid='%s'",
-									 switch_event_get_header_nil(event, "channel-state"), switch_event_get_header_nil(event, "unique-id")
-					);
+									 switch_event_get_header_nil(event, "channel-state"), switch_event_get_header_nil(event, "unique-id"));
 				break;
 			}
-
+			break;
 		}
-		break;
 	case SWITCH_EVENT_CHANNEL_BRIDGE:
 		sql = switch_mprintf("insert into calls values ('%s', '%ld', '%s','%q','%q','%q','%q','%s','%q','%q','%q','%q','%s')",
 							 switch_event_get_header_nil(event, "event-date-local"),

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c	Thu May 22 15:05:28 2008
@@ -84,6 +84,8 @@
 						if ((dparg = strchr(dpname, ':'))) {
 							*dparg++ = '\0';
 						}
+					} else {
+						continue;
 					}
 					if (!(dialplan_interface = switch_loadable_module_get_dialplan_interface(dpname))) {
 						continue;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp	Thu May 22 15:05:28 2008
@@ -77,6 +77,8 @@
 {
 	switch_ivr_action_t ivr_action = SWITCH_IVR_ACTION_NOOP;
 
+	this_check_void();
+	
 	if (switch_ivr_menu_str2action(action, &ivr_action) == SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bind %s to %s(%s)\n", bind, action, arg);
 		switch_ivr_menu_bind_action(menu, ivr_action, arg, bind);
@@ -87,6 +89,7 @@
 
 SWITCH_DECLARE(void) IVRMenu::execute(CoreSession *session, const char *name)
 {
+	this_check_void();
 	switch_ivr_menu_execute(session->session, menu, (char *)name, NULL);
 }
 
@@ -104,6 +107,7 @@
 SWITCH_DECLARE(char *) API::execute(const char *cmd, const char *arg)
 {
 	switch_stream_handle_t stream = { 0 };
+	this_check("");
 	SWITCH_STANDARD_STREAM(stream);
 	switch_api_execute(cmd, arg, NULL, &stream);
 	last_data = (char *) stream.data;
@@ -118,6 +122,8 @@
 
 	switch_assert(mycmd);
 
+	this_check("");
+
 	if ((arg = strchr(mycmd, ' '))) {
 		*arg++ = '\0';
 	}
@@ -168,6 +174,8 @@
 {
 	int isxml = 0;
 
+	this_check("");
+
 	if (serialized_string) {
 		free(serialized_string);
 	}
@@ -201,6 +209,9 @@
 
 SWITCH_DECLARE(bool) Event::fire(void)
 {
+
+	this_check(false);
+
 	if (!mine) {
 		switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Not My event!\n");
 		return false;
@@ -218,6 +229,8 @@
 
 SWITCH_DECLARE(bool) Event::setPriority(switch_priority_t priority)
 {
+	this_check(false);
+
 	if (event) {
         switch_event_set_priority(event, priority);
 		return true;
@@ -227,6 +240,8 @@
 
 SWITCH_DECLARE(char *)Event::getHeader(char *header_name)
 {
+	this_check("");
+
 	if (event) {
 		return switch_event_get_header(event, header_name);
 	}
@@ -235,6 +250,8 @@
 
 SWITCH_DECLARE(bool) Event::addHeader(const char *header_name, const char *value)
 {
+	this_check(false);
+
 	if (event) {
 		return switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, value) == SWITCH_STATUS_SUCCESS ? true : false;
 	}
@@ -244,6 +261,8 @@
 
 SWITCH_DECLARE(bool) Event::delHeader(const char *header_name)
 {
+	this_check(false);
+
 	if (event) {
 		return switch_event_del_header(event, header_name) == SWITCH_STATUS_SUCCESS ? true : false;
 	}
@@ -254,6 +273,8 @@
 
 SWITCH_DECLARE(bool) Event::addBody(const char *value)
 {
+	this_check(false);
+
 	if (event) {
 		return switch_event_add_body(event, "%s", value) == SWITCH_STATUS_SUCCESS ? true : false;
 	}
@@ -263,6 +284,9 @@
 
 SWITCH_DECLARE(char *)Event::getBody(void)
 {
+	
+	this_check((char *)"");
+
 	if (event) {
 		return switch_event_get_body(event);
 	}
@@ -272,6 +296,8 @@
 
 SWITCH_DECLARE(const char *)Event::getType(void)
 {
+	this_check("");
+
 	if (event) {
 		return switch_event_name(event->event_id);
 	}
@@ -302,11 +328,14 @@
 
 SWITCH_DECLARE(void) Stream::write(const char *data)
 {
+	this_check_void();
 	stream_p->write_function(stream_p, "%s", data);
 }
 
 SWITCH_DECLARE(const char *)Stream::get_data()
 {
+	this_check("");
+
 	return stream_p ? (const char *)stream_p->data : NULL;
 }
 
@@ -392,7 +421,8 @@
 {
 	
 	switch_xml_t cdr;
-	
+
+	this_check((char *)"");
 	sanity_check((char *)"");
 
 	switch_safe_free(xml_cdr_text);
@@ -407,6 +437,7 @@
 
 SWITCH_DECLARE(void) CoreSession::setEventData(Event *e)
 {
+	this_check_void();
 	sanity_check_noreturn;
 	
 	if (channel && e->event) {
@@ -417,7 +448,7 @@
 SWITCH_DECLARE(int) CoreSession::answer()
 {
     switch_status_t status;
-
+	this_check(-1);
 	sanity_check(-1);
     status = switch_channel_answer(channel);
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
@@ -426,6 +457,7 @@
 SWITCH_DECLARE(int) CoreSession::preAnswer()
 {
     switch_status_t status;
+	this_check(-1);
 	sanity_check(-1);
     status = switch_channel_pre_answer(channel);
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
@@ -433,8 +465,9 @@
 
 SWITCH_DECLARE(void) CoreSession::hangup(char *cause)
 {
+	this_check_void();
+	sanity_check_noreturn;	
     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::hangup\n");
-	sanity_check_noreturn;
 	this->begin_allow_threads();
     switch_channel_hangup(channel, switch_channel_str2cause(cause));
 	this->end_allow_threads();
@@ -442,31 +475,36 @@
 
 SWITCH_DECLARE(void) CoreSession::setPrivate(char *var, void *val)
 {
+	this_check_void();
 	sanity_check_noreturn;
     switch_channel_set_private(channel, var, val);
 }
 
 SWITCH_DECLARE(void *)CoreSession::getPrivate(char *var)
 {
+	this_check(NULL);
 	sanity_check(NULL);
     return switch_channel_get_private(channel, var);
 }
 
 SWITCH_DECLARE(void) CoreSession::setVariable(char *var, char *val)
 {
+	this_check_void();
 	sanity_check_noreturn;
     switch_channel_set_variable(channel, var, val);
 }
 
 SWITCH_DECLARE(const char *)CoreSession::getVariable(char *var)
 {
-	sanity_check(NULL);
+	this_check("");
+	sanity_check("");
     return switch_channel_get_variable(channel, var);
 }
 
 SWITCH_DECLARE(void) CoreSession::execute(char *app, char *data)
 {
 	const switch_application_interface_t *application_interface;
+	this_check_void();
 	sanity_check_noreturn;
 
     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::execute.  app: %s data:%s\n", app, data);
@@ -479,6 +517,7 @@
 
 SWITCH_DECLARE(void) CoreSession::setDTMFCallback(void *cbfunc, char *funcargs) {
 
+	this_check_void();
 	sanity_check_noreturn;
 
 	cb_state.funcargs = funcargs;
@@ -501,6 +540,9 @@
 
 SWITCH_DECLARE(void) CoreSession::sendEvent(Event *sendME)
 {
+	this_check_void();
+	sanity_check_noreturn;
+
 	if (sendME->event) {
 		switch_event_t *new_event;
 		if (switch_event_dup(&new_event, sendME->event) == SWITCH_STATUS_SUCCESS) {
@@ -513,6 +555,7 @@
 {
     switch_status_t status;
 
+	this_check(-1);
 	sanity_check(-1);
 
 	// create and store an empty filehandle in callback args 
@@ -539,6 +582,7 @@
 
 SWITCH_DECLARE(void) CoreSession::set_tts_parms(char *tts_name_p, char *voice_name_p)
 {
+	this_check_void();
 	sanity_check_noreturn;
 	switch_safe_free(tts_name);
 	switch_safe_free(voice_name);
@@ -549,6 +593,7 @@
 
 
 SWITCH_DECLARE(int) CoreSession::collectDigits(int timeout) {
+	this_check(-1);
 	sanity_check(-1);
     begin_allow_threads();
 	switch_ivr_collect_digits_callback(session, ap, timeout);
@@ -561,6 +606,7 @@
 											  int timeout)
 {
     switch_status_t status;
+	this_check((char *)"");
 	sanity_check((char *)"");
 	begin_allow_threads();
 	char terminator;
@@ -582,6 +628,7 @@
 SWITCH_DECLARE(int) CoreSession::transfer(char *extension, char *dialplan, char *context)
 {
     switch_status_t status;
+	this_check(-1);
 	sanity_check(-1);
     begin_allow_threads();
     status = switch_ivr_session_transfer(session, extension, dialplan, context);
@@ -597,6 +644,8 @@
 										 int timeout,
 										 const char *valid_terminators)
 {
+	this_check((char *)"");
+	sanity_check((char *)"");
 	if (min_digits < 1) {
 		min_digits = 1;
 	}
@@ -624,6 +673,7 @@
 {
     switch_status_t status;
 	sanity_check((char *)"");
+	this_check((char *)"");
 	begin_allow_threads();
 	memset(dtmf_buf, 0, sizeof(dtmf_buf));
     status = switch_play_and_get_digits( session, 
@@ -644,12 +694,41 @@
 	return dtmf_buf;
 }
 
+SWITCH_DECLARE(void) CoreSession::say(const char *tosay, const char *module_name, const char *say_type, const char *say_method) 
+{
+	this_check_void();
+	sanity_check_noreturn;
+	if (!(tosay && module_name && say_type && say_method)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! invalid args.\n");
+		return;
+	}
+	begin_allow_threads();
+	switch_ivr_say(session, tosay, module_name, say_type, say_method, ap);
+    end_allow_threads();
+}
+
+SWITCH_DECLARE(void) CoreSession::sayPhrase(const char *phrase_name, const char *phrase_data, const char *phrase_lang) 
+{
+	this_check_void();
+	sanity_check_noreturn;
+	
+	if (!(phrase_name)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! invalid args.\n");
+		return;
+	}
+
+	begin_allow_threads();
+	switch_ivr_phrase_macro(session, phrase_name, phrase_data, phrase_lang, ap);
+    end_allow_threads();
+}
+
 SWITCH_DECLARE(int) CoreSession::streamFile(char *file, int starting_sample_count) {
 
     switch_status_t status;
     //switch_file_handle_t fh = { 0 };
 	const char *prebuf;
 
+	this_check(-1);
     sanity_check(-1);
 	
 	memset(&local_fh, 0, sizeof(local_fh));
@@ -677,6 +756,7 @@
 
 SWITCH_DECLARE(bool) CoreSession::ready() {
 
+	this_check(false);
 	sanity_check(false);	
 	return switch_channel_ready(channel) != 0;
 }
@@ -688,6 +768,9 @@
 	switch_core_session_t *aleg_core_session = NULL;
 	switch_call_cause_t cause;
 
+	this_check(0);
+	sanity_check(0);
+
 	cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 
 	if (a_leg_session != NULL) {
@@ -737,6 +820,9 @@
 	switch_file_handle_t fh = { 0 };
 	switch_status_t status;
 
+	this_check(-1);
+	sanity_check(-1);
+
 	fh.thresh = silence_threshold;
 	fh.silence_hits = silence_secs;
 	store_file_handle(&fh);
@@ -752,6 +838,9 @@
 	switch_event_t *event;
 	switch_channel_t *channel;
 
+	this_check(-1);
+	sanity_check(-1);
+
 	if (!session) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -765,12 +854,17 @@
 
 SWITCH_DECLARE(int) CoreSession::flushDigits() 
 {
+	this_check(-1);
+	sanity_check(-1);
 	switch_channel_flush_dtmf(switch_core_session_get_channel(session));
 	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_DECLARE(int) CoreSession::setAutoHangup(bool val) 
 {
+	this_check(-1);
+	sanity_check(-1);
+
 	if (!session) {
 		return SWITCH_STATUS_FALSE;
 	}	
@@ -784,6 +878,9 @@
 
 SWITCH_DECLARE(void) CoreSession::setCallerData(char *var, char *val) {
 
+	this_check_void();
+	sanity_check_noreturn;
+
 	if (strcmp(var, "dialplan") == 0) {
 		caller_profile.dialplan = val;
 	}
@@ -816,8 +913,9 @@
 
 SWITCH_DECLARE(void) CoreSession::setHangupHook(void *hangup_func) {
 
+	this_check_void();
 	sanity_check_noreturn;
-
+	
     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::seHangupHook, hangup_func: %p\n", hangup_func);
     on_hangup = hangup_func;
     switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -943,6 +1041,9 @@
 	
     switch_file_handle_t *fh = NULL;	   
 
+	this_check(SWITCH_STATUS_FALSE);
+	sanity_check(SWITCH_STATUS_FALSE);
+	
     if (switch_strlen_zero(ret)) {
 		return SWITCH_STATUS_SUCCESS;	
     }

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c	Thu May 22 15:05:28 2008
@@ -429,13 +429,15 @@
 {
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr;;
+
+	switch_assert(pool != NULL);
+
 	switch_threadattr_create(&thd_attr, pool);
 	switch_threadattr_detach_set(thd_attr, 1);
 	gethostname(hostname, sizeof(hostname));
 	switch_find_local_ip(guess_ip_v4, sizeof(guess_ip_v4), AF_INET);
 	switch_find_local_ip(guess_ip_v6, sizeof(guess_ip_v6), AF_INET6);
 
-	switch_assert(pool != NULL);
 	THRUNTIME_POOL = RUNTIME_POOL = pool;
 
 	switch_queue_create(&EVENT_QUEUE[0], POOL_COUNT_MAX + 10, THRUNTIME_POOL);
@@ -732,6 +734,7 @@
 
 	/* go ahead and give ourselves some space to work with, should save a few reallocs */
 	if (!(encode_buf = malloc(encode_len))) {
+		switch_safe_free(buf);
 		return SWITCH_STATUS_MEMERR;
 	}
 
@@ -787,7 +790,7 @@
 			}
 		}
 
-		switch_snprintf(buf + len, dlen - len, "%s: %s\n", hp->name, switch_strlen_zero(encode_buf) ? "_undef_" : encode_buf);
+		switch_snprintf(buf + len, dlen - len, "%s: %s\n", hp->name, *encode_buf == '\0' ? "_undef_" : encode_buf);
 		len = strlen(buf);
 	}
 
@@ -860,11 +863,14 @@
 		ret = vasprintf(&data, fmt, ap);
 #else
 		data = (char *) malloc(2048);
-		switch_assert(data);
+		if (!data) return NULL;
 		ret = vsnprintf(data, 2048, fmt, ap);
 #endif
 		va_end(ap);
 		if (ret == -1) {
+#ifndef HAVE_VASPRINTF
+			free(data);
+#endif
 			return NULL;
 		}
 	}
@@ -1275,7 +1281,7 @@
 	return data;
 }
 
-SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix)
+SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t* vars_map)
 {
 	switch_stream_handle_t stream = { 0 };
 	switch_size_t encode_len = 1024, new_len = 0;
@@ -1284,6 +1290,7 @@
 	char *e = NULL;
 	switch_event_header_t *hi;
 	uint32_t x = 0;
+	void* data = NULL;
 
 	SWITCH_STANDARD_STREAM(stream);
 
@@ -1318,10 +1325,18 @@
 
 	if (event) {
 		if ((hi = event->headers)) {
+		
 			for (; hi; hi = hi->next) {
 				char *var = hi->name;
 				char *val = hi->value;
-			
+				
+				if (vars_map != NULL)
+				{
+				    if ((data = switch_core_hash_find(vars_map,var)) == NULL || strcasecmp(((char*)data),"enabled"))
+					continue;
+				    
+				}
+				
 				new_len = (strlen((char *) var) * 3) + 1;
 				if (encode_len < new_len) {
 					char *tmp;
@@ -1339,6 +1354,7 @@
 			}
 		}
 	}
+	
 	e = (char *) stream.data + (strlen((char *) stream.data) - 1);
 
 	if (e && *e == '&') {

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c	Thu May 22 15:05:28 2008
@@ -279,8 +279,9 @@
 	if (lead_frames) {
 		switch_frame_t *read_frame;
 		int frame_count = atoi(lead_frames);
-
-		while(frame_count > 0) {
+		int max_frames = frame_count * 2;
+		
+		while(frame_count > 0 && --max_frames > 0) {
 			status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 			if (!SWITCH_READ_ACCEPTABLE(status)) {
 				goto done;
@@ -321,7 +322,7 @@
 								stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE);
 							}
 
-							if (stream) {
+							if (stream && switch_is_moh(stream)) {
 								if ((b_session = switch_core_session_locate(b_uuid))) {
 									switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
 									switch_ivr_broadcast(b_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP);
@@ -334,10 +335,14 @@
 						}
 					}
 					for (x = 0; x < loops || loops < 0; x++) {
+						switch_time_t b4, aftr;
+						
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n", 
 										  switch_channel_get_name(channel), app_name, app_arg);
+						b4 = switch_timestamp_now();
 						switch_core_session_exec(session, application_interface, app_arg);
-						if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST)) {
+						aftr = switch_timestamp_now();
+						if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST) || aftr - b4 < 500000) {
 							break;
 						}
 					}
@@ -573,7 +578,7 @@
 	switch_time_t started = 0;
 	uint32_t elapsed;
 
-	if (!args->input_callback) {
+	if (!args || !args->input_callback) {
 		return SWITCH_STATUS_GENERR;
 	}
 

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c	Thu May 22 15:05:28 2008
@@ -928,7 +928,7 @@
     return 0;
 }
 
-static switch_status_t generate_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
+static switch_status_t generate_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
 {
     switch_channel_t *channel = switch_core_session_get_channel(session);
     switch_media_bug_t *bug = switch_channel_get_private(channel, "dtmf_generate");
@@ -1298,17 +1298,23 @@
 typedef struct {
 	const char *app;
 	uint32_t flags;
+	switch_bind_flag_t bind_flags;
 } dtmf_meta_app_t;
 
 typedef struct {
 	dtmf_meta_app_t map[10];
 	time_t last_digit;
-	switch_bool_t meta_on;
+	switch_bool_t meta_on;	
+	int up;
+} dtmf_meta_settings_t;
+
+typedef struct {
+	dtmf_meta_settings_t sr[3];
 } dtmf_meta_data_t;
 
 #define SWITCH_META_VAR_KEY "__dtmf_meta"
 
-static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
+static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	dtmf_meta_data_t *md = switch_channel_get_private(channel, SWITCH_META_VAR_KEY);
@@ -1320,39 +1326,77 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	if (md->meta_on && now - md->last_digit > 5) {
-		md->meta_on = SWITCH_FALSE;
+	if (direction == SWITCH_DTMF_RECV && !md->sr[SWITCH_DTMF_RECV].up) { 
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	if (direction == SWITCH_DTMF_SEND && !md->sr[SWITCH_DTMF_SEND].up) { 
+		return SWITCH_STATUS_SUCCESS;
+	}
+	
+	if (md->sr[direction].meta_on && now - md->sr[direction].last_digit > 5) {
+		md->sr[direction].meta_on = SWITCH_FALSE;
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Meta digit timeout parsing %c\n", switch_channel_get_name(channel), dtmf->digit);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	md->last_digit = now;
+	md->sr[direction].last_digit = now;
 
 	if (dtmf->digit == '*') {
-		if (md->meta_on) {
-			md->meta_on = SWITCH_FALSE;
+		if (md->sr[direction].meta_on) {
+			md->sr[direction].meta_on = SWITCH_FALSE;
 			return SWITCH_STATUS_SUCCESS;
 		} else {
-			md->meta_on = SWITCH_TRUE;
+			md->sr[direction].meta_on = SWITCH_TRUE;
 			return SWITCH_STATUS_FALSE;
 		}
 	}
 
-	if (md->meta_on) {
+	if (md->sr[direction].meta_on) {
 		if (dtmf->digit >= '0' && dtmf->digit <= '9') {
+			int ok = 0;
 			*digit = dtmf->digit;
 			dval = atoi(digit);
-			if (md->map[dval].app) {
+
+			if (direction == SWITCH_DTMF_RECV && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_ALEG)) { 
+				ok = 1;
+			} else if (direction == SWITCH_DTMF_SEND && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_BLEG)) { 
+				ok = 1;
+			}
+
+			if (ok && md->sr[direction].map[dval].app) {
+				uint32_t flags = md->sr[direction].map[dval].flags;
+
+				if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_OPPOSITE)) {
+					if (direction == SWITCH_DTMF_SEND) {
+						flags |= SMF_ECHO_ALEG;
+					} else {
+						flags |= SMF_ECHO_BLEG;
+					}
+				} else if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_SAME)) {
+					if (direction == SWITCH_DTMF_SEND) {
+						flags |= SMF_ECHO_BLEG;
+					} else {
+						flags |= SMF_ECHO_ALEG;
+					}
+				} else if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_ALEG)) {
+					flags |= SMF_ECHO_ALEG;
+				} else if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_BLEG)) {
+					flags |= SMF_ECHO_BLEG;
+				} else {
+					flags |= SMF_ECHO_ALEG;
+				}
+
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Processing meta digit '%c' [%s]\n", 
-								  switch_channel_get_name(channel), dtmf->digit, md->map[dval].app);
-				switch_ivr_broadcast(switch_core_session_get_uuid(session), md->map[dval].app, md->map[dval].flags);
+								  switch_channel_get_name(channel), dtmf->digit, md->sr[direction].map[dval].app);
+				switch_ivr_broadcast(switch_core_session_get_uuid(session), md->sr[direction].map[dval].app, flags);
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Ignoring meta digit '%c' not mapped\n", 
 								  switch_channel_get_name(channel), dtmf->digit);
 								  
 			}
 		}
-		md->meta_on = SWITCH_FALSE;
+		md->sr[direction].meta_on = SWITCH_FALSE;
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -1368,7 +1412,7 @@
 }
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key, 
-																  switch_bool_t dial_b, switch_bool_t exec_b, const char *app)
+																  switch_bind_flag_t bind_flags, const char *app)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	dtmf_meta_data_t *md = switch_channel_get_private(channel, SWITCH_META_VAR_KEY);
@@ -1377,25 +1421,39 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid key %u\n", key);
 		return SWITCH_STATUS_FALSE;
 	}
-
+	
 	if (!md) {
 		md = switch_core_session_alloc(session, sizeof(*md));
 		switch_channel_set_private(channel, SWITCH_META_VAR_KEY, md);
-		if (dial_b) {
-			switch_core_event_hook_add_send_dtmf(session, meta_on_dtmf);
-		} else {
-			switch_core_event_hook_add_recv_dtmf(session, meta_on_dtmf);
-		}
+		switch_core_event_hook_add_send_dtmf(session, meta_on_dtmf);
+		switch_core_event_hook_add_recv_dtmf(session, meta_on_dtmf);
 	}
 
 	if (!switch_strlen_zero(app)) {
-		md->map[key].app = switch_core_session_strdup(session, app);
-		md->map[key].flags = exec_b ? SMF_ECHO_BLEG : SMF_ECHO_ALEG;
-		md->map[key].flags |= SMF_HOLD_BLEG;
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound: %d %s\n", key, app);
+		if ((bind_flags & SBF_DIAL_ALEG)) {
+			md->sr[SWITCH_DTMF_RECV].up = 1;
+			md->sr[SWITCH_DTMF_RECV].map[key].app = switch_core_session_strdup(session, app);
+			md->sr[SWITCH_DTMF_RECV].map[key].flags |= SMF_HOLD_BLEG;
+			md->sr[SWITCH_DTMF_RECV].map[key].bind_flags = bind_flags;
+		
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound A-Leg: %d %s\n", key, app);
+		}
+		if ((bind_flags & SBF_DIAL_BLEG)) {
+			md->sr[SWITCH_DTMF_SEND].up = 1;
+			md->sr[SWITCH_DTMF_SEND].map[key].app = switch_core_session_strdup(session, app);
+			md->sr[SWITCH_DTMF_SEND].map[key].flags |= SMF_HOLD_BLEG;
+			md->sr[SWITCH_DTMF_SEND].map[key].bind_flags = bind_flags;
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound B-Leg: %d %s\n", key, app);
+		}
+		
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "UnBound: %d\n", key);
-		md->map[key].app = NULL;
+		if ((bind_flags & SBF_DIAL_ALEG)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "UnBound A-Leg: %d\n", key);
+			md->sr[SWITCH_DTMF_SEND].map[key].app = NULL;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "UnBound: B-Leg %d\n", key);
+			md->sr[SWITCH_DTMF_SEND].map[key].app = NULL;
+		}
 	}
 
 	return SWITCH_STATUS_SUCCESS;
@@ -1848,6 +1906,11 @@
 
 	mypath = strdup(path);
 
+	if (!mypath) {
+		switch_core_session_rwunlock(session);
+		return SWITCH_STATUS_MEMERR;
+	}
+
 	if ((nomedia = switch_channel_test_flag(channel, CF_PROXY_MODE))) {
 		switch_ivr_media(uuid, SMF_REBRIDGE);
 	}

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c	Thu May 22 15:05:28 2008
@@ -99,7 +99,7 @@
 	uint32_t loop_count = 0;
 	const char *app_name = NULL, *app_arg = NULL;
 	const char *hook_var = NULL;
-	int nosuspend  = 0;
+	int inner_bridge  = 0;
 #ifdef SWITCH_VIDEO_IN_THREADS
     struct vid_helper vh = { 0 };
 	uint32_t vid_launch = 0;
@@ -123,16 +123,24 @@
 		ans_b = switch_channel_test_flag(chan_b, CF_ANSWERED);
 	}
 
-	switch_channel_set_flag(chan_a, CF_BRIDGED);
-	
-	nosuspend = switch_channel_test_flag(chan_a, CF_INNER_BRIDGE);
+	inner_bridge = switch_channel_test_flag(chan_a, CF_INNER_BRIDGE);
 	
+
+	switch_channel_set_flag(chan_a, CF_BRIDGED);
+
+
+	switch_channel_wait_for_flag(chan_b, CF_BRIDGED, SWITCH_TRUE, 1000000);
+
 	for (;;) {
 		switch_channel_state_t b_state;
 		switch_status_t status;
 		switch_event_t *event;
 		loop_count++;
 
+		if (!switch_channel_test_flag(chan_b, CF_BRIDGED)) {
+			goto end_of_bridge_loop;
+		}
+
 		if (!switch_channel_ready(chan_a)) {
 			goto end_of_bridge_loop;
 		}
@@ -160,7 +168,7 @@
 			switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
 		}
 
-		if (!nosuspend && (switch_channel_test_flag(chan_a, CF_SUSPEND) || switch_channel_test_flag(chan_b, CF_SUSPEND))) {
+		if (!inner_bridge && (switch_channel_test_flag(chan_a, CF_SUSPEND) || switch_channel_test_flag(chan_b, CF_SUSPEND))) {
 			status = switch_core_session_read_frame(session_a, &read_frame, SWITCH_IO_FLAG_NONE, stream_id);
 			
 			if (!SWITCH_READ_ACCEPTABLE(status)) {
@@ -290,7 +298,7 @@
     }
 #endif
 
-	if (!nosuspend) {
+	if (!inner_bridge) {
 		hook_var = switch_channel_get_variable(chan_a, SWITCH_API_BRIDGE_END_VARIABLE);
 	}
 
@@ -319,7 +327,7 @@
 	msg.from = __FILE__;
 	switch_core_session_receive_message(session_a, &msg);
 	
-	if (!nosuspend && switch_channel_get_state(chan_a) < CS_HANGUP) {
+	if (!inner_bridge && switch_channel_get_state(chan_a) < CS_HANGUP) {
 		if ((app_name = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE))) {
 			switch_caller_extension_t *extension = NULL;
 			if ((extension = switch_caller_extension_new(session_a, app_name, app_name)) == 0) {
@@ -345,7 +353,9 @@
 	switch_core_session_reset(session_a, SWITCH_TRUE);
 	switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));
-	switch_channel_clear_flag(chan_a, CF_BRIDGED);
+	if (!inner_bridge) {
+		switch_channel_clear_flag(chan_a, CF_BRIDGED);
+	}
 	switch_core_session_rwunlock(session_b);
 	return NULL;
 }
@@ -369,8 +379,8 @@
 	switch_channel_clear_state_handler(channel, &audio_bridge_peer_state_handlers);
 
 	state = switch_channel_get_state(channel);
-
-	if (!switch_channel_test_flag(channel, CF_TRANSFER) && state != CS_PARK && state != CS_ROUTING) {
+	
+	if (!switch_channel_test_flag(channel, CF_TRANSFER) && state != CS_PARK && state != CS_ROUTING && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {
 		switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
 	}
 
@@ -648,7 +658,8 @@
 	switch_channel_state_t state;
 	switch_event_t *event;
 	int br = 0;
-
+	int inner_bridge = switch_channel_test_flag(caller_channel, CF_INNER_BRIDGE);
+	
 	switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
 	switch_channel_clear_flag(caller_channel, CF_TRANSFER);
 	switch_channel_clear_flag(peer_channel, CF_TRANSFER);
@@ -757,8 +768,7 @@
 			audio_bridge_thread(NULL, (void *) a_leg);
 
 			switch_channel_clear_flag(caller_channel, CF_ORIGINATOR);
-			//make sure this doesnt break anything
-
+			
 			if (!switch_channel_test_flag(peer_channel, CF_TRANSFER) && switch_channel_get_state(peer_channel) == CS_EXCHANGE_MEDIA) {
 				switch_channel_set_state(peer_channel, CS_RESET);
 			}
@@ -785,9 +795,6 @@
 
   done:
 
-	switch_channel_clear_flag(caller_channel, CF_INNER_BRIDGE);
-	switch_channel_clear_flag(peer_channel, CF_INNER_BRIDGE);
-
 	if (br && switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(caller_channel, event);
 		switch_event_fire(&event);
@@ -795,7 +802,7 @@
 
 	state = switch_channel_get_state(caller_channel);
 	
-	if (!switch_channel_test_flag(caller_channel, CF_TRANSFER)) {
+	if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && !inner_bridge) {
 		if ((state != CS_EXECUTE && state != CS_PARK && state != CS_ROUTING) || 
 			(switch_channel_test_flag(peer_channel, CF_ANSWERED) && state < CS_HANGUP && 
 			 switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE)))) {

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c	Thu May 22 15:05:28 2008
@@ -268,80 +268,77 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_input_args_t args = { 0 };
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sound=[%s]\n", sound);
+	if (!session || !menu || switch_strlen_zero(sound)) {
+		return status;
+	}
 
-	if (session != NULL && menu != NULL && !switch_strlen_zero(sound)) {
-		memset(menu->buf, 0, menu->inlen + 1);
-		menu->ptr = menu->buf;
+	memset(menu->buf, 0, menu->inlen + 1);
+	menu->ptr = menu->buf;
 
-		if (!need) {
-			len = 1;
-			ptr = NULL;
-		} else {
-			len = (uint32_t) menu->inlen + 1;
-			ptr = menu->ptr;
-		}
-		args.buf = ptr;
-		args.buflen = len;
+	if (!need) {
+		len = 1;
+		ptr = NULL;
+	} else {
+		len = (uint32_t) menu->inlen + 1;
+		ptr = menu->ptr;
+	}
+	args.buf = ptr;
+	args.buflen = len;
 
-		status = switch_ivr_play_file(session, NULL, sound, &args);
+	status = switch_ivr_play_file(session, NULL, sound, &args);
 
-		
-		if (need) {
+	if (!need) {
+		return status;
+	}
 
-			menu->ptr += strlen(menu->buf);
-			if (strlen(menu->buf) < need) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "waiting for %u/%u digits t/o %d\n", 
-								  (uint32_t)(menu->inlen - strlen(menu->buf)), (uint32_t)need, menu->inter_timeout);
-				status = switch_ivr_collect_digits_count(session, menu->ptr, menu->inlen - strlen(menu->buf), 
-														 need, "#", &terminator, menu->inter_timeout, 0, 0);
-			}
+	menu->ptr += strlen(menu->buf);
+	if (strlen(menu->buf) < need) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "waiting for %u/%u digits t/o %d\n", 
+						  (uint32_t)(menu->inlen - strlen(menu->buf)), (uint32_t)need, menu->inter_timeout);
+		status = switch_ivr_collect_digits_count(session, menu->ptr, menu->inlen - strlen(menu->buf), 
+												 need, "#", &terminator, menu->inter_timeout, 0, 0);
+	}
 
-			
-			if (menu->confirm_macro && status == SWITCH_STATUS_SUCCESS && !switch_strlen_zero(menu->buf)) {
-				switch_input_args_t confirm_args = { 0 }, *ap = NULL;
-				char buf[10] = "";
-				char terminator_key;
-				int att = menu->confirm_attempts;
+	if (menu->confirm_macro && status == SWITCH_STATUS_SUCCESS && *menu->buf != '\0') {
+		switch_input_args_t confirm_args = { 0 }, *ap = NULL;
+		char buf[10] = "";
+		char terminator_key;
+		int att = menu->confirm_attempts;
 
-				
-				while (att) {
-					confirm_args.buf = buf;
-					confirm_args.buflen = sizeof(buf);
-					memset(buf, 0, confirm_args.buflen);
+		while (att) {
+			confirm_args.buf = buf;
+			confirm_args.buflen = sizeof(buf);
+			memset(buf, 0, confirm_args.buflen);
 
-					if (menu->confirm_key) {
-						ap = &confirm_args;
-					}
-					
-					switch_ivr_phrase_macro(session, menu->confirm_macro, menu->buf, NULL, ap);
+			if (menu->confirm_key) {
+				ap = &confirm_args;
+			}
+			
+			switch_ivr_phrase_macro(session, menu->confirm_macro, menu->buf, NULL, ap);
 
-					if (menu->confirm_key && *buf == '\0') {
-						switch_ivr_collect_digits_count(session, buf, sizeof(buf), 1, "#", &terminator_key, menu->timeout, 0, 0);
-					}
+			if (menu->confirm_key && *buf == '\0') {
+				switch_ivr_collect_digits_count(session, buf, sizeof(buf), 1, "#", &terminator_key, menu->timeout, 0, 0);
+			}
 
-					if (menu->confirm_key && *buf != '\0') {
-						if (*menu->confirm_key == *buf) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
-											  "approving digits '%s' via confirm key %s\n", menu->buf, menu->confirm_key);
-							break;
-						} else {
-							att = 0;
-							break;
-						}
-					}
-					att--;
-				}
-				if (!att) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rejecting digits '%s' via confirm key %s\n", menu->buf, menu->confirm_key);
-					*menu->buf = '\0';
+			if (menu->confirm_key && *buf != '\0') {
+				if (*menu->confirm_key == *buf) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+									  "approving digits '%s' via confirm key %s\n", menu->buf, menu->confirm_key);
+					break;
+				} else {
+					att = 0;
+					break;
 				}
 			}
-
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "digits '%s'\n", menu->buf);
+			att--;
+		}
+		if (!att) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rejecting digits '%s' via confirm key %s\n", menu->buf, menu->confirm_key);
+			*menu->buf = '\0';
 		}
 	}
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "returning [%d]\n", status);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "digits '%s'\n", menu->buf);
 
 	return status;
 }
@@ -357,7 +354,7 @@
 	switch_channel_t *channel;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	if (session == NULL || stack == NULL || switch_strlen_zero(name)) {
+	if (!session || !stack || switch_strlen_zero(name)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid menu context\n");
 		return SWITCH_STATUS_FALSE;
 	}
@@ -395,8 +392,7 @@
 		memset(menu->buf, 0, menu->inlen + 1);
 		status = play_and_collect(session, menu, greeting_sound, menu->inlen);
 
-		if (!switch_strlen_zero(menu->buf)) {
-
+		if (*menu->buf != '\0') {
 
 			for (ap = menu->actions; ap; ap = ap->next) {
 				int ok = 0;
@@ -485,7 +481,6 @@
 				}
 			}
 
-
 			if (switch_test_flag(menu, SWITCH_IVR_MENU_FLAG_STACK)) {	// top level
 				if (switch_test_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN)) {	// catch the fallback and recover
 					switch_clear_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN);

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c	Thu May 22 15:05:28 2008
@@ -39,7 +39,7 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	
 	if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) {
-		while(switch_channel_get_state(channel) == CS_CONSUME_MEDIA) {
+		while(switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
 			switch_ivr_sleep(session, 10);
 		}
 	}
@@ -268,6 +268,10 @@
 	const char *var = switch_channel_get_variable(caller_channel, "call_timeout");
 	switch_time_t start = 0;
 	
+	if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
 	switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
 	write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 
@@ -281,10 +285,6 @@
 	timelimit *= 1000000;
 	start = switch_timestamp_now();
 
-	if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
-		return SWITCH_STATUS_SUCCESS;
-	}
-
 	if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
 		ringback_data = switch_channel_get_variable(caller_channel, "transfer_ringback");
 	} 
@@ -821,7 +821,7 @@
 						myflags |= SOF_FORKED_DIAL;
 					}
 				}
-				if ((reason = switch_core_session_outgoing_channel(session, chan_type, new_profile, &new_session, &pool, myflags)) != SWITCH_CAUSE_SUCCESS) {
+				if ((reason = switch_core_session_outgoing_channel(session, var_event, chan_type, new_profile, &new_session, &pool, myflags)) != SWITCH_CAUSE_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel of type [%s] cause: [%s]\n", 
 									  chan_type, switch_channel_cause2str(reason));
 					if (pool) {
@@ -1154,16 +1154,17 @@
 							}
 						}
 					}
-					
-					if (caller_channel && i == 0) {
-						holding = switch_channel_get_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE);
-						holding = switch_core_session_strdup(session, holding);
-						switch_channel_set_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE, NULL);
-					}
-					if (holding) {
-						switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(peer_sessions[i]));
-					} else {
-						switch_channel_hangup(peer_channels[i], reason);
+					if (switch_channel_ready(peer_channels[i])) {
+						if (caller_channel && i == 0) {
+							holding = switch_channel_get_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE);
+							holding = switch_core_session_strdup(session, holding);
+							switch_channel_set_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE, NULL);
+						}
+						if (holding) {
+							switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(peer_sessions[i]));
+						} else {
+							switch_channel_hangup(peer_channels[i], reason);
+						}
 					}
 				}
 			}

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c	Thu May 22 15:05:28 2008
@@ -209,7 +209,8 @@
 
 	while (input && !done) {
 		char *pattern = (char *) switch_xml_attr(input, "pattern");
-
+		const char *do_break = switch_xml_attr_soft(input, "break_on_match");
+		
 		if (pattern) {
 			switch_regex_t *re = NULL;
 			int proceed = 0, ovector[30];
@@ -220,7 +221,7 @@
 			switch_xml_t match = NULL;
 
 			status = SWITCH_STATUS_SUCCESS;
-
+			
 			if ((proceed = switch_regex_perform(data, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
 				match = switch_xml_child(input, "match");
 			} else {
@@ -232,7 +233,7 @@
 				for (action = switch_xml_child(match, "action"); action && status == SWITCH_STATUS_SUCCESS; action = action->next) {
 					char *adata = (char *) switch_xml_attr_soft(action, "data");
 					char *func = (char *) switch_xml_attr_soft(action, "function");
-
+					
 					if (strchr(pattern, '(') && strchr(adata, '$')) {
 						len = (uint32_t) (strlen(data) + strlen(adata) + 10);
 						if (!(substituted = malloc(len))) {
@@ -269,6 +270,12 @@
 						status = SWITCH_STATUS_FALSE;
 
 						cmd = switch_core_session_strdup(session, odata);
+
+						if (!cmd) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Allocation error calling execute\n");
+							break;
+						}
+
 						cmd_args = switch_separate_paren_args(cmd);
 
 						if (!cmd_args ) {
@@ -313,6 +320,12 @@
 			switch_regex_safe_free(re);
 			switch_safe_free(expanded);
 			switch_safe_free(substituted);
+
+			
+			if (match && do_break && switch_true(do_break)) {
+				break;
+			}
+			
 		}
 
 		if (status != SWITCH_STATUS_SUCCESS) {
@@ -637,12 +650,12 @@
 		}
 
 		if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(audio_buffer, write_frame.data,
-																	  read_frame->codec->implementation->bytes_per_frame)) <= 0) {
+																	  read_codec->implementation->bytes_per_frame)) <= 0) {
 			break;
 		}
 
 		write_frame.samples = write_frame.datalen / 2;
-
+		
 		if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
 			break;
 		}
@@ -663,7 +676,7 @@
 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_channel_t *channel = switch_core_session_get_channel(session);
-	int16_t *abuf;
+	int16_t *abuf = NULL;
 	switch_dtmf_t dtmf = {0};
 	uint32_t interval = 0, samples = 0, framelen, sample_start = 0;
 	uint32_t ilen = 0;
@@ -686,8 +699,6 @@
 	const char *prebuf;
 	const char *alt = NULL;
 
-	switch_zmalloc(abuf, FILE_STARTSAMPLES * sizeof(*abuf));
-
 	switch_channel_pre_answer(channel);
 
 	prefix = switch_channel_get_variable(channel, "sound_prefix");
@@ -708,12 +719,11 @@
 			const char *lang = switch_channel_get_variable(channel, "language");
 			alt = file + 7;
 			dup = switch_core_session_strdup(session, alt);
-
-			if ((arg = strchr(dup, ':'))) {
-				*arg++ = '\0';
-			}
 			
 			if (dup) {
+				if ((arg = strchr(dup, ':'))) {
+					*arg++ = '\0';
+				}
 				return switch_ivr_phrase_macro(session, dup, arg, lang, args);
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Args\n");
@@ -748,12 +758,10 @@
 		
 	}
 
-
 	if (!prefix) {
 		prefix = SWITCH_GLOBAL_dirs.base_dir;
 	}
 
-
 	if (!strstr(file, SWITCH_URL_SEPARATOR)) {
 		if (!switch_is_file_path(file)) {
 			file = switch_core_session_sprintf(session, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, file);
@@ -797,6 +805,7 @@
 		asis = 1;
 	}
 
+	switch_zmalloc(abuf, FILE_STARTSAMPLES * sizeof(*abuf));
 	write_frame.data = abuf;
 	write_frame.buflen = FILE_STARTSAMPLES;
 
@@ -988,7 +997,6 @@
 		if (done || olen <= 0) {
 			break;
 		}
-		
 
 		if (!asis) {
 			if (fh->speed > 2) {
@@ -1144,7 +1152,7 @@
 
 
  end:
-	free(abuf);
+	switch_safe_free(abuf);
 
 	switch_core_session_reset(session, SWITCH_TRUE);
 	return status;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c	Thu May 22 15:05:28 2008
@@ -1349,7 +1349,7 @@
 		}
 	}
 
-	if ((api = switch_loadable_module_get_api_interface(cmd)) != 0) {
+	if (cmd && (api = switch_loadable_module_get_api_interface(cmd)) != 0) {
 		status = api->function(arg, session, stream);
 	} else {
 		status = SWITCH_STATUS_FALSE;

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c	Thu May 22 15:05:28 2008
@@ -311,7 +311,9 @@
 
 	switch_safe_free(data);
 	switch_safe_free(new_fmt);
-	fflush(handle);
+	if (handle) {
+		fflush(handle);
+	}
 }
 
 SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool)

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c	Thu May 22 15:05:28 2008
@@ -144,6 +144,10 @@
 			z = 0;
 			num = atoi(index);
 
+			if (num < 0 || num > 256) {
+				num = -1;
+			}
+
 			if (pcre_copy_substring(field_data, ovector, match_count, num, replace, sizeof(replace)) > 0) {
 				switch_size_t r;
 				for (r = 0; r < strlen(replace); r++) {

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c	Thu May 22 15:05:28 2008
@@ -201,12 +201,12 @@
 	unsigned int elapsed;
 	switch_size_t bytes;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-
-	WRITE_INC(rtp_session);
 	
 	switch_assert(rtp_session != NULL);
 	switch_assert(rtp_session->ice_user != NULL);
 
+	WRITE_INC(rtp_session);
+
 	if (rtp_session->stuncount != 0) {
 		rtp_session->stuncount--;
 		goto end;
@@ -985,9 +985,9 @@
 	}
 }
 
-SWITCH_DECLARE(uint8_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags)
+SWITCH_DECLARE(uint32_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags)
 {
-	return (uint8_t) switch_test_flag(rtp_session, flags);
+	return (uint32_t) switch_test_flag(rtp_session, flags);
 }
 
 SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags)

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c	Thu May 22 15:05:28 2008
@@ -568,12 +568,16 @@
 	const char *sp = str;
 	char *p, *s = NULL;
 	
-	while(sp && *sp && *sp == ' ') {
+	if (!sp) return NULL;
+
+	while(*sp == ' ') {
 		sp++;
 	}
 	
 	s = strdup(sp);
 
+	if (!s) return NULL;
+
 	p = s + (strlen(s) - 1);
 
 	while(*p == ' ') {

Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj	(original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj	Thu May 22 15:05:28 2008
@@ -363,6 +363,14 @@
 			<File
 				RelativePath="..\..\src\switch_core_session.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						DisableSpecificWarnings="6385"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\src\switch_core_speech.c"

Modified: freeswitch/branches/lukedashjr/syslibs/libs/libedit/src/makelist
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/libedit/src/makelist	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/libedit/src/makelist	Thu May 22 15:05:28 2008
@@ -36,6 +36,7 @@
 # makelist.sh: Automatically generate header files...
 
 AWK=awk
+
 USAGE="Usage: $0 -h|-e|-fc|-fh|-bc|-bh|-m <filenames>"
 
 if [ "x$1" = "x" ]
@@ -140,7 +141,7 @@
 #
 -fh)
     cat $FILES | $AWK '/el_action_t/ { print $3 }' | \
-    sort | tr '[:lower:]' '[:upper:]' | $AWK '
+    sort | LANG=C tr '[:lower:]' '[:upper:]' | $AWK '
 	BEGIN {
 	    printf("/* Automatically generated file, do not edit */\n");
 	    printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n");

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update	Thu May 22 15:05:28 2008
@@ -1 +1 @@
-Mon May 12 14:41:23 EDT 2008
+Wed May 21 00:25:55 CEST 2008

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h	Thu May 22 15:05:28 2008
@@ -282,7 +282,7 @@
 #define MSG_STRUCT_ALIGN(p) ((p) = (void*)MSG_ALIGN(p, sizeof(void *)))
 
 enum {
- msg_n_params = 8,	/* allocation size of parameter string list */
+ msg_n_params = 8	/* allocation size of parameter string list */
 #define MSG_N_PARAMS msg_n_params
 };
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	Thu May 22 15:05:28 2008
@@ -2579,6 +2579,10 @@
     rport = su_sprintf(msg_home(msg), "rport=%u", ntohs(from->su_port));
     msg_header_replace_param(msg_home(msg), v->v_common, rport);
   }
+  else {
+    rport = su_sprintf(msg_home(msg), "rport=%u", ntohs(from->su_port));
+    msg_header_replace_param(msg_home(msg), v->v_common, rport);
+  } 
 
   return 0;
 }
@@ -8008,7 +8012,7 @@
   outgoing_queue_init(sa->sa_out.free = rq, 0);
 
   while ((orq = sa->sa_out.re_list)) {
-    if ((int32_t)(orq->orq_retry) - now > 0)
+    if ((int32_t)(orq->orq_retry - now) > 0)
       break;
     if (retransmitted >= timer_max_retransmit)
       break;

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am	Thu May 22 15:05:28 2008
@@ -13,13 +13,13 @@
 
 noinst_LTLIBRARIES = 	libnua.la
 
-check_LTLIBRARIES = 	libtestnua.la libtestproxy.la libtestnat.la
+check_PROGRAMS =
+TESTS =
 
-check_PROGRAMS =	test_nua
-
-TESTS = 		test_nua
-
-CLEANFILES =           tmp_sippasswd.??????
+if HAVE_CHECK
+check_PROGRAMS +=	check_nua
+TESTS += 		check_nua
+endif
 
 # ----------------------------------------------------------------------
 # Rules for building the targets
@@ -30,7 +30,7 @@
 			sofia-sip/nua.h sofia-sip/nua_tag.h
 
 libnua_la_SOURCES = 	nua.c nua_stack.h nua_common.c nua_stack.c \
-			nua_extension.c \
+			nua_extension.c nua_types.h \
 			nua_dialog.c nua_dialog.h \
 			outbound.c outbound.h \
 			nua_params.c nua_params.h \
@@ -43,27 +43,13 @@
 
 COVERAGE_INPUT = 	$(libnua_la_SOURCES) $(include_sofia_HEADERS)
 
-test_nua_LDFLAGS = 	-static
-
-libtestnua_la_SOURCES = test_nua.h test_ops.c \
-			test_init.c \
-			test_nua_api.c test_nua_params.c \
-			test_register.c test_basic_call.c \
-			test_offer_answer.c \
-			test_call_reject.c test_cancel_bye.c \
-			test_call_hold.c test_session_timer.c \
-			test_refer.c test_100rel.c \
-			test_sip_events.c test_simple.c \
-			test_extension.c
-
-
-libtestproxy_la_SOURCES = test_proxy.h test_proxy.c
-
-libtestnat_la_SOURCES = test_nat.h test_nat.c test_nat_tags.c
+check_nua_SOURCES = 	check_nua.c check_nua.h \
+			check_session.c check_register.c \
+			test_s2.h test_s2.c
 
-test_nua_SOURCES = 	test_nua.c 
+check_nua_LDADD = 	$(nua_libs) @CHECK_LIBS@
 
-test_nua_LDADD = 	libnua.la libtestnua.la libtestproxy.la libtestnat.la \
+nua_libs = 		libnua.la  \
 			../iptsec/libiptsec.la \
 			../ipt/libipt.la \
 			../nea/libnea.la \

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c	Thu May 22 15:05:28 2008
@@ -468,6 +468,26 @@
   ds->ds_terminating = 0;
 }
 
+void nua_dialog_update_params(nua_dialog_state_t *ds,
+			      nua_handle_preferences_t const *changed,
+			      nua_handle_preferences_t const *params,
+			      nua_handle_preferences_t const *defaults)
+{
+  nua_dialog_usage_t *usage;
+
+  for (usage = ds->ds_usage; usage; usage = usage->du_next) {
+    usage->du_class->usage_update_params(usage, changed, params, defaults);
+  }
+}
+
+void nua_base_usage_update_params(nua_dialog_usage_t const *du,
+				  nua_handle_preferences_t const *changed,
+				  nua_handle_preferences_t const *params,
+				  nua_handle_preferences_t const *defaults)
+{
+  (void)du, (void)changed, (void)params, (void)defaults;
+}
+
 /**@internal
  * Set refresh value suitably. 
  *

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h	Thu May 22 15:05:28 2008
@@ -35,27 +35,12 @@
  * @date Created: Wed Mar  8 11:38:18 EET 2006  ppessi
  */
 
-#ifndef NUA_OWNER_T
-#define NUA_OWNER_T struct nua_owner_s
-#endif
-typedef NUA_OWNER_T nua_owner_t;
+#include <nua_types.h>
 
 #ifndef NTA_H
 #include <sofia-sip/nta.h>
 #endif
 
-typedef struct nua_dialog_state nua_dialog_state_t;
-typedef struct nua_dialog_usage nua_dialog_usage_t;
-typedef struct nua_server_request nua_server_request_t; 
-typedef struct nua_client_request nua_client_request_t; 
-typedef struct nua_dialog_peer_info nua_dialog_peer_info_t;
-
-#ifndef NUA_SAVED_SIGNAL_T
-#define NUA_SAVED_SIGNAL_T struct nua_saved_signal *
-#endif
-
-typedef NUA_SAVED_SIGNAL_T nua_saved_signal_t;
-
 typedef struct {
   sip_method_t sm_method; 
   char const *sm_method_name;
@@ -386,6 +371,10 @@
 		       nua_client_request_t *cr,
 		       nua_server_request_t *sr);
   char const *(*usage_name)(nua_dialog_usage_t const *du);
+  void (*usage_update_params)(nua_dialog_usage_t const *du,
+			      nua_handle_preferences_t const *changed,
+			      nua_handle_preferences_t const *params,
+			      nua_handle_preferences_t const *defaults);
   void (*usage_peer_info)(nua_dialog_usage_t *du,
 			  nua_dialog_state_t const *ds,
 			  sip_t const *sip);
@@ -452,6 +441,16 @@
 			     nua_client_request_t *cr,
 			     nua_server_request_t *sr);
 
+void nua_dialog_update_params(nua_dialog_state_t *ds,
+			      nua_handle_preferences_t const *changed,
+			      nua_handle_preferences_t const *params,
+			      nua_handle_preferences_t const *defaults);
+
+void nua_base_usage_update_params(nua_dialog_usage_t const *du,
+				  nua_handle_preferences_t const *changed,
+				  nua_handle_preferences_t const *params,
+				  nua_handle_preferences_t const *defaults);
+
 void nua_dialog_deinit(nua_owner_t *own,
 		       nua_dialog_state_t *ds);
 

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c	Thu May 22 15:05:28 2008
@@ -92,6 +92,7 @@
     nua_notify_usage_add,
     nua_notify_usage_remove,
     nua_notify_usage_name,
+    nua_base_usage_update_params,
     NULL,
     nua_notify_usage_refresh,
     nua_notify_usage_shutdown,

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c	Thu May 22 15:05:28 2008
@@ -82,17 +82,6 @@
   /* Bitwise or of bitfields, casted to unsigned */
   a->nhp_set_.set_unsigned[0] |= b->nhp_set_.set_unsigned[0];
   a->nhp_set_.set_unsigned[1] |= b->nhp_set_.set_unsigned[1];
-
-  /* 
-  unsigned *ap, const *bp;
-  size_t i;
-
-  ap = a->nhp_set_.set_unsigned;
-  bp = b->nhp_set_.set_unsigned;
-  for (i = 0; i < (sizeof a->nhp_set); i += (sizeof *ap))
-    *ap++ |= *bp++;
-
-  */
 }
 
 static int nhp_set_tags(su_home_t *home, 
@@ -110,10 +99,9 @@
 			   tag_value_t value);
 
 static int nhp_save_params(nua_handle_t *nh,
-		    su_home_t *tmphome, 
-		    nua_global_preferences_t *gsrc,
-		    nua_handle_preferences_t *src);
-
+			   su_home_t *tmphome,
+			   nua_global_preferences_t *gsrc,
+			   nua_handle_preferences_t *src);
 
 /* ====================================================================== */
 /* Magical NUTAG_USER_AGENT() - add NHP_USER_AGENT there if it is not there */
@@ -310,6 +298,7 @@
  *   NUTAG_ONLY183_100REL() \n
  *   NUTAG_OUTBOUND() \n
  *   NUTAG_PATH_ENABLE() \n
+ *   NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) \n
  *   NUTAG_REFER_EXPIRES() \n
  *   NUTAG_REFER_WITH_ID() \n
  *   NUTAG_REGISTRAR() \n
@@ -430,6 +419,7 @@
  *   NUTAG_ONLY183_100REL() \n
  *   NUTAG_OUTBOUND() \n
  *   NUTAG_PATH_ENABLE() \n
+ *   NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) \n
  *   NUTAG_REFER_EXPIRES() \n
  *   NUTAG_REFER_WITH_ID() \n
  *   NUTAG_REGISTRAR() \n
@@ -482,13 +472,15 @@
   int status;
   char const *phrase;
 
+  nua_handle_preferences_t tmp[1];
+  int any_changes = 0;
+
   enter;
 
   {
     su_home_t tmphome[1] = { SU_HOME_INIT(tmphome) };
     nua_handle_preferences_t *nhp = nh->nh_prefs;
     nua_handle_preferences_t const *dnhp = dnh->nh_prefs;
-    nua_handle_preferences_t tmp[1];
     nua_global_preferences_t gtmp[1], *ngp = NULL;
 
     *tmp = *nhp; NHP_UNSET_ALL(tmp);
@@ -521,7 +513,7 @@
       status = 900, phrase = "Error storing default handle parameters";
     else if (nhp_set_tags(tmphome, tmp, ngp, tags) < 0)
       status = 900, phrase = "Error storing parameters";
-    else if (nhp_save_params(nh, tmphome, ngp, tmp) < 0)
+    else if ((any_changes = nhp_save_params(nh, tmphome, ngp, tmp)) < 0)
       status = 900, phrase = su_strerror(ENOMEM);
     else
       status = 200, phrase = "OK", nh->nh_used_ptags = 1;
@@ -562,7 +554,8 @@
     if (nua_stack_set_smime_params(nua, tags) < 0) {
       status = 900, phrase = "Error setting S/MIME parameters";
     }
-    else if (nua->nua_nta && nta_agent_set_params(nua->nua_nta, TAG_NEXT(tags)) < 0) {
+    else if (nua->nua_nta &&
+	     nta_agent_set_params(nua->nua_nta, TAG_NEXT(tags)) < 0) {
       status = 900, phrase = "Error setting NTA parameters";
     }
     else {
@@ -581,6 +574,18 @@
   else {
     if (e == nua_r_set_params)
       UA_EVENT2(e, status, phrase);
+
+    if (any_changes) {
+      nua_handle_preferences_t changed[1];
+
+      *changed = *nh->nh_prefs;
+      memcpy(&changed->nhp_set_, &tmp->nhp_set_, sizeof changed->nhp_set_);
+
+      nua_dialog_update_params(nh->nh_ds,
+			       changed,
+			       nh->nh_prefs,
+			       dnh->nh_prefs);
+    }
     return 0;
   }
 }
@@ -612,11 +617,10 @@
   }
 
 /* Set copy of string from url to handle pref structure */
-#define NHP_SET_STR_BY_URL(nhp, name, v)			 \
+#define NHP_SET_STR_BY_URL(nhp, type, name, v)			 \
   if ((v) != (tag_value_t)-1) {					 \
     url_t const *_value = (url_t const *)(v);			 \
-    char *_new;							 \
-    _new = url_as_string(home, (void *)_value);			 \
+    type *_new = (type *)url_as_string(home, (void *)_value);	 \
     if (NHP_ISSET(nhp, name))					 \
       su_free(home, (void *)nhp->nhp_##name);			 \
     NHP_SET(nhp, name, _new);					 \
@@ -953,7 +957,7 @@
     }
     /* NUTAG_REGISTRAR(registrar) */
     else if (tag == nutag_registrar) {
-      NHP_SET_STR_BY_URL(nhp, registrar, value);
+      NHP_SET_STR_BY_URL(nhp, char, registrar, value);
       if (NHP_ISSET(nhp, registrar) && !str0cmp(nhp->nhp_registrar, "*"))
 	NHP_SET_STR(nhp, registrar, 0);
     }
@@ -981,6 +985,10 @@
     else if (tag == nutag_outbound) {
       NHP_SET_STR(nhp, outbound, value);
     }
+    /* NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) */
+    else if (tag == ntatag_default_proxy) {
+      NHP_SET_STR_BY_URL(nhp, url_string_t, proxy, value);
+    }
     /* NUTAG_DETECT_NETWORK_UPDATES(detect_network_updates) */
     else if (ngp && tag == nutag_detect_network_updates) {
       int detector = (int)value;
@@ -1070,6 +1078,10 @@
 }
 
 /** Save parameters in @a gtmp and @a tmp.
+ *
+ * @retval 1 - parameters were changed
+ * @retval 0 - no changes in parameters
+ * @retval -1 - an error
  */
 static 
 int nhp_save_params(nua_handle_t *nh,
@@ -1132,7 +1144,7 @@
 
   nh->nh_prefs = dst;
   
-  return 0;
+  return memcmp(dst, old, sizeof *dst) != 0;
 }
 
 static int nua_handle_tags_filter(tagi_t const *f, tagi_t const *t);
@@ -1141,21 +1153,6 @@
 /** Save taglist to a handle */
 int nua_handle_save_tags(nua_handle_t *nh, tagi_t *tags)
 {
-#if HAVE_OPEN_C
-  /* Nice. An old symbian compiler */
-  tagi_t tagfilter[2];
-  tagi_t paramfilter[2];
-#else
-  tagi_t const tagfilter[] = {
-    { TAG_FILTER(nua_handle_tags_filter) },
-    { TAG_NULL() }
-  };
-  tagi_t const paramfilter[] = {
-    { TAG_FILTER(nua_handle_param_filter) },
-    { TAG_NULL() }
-  };
-#endif
-
   /* Initialization parameters */
   url_string_t const *url = NULL;
   sip_to_t const *p_to = NULL;
@@ -1171,6 +1168,10 @@
   int error;
 
 #if HAVE_OPEN_C
+  /* Nice. An old symbian compiler */
+  tagi_t tagfilter[2];
+  tagi_t paramfilter[2];
+
   tagfilter[0].t_tag = tag_filter;
   tagfilter[0].t_value = tag_filter_v(nua_handle_tags_filter);
   tagfilter[1].t_tag = (tag_type_t)0;
@@ -1180,6 +1181,16 @@
   paramfilter[0].t_value = tag_filter_v(nua_handle_param_filter);
   paramfilter[1].t_tag = (tag_type_t)0;
   paramfilter[1].t_value = (tag_value_t)0;
+
+#else
+  tagi_t const tagfilter[] = {
+    { TAG_FILTER(nua_handle_tags_filter) },
+    { TAG_NULL() }
+  };
+  tagi_t const paramfilter[] = {
+    { TAG_FILTER(nua_handle_param_filter) },
+    { TAG_NULL() }
+  };
 #endif
 
   for (t = tags; t; t = tl_next(t)) {
@@ -1525,7 +1536,7 @@
   nua_handle_t *dnh = nua->nua_dhandle;
   nua_global_preferences_t const *ngp = nua->nua_prefs;
   nua_handle_preferences_t const *nhp = nh->nh_prefs;
-
+  nua_handle_preferences_t const nhp_zero[1] = {{ 0 }};
   tagi_t *lst;
 
   int has_from;
@@ -1549,18 +1560,19 @@
 
   enter;
 
-  nta_agent_get_params(nua->nua_nta,
-		       NTATAG_UDP_MTU_REF(udp_mtu),
-		       NTATAG_MAX_PROCEEDING_REF(max_proceeding),
-		       NTATAG_SIP_T1_REF(sip_t1),
-		       NTATAG_SIP_T2_REF(sip_t2),
-		       NTATAG_SIP_T4_REF(sip_t4),
-		       NTATAG_SIP_T1X64_REF(sip_t1x64),
-		       NTATAG_DEBUG_DROP_PROB_REF(debug_drop_prob),
-		       NTATAG_DEFAULT_PROXY_REF(proxy),
-		       NTATAG_ALIASES_REF(aliases),
-		       NTATAG_SIPFLAGS_REF(flags),
-		       TAG_END());
+  if (nh == dnh)
+    nta_agent_get_params(nua->nua_nta,
+			 NTATAG_UDP_MTU_REF(udp_mtu),
+			 NTATAG_MAX_PROCEEDING_REF(max_proceeding),
+			 NTATAG_SIP_T1_REF(sip_t1),
+			 NTATAG_SIP_T2_REF(sip_t2),
+			 NTATAG_SIP_T4_REF(sip_t4),
+			 NTATAG_SIP_T1X64_REF(sip_t1x64),
+			 NTATAG_DEBUG_DROP_PROB_REF(debug_drop_prob),
+			 NTATAG_DEFAULT_PROXY_REF(proxy),
+			 NTATAG_ALIASES_REF(aliases),
+			 NTATAG_SIPFLAGS_REF(flags),
+			 TAG_END());
 
   if (nh->nh_ds->ds_local)
     has_from = 1, *from = *nh->nh_ds->ds_local, from->a_params = NULL;
@@ -1597,6 +1609,9 @@
 	     ? sip_##pref##_make(tmphome, (char *)nhp->nhp_##pref)	\
 	     : NULL))
 
+  if (nh != dnh && nhp == dnh->nh_prefs)
+    nhp = nhp_zero;
+
   su_home_auto(tmphome, sizeof(tmphome));
 
   lst = tl_filtered_tlist
@@ -1669,6 +1684,10 @@
      TIF(NUTAG_M_FEATURES, m_features),
      TIF(NUTAG_OUTBOUND, outbound),
 
+     /* Handle-specific proxy */
+     TAG_IF(nh != dnh && nhp->nhp_set.nhb_proxy,
+	    NUTAG_PROXY(nhp->nhp_proxy)),
+
      /* Skip user-agent-level parameters if parameters are for handle only */
      TAG_IF(nh != dnh, TAG_NEXT(media_params)),
 
@@ -1693,12 +1712,13 @@
 #endif
 
      NTATAG_UDP_MTU(udp_mtu),
-	 NTATAG_MAX_PROCEEDING(max_proceeding),
+     NTATAG_MAX_PROCEEDING(max_proceeding),
      NTATAG_SIP_T1(sip_t1),
      NTATAG_SIP_T2(sip_t2),
      NTATAG_SIP_T4(sip_t4),
      NTATAG_SIP_T1X64(sip_t1x64),
      NTATAG_DEBUG_DROP_PROB(debug_drop_prob),
+     /* Stack-wide proxy */
      NTATAG_DEFAULT_PROXY(proxy),
      NTATAG_ALIASES(aliases),
      NTATAG_SIPFLAGS(flags),

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h	Thu May 22 15:05:28 2008
@@ -35,6 +35,8 @@
  * @date Created: Wed Mar  8 11:38:18 EET 2006  ppessi
  */
 
+#include <nua_types.h>
+
 /**@internal @brief NUA preferences. 
  *
  * This structure contains values for various preferences and a separate
@@ -50,7 +52,7 @@
  *
  * @see NHP_GET(), NH_PGET(), NHP_ISSET(), NH_PISSET()
  */
-typedef struct nua_handle_preferences
+struct nua_handle_preferences
 {
   unsigned         nhp_retry_count;	/**< times to retry a request */
   unsigned         nhp_max_subscriptions;
@@ -133,6 +135,9 @@
   /** Initial route set */
   sip_route_t        *nhp_initial_route;
 
+  /** Next hop URI (used instead of route). */
+  url_string_t       *nhp_proxy;
+
   union { struct {
     /* A bit for each feature set by application */
     /* NOTE: 
@@ -191,16 +196,17 @@
     unsigned nhb_outbound:1;
     unsigned nhb_appl_method:1;
     unsigned nhb_initial_route:1;
+    unsigned nhb_proxy:1;
     unsigned :0;
   } set_bits; 
     unsigned set_unsigned[2];
   } nhp_set_;
-} nua_handle_preferences_t;
+};
 
 #define nhp_set nhp_set_.set_bits
 
 /** Global preferences for nua. */
-typedef struct {
+struct nua_global_preferences {
   /** Network detection: NONE, INFORMAL, TRY_FULL */
   signed int ngp_detect_network_updates:3;
   /** Pass events during shutdown, too */
@@ -215,7 +221,7 @@
   } set_bits; 
     unsigned set_unsigned[2];
   } ngp_set_;
-} nua_global_preferences_t;
+};
 
 #define ngp_set ngp_set_.set_bits
 
@@ -238,7 +244,7 @@
 
 /* Get preference from handle, if set, otherwise from default handle */
 #define NH_PGET(nh, pref)						\
-  NHP_GET((nh)->nh_prefs, (nh)->nh_nua->nua_dhandle->nh_prefs, pref)
+  NHP_GET((nh)->nh_prefs, (nh)->nh_dprefs, pref)
 
 /* Get preference from handle, if exists and set, 
    otherwise from default handle */
@@ -255,7 +261,7 @@
   (NHP_ISSET((nh)->nh_prefs, pref) &&					\
    (nh)->nh_nua->nua_dhandle->nh_prefs != (nh)->nh_prefs)
 
-/* Check if preference has been set by applicationx */
+/* Check if preference has been set by application */
 #define NUA_PISSET(nua, nh, pref)					\
   (NHP_ISSET((nua)->nua_dhandle->nh_prefs, pref) ||			\
    ((nh) && NHP_ISSET((nh)->nh_prefs, pref)))

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c	Thu May 22 15:05:28 2008
@@ -79,6 +79,7 @@
     nua_publish_usage_add,
     nua_publish_usage_remove,
     nua_publish_usage_name,
+    nua_base_usage_update_params,
     NULL,
     nua_publish_usage_refresh,
     nua_publish_usage_shutdown,

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c	Thu May 22 15:05:28 2008
@@ -107,6 +107,10 @@
 				      nua_dialog_usage_t *du,
 				      nua_client_request_t *cr,
 				      nua_server_request_t *sr);
+static void nua_register_usage_update_params(nua_dialog_usage_t const *du,
+					     nua_handle_preferences_t const *,
+					     nua_handle_preferences_t const *,
+					     nua_handle_preferences_t const *);
 static void nua_register_usage_peer_info(nua_dialog_usage_t *du,
 					 nua_dialog_state_t const *ds,
 					 sip_t const *sip);
@@ -169,6 +173,7 @@
     nua_register_usage_add,
     nua_register_usage_remove,
     nua_register_usage_name,
+    nua_register_usage_update_params,
     nua_register_usage_peer_info,
     nua_register_usage_refresh,
     nua_register_usage_shutdown
@@ -672,6 +677,11 @@
 			     NH_PGET(nh, instance));
     if (!nr->nr_ob)
       return nua_client_return(cr, 900, "Cannot create outbound", msg);
+
+    nua_register_usage_update_params(du,
+				     NULL,
+				     nh->nh_prefs,
+				     nh->nh_dprefs);
   }
 
   if (nr->nr_ob) {
@@ -687,13 +697,6 @@
 	unreg = 1;	/* All contacts have expires=0 */
     }
 
-    outbound_set_options(ob,
-			 NH_PGET(nh, outbound),
-			 NH_PGET(nh, keepalive),
-			 NH_PISSET(nh, keepalive_stream)
-			 ? NH_PGET(nh, keepalive_stream)
-			 : NH_PGET(nh, keepalive));
-
     if (outbound_set_contact(ob, sip->sip_contact, nr->nr_via, unreg) < 0)
       return nua_client_return(cr, 900, "Cannot set outbound contact", msg);
   }
@@ -712,6 +715,7 @@
   sip_contact_t *m, *contacts = sip->sip_contact;
   char const *min_expires = NULL;
   int unreg;
+  tport_t *tport = NULL;
 
   (void)nh;
 
@@ -755,6 +759,8 @@
       if (previous)
 	sip_add_dup(msg, sip, (sip_header_t *)previous);
     }
+
+    tport = nr->nr_tport;
   }
 
   for (m = sip->sip_contact; m; m = m->m_next) {
@@ -789,7 +795,7 @@
 				  TAG_IF(unreg, NTATAG_SIGCOMP_CLOSE(1)),
 				  TAG_IF(!unreg, NTATAG_COMP("sigcomp")),
 #endif
-				  NTATAG_TPORT(nr->nr_tport),
+				  NTATAG_TPORT(tport),
 				  TAG_NEXT(tags));
 }
 
@@ -1038,6 +1044,42 @@
   nua_dialog_usage_set_refresh_range(du, 0, 0);
 }
 
+static void
+nua_register_usage_update_params(nua_dialog_usage_t const *du,
+				 nua_handle_preferences_t const *changed,
+				 nua_handle_preferences_t const *nhp,
+				 nua_handle_preferences_t const *dnhp)
+{
+  nua_registration_t *nr = nua_dialog_usage_private(du);
+  outbound_t *ob = nr->nr_ob;
+
+  if (!ob)
+    return;
+
+  if (!changed ||
+      NHP_ISSET(changed, outbound) ||
+      NHP_ISSET(changed, keepalive) ||
+      NHP_ISSET(changed, keepalive_stream)) {
+    char const *outbound =
+      NHP_ISSET(nhp, outbound) ? nhp->nhp_outbound
+      : dnhp->nhp_outbound;
+    unsigned keepalive =
+      NHP_ISSET(nhp, keepalive) ? nhp->nhp_keepalive
+      : dnhp->nhp_keepalive;
+    unsigned keepalive_stream =
+      NHP_ISSET(nhp, keepalive_stream) ? nhp->nhp_keepalive_stream
+      : NHP_ISSET(dnhp, keepalive_stream) ? nhp->nhp_keepalive_stream
+      : keepalive;
+
+    outbound_set_options(ob, outbound, keepalive, keepalive_stream);
+  }
+
+  if (!changed || NHP_ISSET(changed, proxy)) {
+    if (NHP_ISSET(nhp, proxy))
+      outbound_set_proxy(ob, nhp->nhp_proxy);
+  }
+}
+
 
 static void nua_register_usage_refresh(nua_handle_t *nh,
 				       nua_dialog_state_t *ds,

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c	Thu May 22 15:05:28 2008
@@ -207,6 +207,7 @@
     nua_session_usage_add,
     nua_session_usage_remove,
     nua_session_usage_name,
+    nua_base_usage_update_params,
     NULL,
     nua_session_usage_refresh,
     nua_session_usage_shutdown
@@ -335,9 +336,6 @@
 /* ======================================================================== */
 /* INVITE and call (session) processing */
 
-int nua_stack_prack(nua_t *nua, nua_handle_t *nh, nua_event_t e,
-		    tagi_t const *tags);
-
 static int session_timer_is_supported(struct session_timer const *t);
 
 static void session_timer_preferences(struct session_timer *t,
@@ -1206,6 +1204,8 @@
   sip_authorization_t *wa;
   sip_proxy_authorization_t *pa;
   sip_cseq_t *cseq;
+  int proxy_is_set;
+  url_string_t *proxy;
   nta_outgoing_t *ack;
   int status = 200;
   char const *phrase = "OK", *reason = NULL;
@@ -1314,9 +1314,14 @@
       }
     }
     
+    proxy_is_set = NH_PISSET(nh, proxy);
+    proxy = NH_PGET(nh, proxy);
+
     if ((ack = nta_outgoing_mcreate(nh->nh_nua->nua_nta, NULL, NULL, NULL,
 				    msg,
 				    NTATAG_ACK_BRANCH(invite_branch),
+				    TAG_IF(proxy_is_set,
+					   NTATAG_DEFAULT_PROXY(proxy)),
 				    SIPTAG_END(),
 				    TAG_NEXT(tags)))) {
       /* TR engine keeps this around for T2 so it catches all 2XX retransmissions  */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c	Thu May 22 15:05:28 2008
@@ -2541,8 +2541,9 @@
 
   /**
    * Next, values previously set with nua_set_params() or nua_set_hparams()
-   * are used: @Allow, @Supported, @Organization, and @UserAgent headers are
-   * added to the request if they are not already set. 
+   * are used: @Allow, @Supported, @Organization, @UserAgent and
+   * @AllowEvents headers are added to the request if they are not already
+   * set.
    */
   if (!sip->sip_allow)
     sip_add_dup(msg, sip, (sip_header_t*)NH_PGET(nh, allow));
@@ -2561,6 +2562,20 @@
   if (!sip->sip_user_agent && NH_PGET(nh, user_agent))
     sip_add_make(msg, sip, sip_user_agent_class, NH_PGET(nh, user_agent));
 
+  /** Any node implementing one or more event packages SHOULD include an
+   * appropriate @AllowEvents header indicating all supported events in
+   * all methods which initiate dialogs and their responses (such as
+   * INVITE) and OPTIONS responses.
+   */
+  if (!sip->sip_allow_events &&
+      NH_PGET(nh, allow_events) &&
+      (method == sip_method_notify || /* Always in NOTIFY */
+       (!ds->ds_remote_tag &&	      /* And in initial requests */
+	(method == sip_method_subscribe || method == sip_method_refer ||
+	 method == sip_method_options ||
+	 method == sip_method_invite))))
+    sip_add_dup(msg, sip, (void *)NH_PGET(nh, allow_events));
+
   /**
    * Next, the stack generates a @Contact header for the request (unless
    * the application already gave a @Contact header or it does not want to
@@ -2633,6 +2648,8 @@
 			    tagi_t const *tags)
 {
   nua_handle_t *nh = cr->cr_owner;
+  int proxy_is_set = NH_PISSET(nh, proxy);
+  url_string_t * proxy = NH_PGET(nh, proxy);
 
   if (nh->nh_auth) {
     if (cr->cr_challenged || 
@@ -2648,6 +2665,8 @@
 				    nua_client_orq_response, cr,
 				    NULL, 
 				    msg,
+				    TAG_IF(proxy_is_set,
+					   NTATAG_DEFAULT_PROXY(proxy)),
 				    TAG_NEXT(tags));
 
   return cr->cr_orq ? 0 : -1;

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h	Thu May 22 15:05:28 2008
@@ -154,6 +154,7 @@
   nua_handle_t   *nh_identity;	/**< Identity */
 
   nua_handle_preferences_t *nh_prefs; /**< Preferences */
+#define nh_dprefs nh_nua->nua_dhandle->nh_prefs
 
   /* Handle type is determined by special event and flags. */
   nua_event_t     nh_special;	/**< Special event */
@@ -431,8 +432,6 @@
 
 /* ---------------------------------------------------------------------- */
 
-typedef unsigned longlong ull;
-
 #define SET_STATUS(_status, _phrase) status = _status, phrase = _phrase
 
 #define SET_STATUS2(_status, _phrase) status = _status, phrase = _phrase

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c	Thu May 22 15:05:28 2008
@@ -91,6 +91,7 @@
     nua_subscribe_usage_add,
     nua_subscribe_usage_remove,
     nua_subscribe_usage_name,
+    nua_base_usage_update_params,
     NULL,
     nua_subscribe_usage_refresh,
     nua_subscribe_usage_shutdown

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c	Thu May 22 15:05:28 2008
@@ -598,6 +598,8 @@
  * Retry count determines how many times stack will automatically retry
  * after an recoverable error response, like 302, 401 or 407.
  *
+ * Note that the first request does not count as retry.
+ *
  * @par Used with
  *    nua_create(), nua_set_params(), nua_handle(), nua_set_hparams(),
  *    nua_get_params(), nua_get_hparams(),
@@ -613,7 +615,9 @@
  *    unsigned
  *
  * @par Values
- *    @c 0   Never retry automatically \n
+ * - 0 - Never retry automatically \n
+ * - Otherwise, number of extra transactions initiated after initial
+ *   transaction failed with recoverable error response
  *
  * @NEW_1_12_4.
  *

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c	Thu May 22 15:05:28 2008
@@ -104,8 +104,8 @@
   unsigned ob_registering:1;
   /** 2XX response to REGISTER containg ob_rcontact has been received */
   unsigned ob_registered:1;
-  /**The registration has been validated:
-   * We have successfully sent OPTIONS to ourselves.
+  /** The registration has been validated:
+   *  We have successfully sent OPTIONS to ourselves.
    */
   unsigned ob_validated:1;
   /** The registration has been validated once.
@@ -113,8 +113,11 @@
    *   up if OPTIONS probe fails.
    */
   unsigned ob_once_validated:1;
+
+  unsigned ob_proxy_override:1;	/**< Override stack default proxy */
   unsigned :0;
 
+  url_string_t *ob_proxy;	/**< Outbound-specific proxy */
   char const *ob_instance;	/**< Our instance ID */
   int32_t ob_reg_id;		/**< Flow-id */
   sip_contact_t *ob_rcontact;	/**< Our contact */
@@ -209,10 +212,11 @@
     ob->ob_nta = agent;
 
     if (instance)
-      ob->ob_instance = su_strcat_all(ob->ob_home, "+sip.instance=\"<", instance, ">\"", NULL);
+      ob->ob_instance =
+	su_sprintf(ob->ob_home, "+sip.instance=\"<%s>\"", instance);
     ob->ob_reg_id = 0;
 
-    /* Generate a cookie (used as Call-ID) for us */
+    /* Generate a random cookie (used as Call-ID) for us */
     su_md5_init(md5);
     su_guid_generate(guid);
     if (instance)
@@ -246,16 +250,23 @@
 
 /** Set various outbound and nat-traversal related options. */
 int outbound_set_options(outbound_t *ob,
-			 char const *options,
+			 char const *_options,
 			 unsigned interval,
 			 unsigned stream_interval)
 {
   struct outbound_prefs prefs[1] = {{ 0 }};
-  char const *s;
+  char *s, *options = su_strdup(NULL, _options);
+  int invalid;
 
   prefs->interval = interval;
   prefs->stream_interval = stream_interval;
 
+#define MATCH(v) (len == sizeof(#v) - 1 && strncasecmp(#v, s, len) == 0)
+
+  if (options) {
+    for (s = options; s[0]; s++) if (s[0] == '-') s[0] = '_';
+  }
+
   prefs->gruuize = 1;
   prefs->outbound = 0;
   prefs->natify = 1;
@@ -263,17 +274,11 @@
   prefs->validate = 1;
   prefs->use_rport = 1;
 
-#define MATCH(v) (len == sizeof(#v) - 1 && strncasecmp(#v, s, len) == 0)
-
   for (s = options; s && s[0]; ) {
     size_t len = span_token(s);
     int value = 1;
 
-    if (len > 3 && strncasecmp(s, "no-", 3) == 0)
-      value = 0, s += 3, len -= 3;
-    else if (len > 4 && strncasecmp(s, "not-", 4) == 0)
-      value = 0, s += 4, len -= 4;
-    else if (len > 3 && strncasecmp(s, "no_", 3) == 0)
+    if (len > 3 && strncasecmp(s, "no_", 3) == 0)
       value = 0, s += 3, len -= 3;
     else if (len > 4 && strncasecmp(s, "not_", 4) == 0)
       value = 0, s += 4, len -= 4;
@@ -284,14 +289,12 @@
     else if (MATCH(outbound)) prefs->outbound = value;
     else if (MATCH(natify)) prefs->natify = value;
     else if (MATCH(validate)) prefs->validate = value;
-    else if (MATCH(options-keepalive)) prefs->okeepalive = value;
     else if (MATCH(options_keepalive)) prefs->okeepalive = value;
-    else if (MATCH(use-connect)) prefs->use_connect = value;
     else if (MATCH(use_connect)) prefs->use_connect = value;
-    else if (MATCH(use-rport) || MATCH(use_rport)) prefs->use_rport = value;
-    else if (MATCH(use-socks) || MATCH(use_socks)) prefs->use_socks = value;
-    else if (MATCH(use-upnp) || MATCH(use_upnp)) prefs->use_upnp = value;
-    else if (MATCH(use-stun) || MATCH(use_stun)) prefs->use_stun = value;
+    else if (MATCH(use_rport)) prefs->use_rport = value;
+    else if (MATCH(use_socks)) prefs->use_socks = value;
+    else if (MATCH(use_upnp)) prefs->use_upnp = value;
+    else if (MATCH(use_stun)) prefs->use_stun = value;
     else
       SU_DEBUG_1(("outbound(%p): unknown option \"%.*s\"\n",
 		  (void *)ob->ob_owner, (int)len, s));
@@ -303,7 +306,10 @@
     s += len;
   }
 
-  if (s && s[0]) {
+  invalid = s && s[0];
+  su_free(NULL, options);
+
+  if (invalid) {
     SU_DEBUG_1(("outbound(%p): invalid options \"%s\"\n", 
 		(void *)ob->ob_owner, options));
     return -1;
@@ -326,6 +332,25 @@
   return 0;
 }
 
+/** Override stack default proxy for outbound */
+int outbound_set_proxy(outbound_t *ob,
+		       url_string_t *proxy)
+{
+  url_string_t *new_proxy = NULL, *old_proxy = ob->ob_proxy;
+
+  if (proxy)
+    new_proxy = (url_string_t *)url_as_string(ob->ob_home, proxy->us_url);
+
+  if (proxy == NULL || new_proxy != NULL) {
+    ob->ob_proxy_override = 1;
+    ob->ob_proxy = new_proxy;
+    su_free(ob->ob_home, old_proxy);
+    return 0;
+  }
+
+  return -1;
+}
+
 /* ---------------------------------------------------------------------- */
 
 /** Obtain contacts for REGISTER */
@@ -784,6 +809,8 @@
 			 ob,
 			 NULL,
 			 req,
+			 TAG_IF(ob->ob_proxy_override,
+				NTATAG_DEFAULT_PROXY(ob->ob_proxy)),
 			 TAG_END());
 
   if (!ob->ob_keepalive.orq)
@@ -949,6 +976,8 @@
 			 ob,
 			 NULL,
 			 req,
+			 TAG_IF(ob->ob_proxy_override,
+				NTATAG_DEFAULT_PROXY(ob->ob_proxy)),
 			 SIPTAG_SUBJECT_STR("REGISTRATION PROBE"),
 			 /* NONE is used to remove
 			    Max-Forwards: 0 found in ordinary keepalives */

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.h	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.h	Thu May 22 15:05:28 2008
@@ -70,6 +70,9 @@
 			 unsigned dgram_interval,
 			 unsigned stream_interval);
 
+int outbound_set_proxy(outbound_t *ob,
+		       url_string_t *proxy);
+
 int outbound_get_contacts(outbound_t *ob, 
 			  sip_contact_t **return_current_contact, 
 			  sip_contact_t **return_previous_contact);

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c	Thu May 22 15:05:28 2008
@@ -2190,6 +2190,8 @@
   return c;
 }
 
+uint16_t _sres_default_port = 53;
+
 /** Parse config file. 
  *
  * @return Number of search domains, if successful.
@@ -2212,7 +2214,7 @@
   c->c_opt.check_names = 1;
   c->c_opt.timeout = SRES_RETRY_INTERVAL;
   c->c_opt.attempts = SRES_MAX_RETRY_COUNT;
-  c->c_port = 53;
+  c->c_port = _sres_default_port;
 
   if (f != NULL) {  
     for (line = 1; fgets(buf, sizeof(buf), f); line++) {

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am	Thu May 22 15:05:28 2008
@@ -1,35 +1,63 @@
 #
-# Tests using check
+# Makefile.am for Sofia SIP tests
 #
+# Copyright (C) 2007,2008 Nokia Corporation
+# Contact: Pekka Pessi <pekka.pessi at nokia.com>
+# Licensed under LGPL. See file COPYING.
+
+TESTS = test_nua
+check_PROGRAMS = test_nua
 
 EXTRA_DIST = check_sofia.h check_sofia.c suite_for_nua.c
 
-TESTS =
-tests_PROGRAMS =
-testsdir := ${libdir}/tests/libsofia-sip-ua-tests
+test_nua_SOURCES = 	test_nua.c
 
-include $(top_srcdir)/rules/sofia.am
+test_nua_LDADD =	$(check_LIBRARIES) \
+			${sofiabuilddir}/libsofia-sip-ua.la
 
-INCLUDES = ${INTERNAL_INCLUDES}
+check_LIBRARIES =   	libtestnua.a libtestproxy.a libtestnat.a
 
-AM_CFLAGS += @CHECK_CFLAGS@
+libtestnua_a_SOURCES =	test_nua.h test_ops.c \
+			test_init.c \
+			test_nua_api.c test_nua_params.c \
+			test_register.c test_basic_call.c \
+			test_offer_answer.c \
+			test_call_reject.c test_cancel_bye.c \
+			test_call_hold.c test_session_timer.c \
+			test_refer.c test_100rel.c \
+			test_simple.c test_sip_events.c \
+			test_extension.c
 
-if HAVE_CHECK
+libtestproxy_a_SOURCES = test_proxy.h test_proxy.c
+
+libtestnat_a_SOURCES =	test_nat.h test_nat.c test_nat_tags.c
 
+#
+# Install in special test package
+#
+testsdir = 		${libdir}/tests/libsofia-sip-ua-tests
+tests_PROGRAMS =
+
+if HAVE_CHECK
 TESTS += check_sofia
 tests_PROGRAMS += check_sofia
+endif
+
+check_sofia_CFLAGS = @CHECK_CFLAGS@
+
 
 check_sofia_SOURCES = check_sofia.c check_sofia.h \
 	suite_for_nua.c
 
-CHECKLIBS = ${sofiabuilddir}/nua/libtestnua.la \
-	${sofiabuilddir}/nua/libtestproxy.la \
-	${sofiabuilddir}/nua/libtestnat.la
-
-$(CHECKLIBS):
-	cd ${sofiabuilddir}/nua && make checklib
-
-check_sofia_LDADD = \
-	$(CHECKLIBS) ${sofiabuilddir}/libsofia-sip-ua.la \
-	@CHECK_LIBS@
-endif
+check_sofia_LDADD = 	$(check_LIBRARIES) \
+			${sofiabuilddir}/libsofia-sip-ua.la \
+			@CHECK_LIBS@
+
+CLEANFILES =            tmp_sippasswd.??????
+
+# ----------------------------------------------------------------------
+# Sofia specific rules
+
+include $(top_srcdir)/rules/sofia.am
+
+INCLUDES = ${INTERNAL_INCLUDES}

Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/suite_for_nua.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/suite_for_nua.c	(original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/suite_for_nua.c	Thu May 22 15:05:28 2008
@@ -22,7 +22,7 @@
  *
  */
 
-/**@CFILE check_sofia.c
+/**@CFILE suite_for_nua.c
  *
  * @brief Check-driven tester for Sofia SIP User Agent library
  *



More information about the Freeswitch-svn mailing list