[Freeswitch-branches] [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:29 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_