[Freeswitch-branches] [commit] r5425 - in freeswitch/branches/greenlizard: . libs/sofia-sip libs/sofia-sip/libsofia-sip-ua/docs libs/sofia-sip/libsofia-sip-ua/http/sofia-sip libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip libs/sofia-sip/libsofia-sip-ua/msg libs/sofia-sip/libsofia-sip-ua/nta libs/sofia-sip/libsofia-sip-ua/nth libs/sofia-sip/libsofia-sip-ua/nth/sofia-sip libs/sofia-sip/libsofia-sip-ua/nua libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip libs/sofia-sip/libsofia-sip-ua/sip libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip libs/sofia-sip/libsofia-sip-ua/soa libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip libs/sofia-sip/libsofia-sip-ua/su libs/sofia-sip/libsofia-sip-ua/su/sofia-sip libs/sofia-sip/libsofia-sip-ua/tport libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip libs/sofia-sip/libsofia-sip-ua/url libs/sofia-sip/m4 src src/include src/mod/applications/mod_commands src/mod/applications/mod_conference src/mod/applications/mod_dptools src/mod/applications/mod_enum src/mod/applications/mod_esf src/mod/applications/mod_rss src/mod/asr_tts/mod_cepstral src/mod/codecs/mod_amr src/mod/codecs/mod_g711 src/mod/codecs/mod_g722 src/mod/codecs/mod_g723_1 src/mod/codecs/mod_g726 src/mod/codecs/mod_g729 src/mod/codecs/mod_gsm src/mod/codecs/mod_h26x src/mod/codecs/mod_ilbc src/mod/codecs/mod_l16 src/mod/codecs/mod_speex src/mod/dialplans/mod_dialplan_directory src/mod/dialplans/mod_dialplan_xml src/mod/directories/mod_ldap src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_portaudio src/mod/endpoints/mod_sofia src/mod/endpoints/mod_wanpipe src/mod/endpoints/mod_woomera src/mod/event_handlers/mod_cdr src/mod/event_handlers/mod_event_multicast src/mod/event_handlers/mod_event_socket src/mod/event_handlers/mod_event_test src/mod/event_handlers/mod_radius_cdr src/mod/event_handlers/mod_xmpp_event src/mod/event_handlers/mod_zeroconf src/mod/formats/mod_native_file src/mod/formats/mod_sndfile src/mod/languages/mod_perl src/mod/languages/mod_spidermonkey src/mod/loggers/mod_console src/mod/say/mod_say_en src/mod/timers/mod_softtimer src/mod/xml_int/mod_xml_cdr src/mod/xml_int/mod_xml_curl src/mod/xml_int/mod_xml_rpc

Freeswitch SVN greenlizard at freeswitch.org
Wed Jun 20 13:06:08 EDT 2007


Author: greenlizard
Date: Wed Jun 20 13:06:05 2007
New Revision: 5425

Modified:
   freeswitch/branches/greenlizard/Freeswitch.sln
   freeswitch/branches/greenlizard/libs/sofia-sip/Makefile.am
   freeswitch/branches/greenlizard/libs/sofia-sip/RELEASE
   freeswitch/branches/greenlizard/libs/sofia-sip/configure.ac
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/docs/hide_emails.sh
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_tag.h.in
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nth/sofia-sip/nth_tag.h
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_init.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.h
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_refer.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_tag.h
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_configure.h.in
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_io.h
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/su.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c
   freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/url/torture_url.c
   freeswitch/branches/greenlizard/libs/sofia-sip/m4/sac-su2.m4
   freeswitch/branches/greenlizard/src/include/switch.h
   freeswitch/branches/greenlizard/src/include/switch_event.h
   freeswitch/branches/greenlizard/src/include/switch_loadable_module.h
   freeswitch/branches/greenlizard/src/include/switch_log.h
   freeswitch/branches/greenlizard/src/include/switch_types.h
   freeswitch/branches/greenlizard/src/mod/applications/mod_commands/mod_commands.c
   freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/branches/greenlizard/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/branches/greenlizard/src/mod/applications/mod_enum/mod_enum.c
   freeswitch/branches/greenlizard/src/mod/applications/mod_esf/mod_esf.c
   freeswitch/branches/greenlizard/src/mod/applications/mod_rss/mod_rss.c
   freeswitch/branches/greenlizard/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
   freeswitch/branches/greenlizard/src/mod/codecs/mod_amr/mod_amr.c
   freeswitch/branches/greenlizard/src/mod/codecs/mod_g711/mod_g711.c
   freeswitch/branches/greenlizard/src/mod/codecs/mod_g722/mod_g722.c
   freeswitch/branches/greenlizard/src/mod/codecs/mod_g723_1/mod_g723_1.c
   freeswitch/branches/greenlizard/src/mod/codecs/mod_g726/mod_g726.c
   freeswitch/branches/greenlizard/src/mod/codecs/mod_g729/mod_g729.c
   freeswitch/branches/greenlizard/src/mod/codecs/mod_gsm/mod_gsm.c
   freeswitch/branches/greenlizard/src/mod/codecs/mod_h26x/mod_h26x.c
   freeswitch/branches/greenlizard/src/mod/codecs/mod_ilbc/mod_ilbc.c
   freeswitch/branches/greenlizard/src/mod/codecs/mod_l16/mod_l16.c
   freeswitch/branches/greenlizard/src/mod/codecs/mod_speex/mod_speex.c
   freeswitch/branches/greenlizard/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
   freeswitch/branches/greenlizard/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
   freeswitch/branches/greenlizard/src/mod/directories/mod_ldap/mod_ldap.c
   freeswitch/branches/greenlizard/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c
   freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.h
   freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c
   freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c
   freeswitch/branches/greenlizard/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
   freeswitch/branches/greenlizard/src/mod/endpoints/mod_woomera/mod_woomera.c
   freeswitch/branches/greenlizard/src/mod/event_handlers/mod_cdr/mod_cdr.cpp
   freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
   freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
   freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_test/mod_event_test.c
   freeswitch/branches/greenlizard/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
   freeswitch/branches/greenlizard/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c
   freeswitch/branches/greenlizard/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c
   freeswitch/branches/greenlizard/src/mod/formats/mod_native_file/mod_native_file.c
   freeswitch/branches/greenlizard/src/mod/formats/mod_sndfile/mod_sndfile.c
   freeswitch/branches/greenlizard/src/mod/languages/mod_perl/mod_perl.c
   freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/branches/greenlizard/src/mod/loggers/mod_console/mod_console.c
   freeswitch/branches/greenlizard/src/mod/say/mod_say_en/mod_say_en.c
   freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c
   freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
   freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
   freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
   freeswitch/branches/greenlizard/src/switch_channel.c
   freeswitch/branches/greenlizard/src/switch_core_io.c
   freeswitch/branches/greenlizard/src/switch_core_session.c
   freeswitch/branches/greenlizard/src/switch_event.c
   freeswitch/branches/greenlizard/src/switch_log.c
   freeswitch/branches/greenlizard/src/switch_rtp.c
   freeswitch/branches/greenlizard/src/switch_stun.c

Log:
merge trunk 5395 to 5424

Modified: freeswitch/branches/greenlizard/Freeswitch.sln
==============================================================================
--- freeswitch/branches/greenlizard/Freeswitch.sln	(original)
+++ freeswitch/branches/greenlizard/Freeswitch.sln	Wed Jun 20 13:06:05 2007
@@ -3,20 +3,20 @@
 # Visual Studio 2005
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchConsole", "w32\Console\FreeSwitchConsole.vcproj", "{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchCoreLib", "w32\Library\FreeSwitchCore.vcproj", "{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}"
 	ProjectSection(ProjectDependencies) = postProject
-		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}
-		{101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED}
-		{EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EEF031CB-FED8-451E-A471-91EC8D4F6750}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
-		{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
-		{8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9}
 		{50AD0E28-B8D7-4FCC-8FC3-599F6AC69761} = {50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}
+		{8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9}
+		{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EEF031CB-FED8-451E-A471-91EC8D4F6750}
+		{101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED}
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g729", "src\mod\codecs\mod_g729\mod_g729.vcproj", "{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}"
@@ -26,28 +26,28 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_gsm", "src\mod\codecs\mod_gsm\mod_gsm.vcproj", "{4926323F-4EA8-4B7D-A3D3-65488725988F}"
 	ProjectSection(ProjectDependencies) = postProject
-		{8FD2E297-4096-47E5-9258-C48FF1841523} = {8FD2E297-4096-47E5-9258-C48FF1841523}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{8FD2E297-4096-47E5-9258-C48FF1841523} = {8FD2E297-4096-47E5-9258-C48FF1841523}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xmpp_event", "src\mod\event_handlers\mod_xmpp_event\mod_xmpp_event.vcproj", "{F10BE67C-A8FF-4CB2-AF29-D46D2590DC59}"
 	ProjectSection(ProjectDependencies) = postProject
-		{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sndfile", "src\mod\formats\mod_sndfile\mod_sndfile.vcproj", "{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}"
 	ProjectSection(ProjectDependencies) = postProject
-		{3D0370CA-BED2-4657-A475-32375CBCB6E4} = {3D0370CA-BED2-4657-A475-32375CBCB6E4}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{3D0370CA-BED2-4657-A475-32375CBCB6E4} = {3D0370CA-BED2-4657-A475-32375CBCB6E4}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_test", "src\mod\event_handlers\mod_event_test\mod_event_test.vcproj", "{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g711", "src\mod\codecs\mod_g711\mod_g711.vcproj", "{B1FE4613-3F4B-4DAF-9714-2472BF8F56AE}"
@@ -57,16 +57,16 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_iax", "src\mod\endpoints\mod_iax\mod_iax.vcproj", "{3A5B9131-F20C-4A85-9447-6C1610941CEE}"
 	ProjectSection(ProjectDependencies) = postProject
-		{5CC054B7-6DAA-46BF-9A08-3B33B83E8D3E} = {5CC054B7-6DAA-46BF-9A08-3B33B83E8D3E}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{5CC054B7-6DAA-46BF-9A08-3B33B83E8D3E} = {5CC054B7-6DAA-46BF-9A08-3B33B83E8D3E}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_PortAudio", "src\mod\endpoints\mod_portaudio\mod_PortAudio.vcproj", "{5FD31A25-5D83-4794-8BEE-904DAD84CE71}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{0A18A071-125E-442F-AFF7-A3F68ABECF99} = {0A18A071-125E-442F-AFF7-A3F68ABECF99}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{0A18A071-125E-442F-AFF7-A3F68ABECF99} = {0A18A071-125E-442F-AFF7-A3F68ABECF99}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_l16", "src\mod\codecs\mod_l16\mod_l16.vcproj", "{5844AFE1-AA3E-4BDB-A9EF-119AEF19DF88}"
@@ -76,20 +76,20 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_softtimer", "src\mod\timers\mod_softtimer\mod_softtimer.vcproj", "{DCC13474-28DF-47CA-A8EB-72F8CE9A78C5}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_speex", "src\mod\codecs\mod_speex\mod_speex.vcproj", "{5580D60E-0F77-4716-9CD4-B8E5986FA375}"
 	ProjectSection(ProjectDependencies) = postProject
-		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918} = {1C469CDD-A3AF-4A94-A592-B2CF12F2D918}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{1C469CDD-A3AF-4A94-A592-B2CF12F2D918} = {1C469CDD-A3AF-4A94-A592-B2CF12F2D918}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_woomera", "src\mod\endpoints\mod_woomera\mod_woomera.vcproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Codecs", "Codecs", "{F881ADA2-2F1A-4046-9FEB-191D9422D781}"
@@ -112,8 +112,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dialplan_xml", "src\mod\dialplans\mod_dialplan_xml\mod_dialplan_xml.vcproj", "{07113B25-D3AF-4E04-BA77-4CD1171F022C}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "FreeSwitchSetup", "w32\Setup\Setup.vdproj", "{B17FFBE6-A942-4056-8346-B624FB5D995B}"
@@ -127,22 +127,22 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dialplan_directory", "src\mod\dialplans\mod_dialplan_directory\mod_dialplan_directory.vcproj", "{A27CCA23-1541-4337-81A4-F0A6413078A0}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_zeroconf", "src\mod\event_handlers\mod_zeroconf\mod_zeroconf.vcproj", "{C7705DC4-2088-493E-AF8D-65BC6D65C125}"
 	ProjectSection(ProjectDependencies) = postProject
-		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{49C34584-B6DA-448F-83CF-27584DC9FC90} = {49C34584-B6DA-448F-83CF-27584DC9FC90}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{49C34584-B6DA-448F-83CF-27584DC9FC90} = {49C34584-B6DA-448F-83CF-27584DC9FC90}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_multicast", "src\mod\event_handlers\mod_event_multicast\mod_event_multicast.vcproj", "{784113EF-44D9-4949-835D-7065D3C7AD08}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libteletone", "libs\libteletone\libteletone.vcproj", "{89385C74-5860-4174-9CAF-A39E7C48909C}"
@@ -151,10 +151,10 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey", "src\mod\languages\mod_spidermonkey\mod_spidermonkey.vcproj", "{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}"
 	ProjectSection(ProjectDependencies) = postProject
-		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
-		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
+		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ASR-TTS", "ASR-TTS", "{4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}"
@@ -176,22 +176,22 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_ilbc", "src\mod\codecs\mod_ilbc\mod_ilbc.vcproj", "{D3EC0AFF-76FC-4210-A825-9A17410660A3}"
 	ProjectSection(ProjectDependencies) = postProject
-		{989BB874-7AF1-44CB-8E5C-CC8113D267E8} = {989BB874-7AF1-44CB-8E5C-CC8113D267E8}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{989BB874-7AF1-44CB-8E5C-CC8113D267E8} = {989BB874-7AF1-44CB-8E5C-CC8113D267E8}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dingaling", "src\mod\endpoints\mod_dingaling\mod_dingaling.vcproj", "{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}"
 	ProjectSection(ProjectDependencies) = postProject
-		{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{1906D736-08BD-4EE1-924F-B536249B9A54} = {1906D736-08BD-4EE1-924F-B536249B9A54}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_commands", "src\mod\applications\mod_commands\mod_commands.vcproj", "{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Loggers", "Loggers", "{A7AB4405-FDB7-4853-9FBB-1516B1C3D80A}"
@@ -205,42 +205,42 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_rpc", "src\mod\xml_int\mod_xml_rpc\mod_xml_rpc.vcproj", "{CBEC7225-0C21-4DA8-978E-1F158F8AD950}"
 	ProjectSection(ProjectDependencies) = postProject
-		{155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {155844C3-EC5F-407F-97A4-A2DDADED9B2F}
-		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{A3FE0076-B366-429D-A238-D7304DA7D3C1} = {A3FE0076-B366-429D-A238-D7304DA7D3C1}
-		{356EC96D-4C9F-47B5-9083-FC328B87BA94} = {356EC96D-4C9F-47B5-9083-FC328B87BA94}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{356EC96D-4C9F-47B5-9083-FC328B87BA94} = {356EC96D-4C9F-47B5-9083-FC328B87BA94}
+		{A3FE0076-B366-429D-A238-D7304DA7D3C1} = {A3FE0076-B366-429D-A238-D7304DA7D3C1}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
+		{155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {155844C3-EC5F-407F-97A4-A2DDADED9B2F}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rss", "src\mod\applications\mod_rss\mod_rss.vcproj", "{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_conference", "src\mod\applications\mod_conference\mod_conference.vcproj", "{C24FB505-05D7-4319-8485-7540B44C8603}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dptools", "src\mod\applications\mod_dptools\mod_dptools.vcproj", "{B5881A85-FE70-4F64-8607-2CAAE52669C6}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_socket", "src\mod\event_handlers\mod_event_socket\mod_event_socket.vcproj", "{05515420-16DE-4E63-BE73-85BE85BA5142}"
 	ProjectSection(ProjectDependencies) = postProject
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_cdr", "src\mod\event_handlers\mod_cdr\mod_cdr.vcproj", "{3D1EED36-A510-4EDB-B4D9-4E0F4A5EC2A8}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Libraries", "_Libraries", "{EB910B0D-F27D-4B62-B67B-DE834C99AC5B}"
@@ -253,8 +253,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdingaling", "libs\libdingaling\libdingaling.vcproj", "{1906D736-08BD-4EE1-924F-B536249B9A54}"
 	ProjectSection(ProjectDependencies) = postProject
-		{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3}
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
+		{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsrtp", "libs\srtp\libsrtp.vcproj", "{EEF031CB-FED8-451E-A471-91EC8D4F6750}"
@@ -279,8 +279,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libaprutil", "libs\win32\apr-util\libaprutil.vcproj", "{F057DA7F-79E5-4B00-845C-EF446EF055E3}"
 	ProjectSection(ProjectDependencies) = postProject
-		{101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED}
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Downloads", "_Downloads", "{C120A020-773F-4EA3-923F-B67AF28B750D}"
@@ -298,8 +298,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mDNSResponder static library", "libs\win32\howl\libmDNSResponder.vcproj", "{49C34584-B6DA-448F-83CF-27584DC9FC90}"
 	ProjectSection(ProjectDependencies) = postProject
-		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE}
 		{5927104D-C14C-4AC8-925C-4AB681762E75} = {5927104D-C14C-4AC8-925C-4AB681762E75}
+		{0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsndfile", "libs\win32\libsndfile\libsndfile.vcproj", "{3D0370CA-BED2-4657-A475-32375CBCB6E4}"
@@ -319,34 +319,34 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sofia", "src\mod\endpoints\mod_sofia\mod_sofia.vcproj", "{0DF3ABD0-DDC0-4265-B778-07C66780979B}"
 	ProjectSection(ProjectDependencies) = postProject
-		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libg726", "libs\codec\g726\libg726.vcproj", "{5A6A281A-AA50-470A-8305-202BDA1CD1BF}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g726", "src\mod\codecs\mod_g726\mod_g726.vcproj", "{486369EB-F150-4B56-BCC8-77B9E18FF5F5}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{5A6A281A-AA50-470A-8305-202BDA1CD1BF} = {5A6A281A-AA50-470A-8305-202BDA1CD1BF}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libg7xx", "libs\codec\g7xx\libg7xx.vcproj", "{D71E7338-8D9C-4FE4-A15F-D5CC60202C7C}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g722", "src\mod\codecs\mod_g722\mod_g722.vcproj", "{D42518CC-7475-454D-B392-0E132C07D761}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{D71E7338-8D9C-4FE4-A15F-D5CC60202C7C} = {D71E7338-8D9C-4FE4-A15F-D5CC60202C7C}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsofia_sip_ua_static", "libs\win32\sofia\libsofia_sip_ua_static.vcproj", "{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}"
 	ProjectSection(ProjectDependencies) = postProject
-		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}
 		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}
+		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download PTHREAD", "libs\win32\Download PTHREAD.vcproj", "{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}"
@@ -358,84 +358,84 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g723_1", "src\mod\codecs\mod_g723_1\mod_g723_1.vcproj", "{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_native_file", "src\mod\formats\mod_native_file\mod_native_file.vcproj", "{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeSwitch.NET", "src\dotnet\FreeSwitch.NET.csproj", "{251CAABC-16C3-4593-A491-603B908094E0}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_core_db", "src\mod\languages\mod_spidermonkey_core_db\mod_spidermonkey_core_db.vcproj", "{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}"
 	ProjectSection(ProjectDependencies) = postProject
-		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", "src\mod\languages\mod_spidermonkey_teletone\mod_spidermonkey_teletone.vcproj", "{8F992C49-6C51-412F-B2A3-34EAB708EB65}"
 	ProjectSection(ProjectDependencies) = postProject
-		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libudns", "libs\win32\udns\libudns.vcproj", "{4043FC6A-9A30-4577-8AD5-9B233C9575D8}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_enum", "src\mod\applications\mod_enum\mod_enum.vcproj", "{71A967D5-0E99-4CEF-A587-98836EE6F2EF}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_etpan", "src\mod\languages\mod_spidermonkey_etpan\mod_spidermonkey_etpan.vcproj", "{D6C82F86-2B05-4A7F-8CC6-D2592E66FBB9}"
 	ProjectSection(ProjectDependencies) = postProject
-		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{BA4DED3C-E56F-4484-BFC3-9C13E461A1BE} = {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE}
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
+		{BA4DED3C-E56F-4484-BFC3-9C13E461A1BE} = {BA4DED3C-E56F-4484-BFC3-9C13E461A1BE}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey_odbc\mod_spidermonkey_odbc.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
 	ProjectSection(ProjectDependencies) = postProject
-		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libetpan", "libs\win32\etpan\libetpan.vcproj", "{BA4DED3C-E56F-4484-BFC3-9C13E461A1BE}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_curl", "src\mod\xml_int\mod_xml_curl\mod_xml_curl.vcproj", "{AB91A099-7690-4ECF-8994-E458F4EA1ED4}"
 	ProjectSection(ProjectDependencies) = postProject
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "say", "say", "{6CD61A1D-797C-470A-BE08-8C31B68BB336}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_en", "src\mod\say\mod_say_en\mod_say_en.vcproj", "{988CACF7-3FCB-4992-BE69-77872AE67DC8}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portaudio", "libs\portaudio\build\msvc\portaudio.vcproj", "{0A18A071-125E-442F-AFF7-A3F68ABECF99}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_cdr", "src\mod\xml_int\mod_xml_cdr\mod_xml_cdr.vcproj", "{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_amr", "src\mod\codecs\mod_amr\mod_amr.vcproj", "{8DEB383C-4091-4F42-A56F-C9E46D552D79}"
@@ -573,6 +573,9 @@
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_h26x", "src\mod\codecs\mod_h26x\mod_h26x.vcproj", "{2C3C2423-234B-4772-8899-D3B137E5CA35}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_esf", "src\mod\applications\mod_esf\mod_esf.vcproj", "{3850D93A-5F24-4922-BC1C-74D08C37C256}"
 	ProjectSection(ProjectDependencies) = postProject
@@ -1107,18 +1110,18 @@
 		{3D1EED36-A510-4EDB-B4D9-4E0F4A5EC2A8} = {9ADF1E48-2F5C-4ED7-A893-596259FABFE0}
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
 		{9254C4B0-6F60-42B6-BB3A-36D63FC001C7} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
-		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
-		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
-		{C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
-		{B5881A85-FE70-4F64-8607-2CAAE52669C6} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
-		{71A967D5-0E99-4CEF-A587-98836EE6F2EF} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
-		{3850D93A-5F24-4922-BC1C-74D08C37C256} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{FE3540C5-3303-46E0-A69E-D92F775687F1} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{3A5B9131-F20C-4A85-9447-6C1610941CEE} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{DCC13474-28DF-47CA-A8EB-72F8CE9A78C5} = {2D57D093-3F8D-4729-AD9A-68E945C200A5}
+		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{B5881A85-FE70-4F64-8607-2CAAE52669C6} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{71A967D5-0E99-4CEF-A587-98836EE6F2EF} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
+		{3850D93A-5F24-4922-BC1C-74D08C37C256} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
 		{07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
 		{A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4}
 		{1A1FF289-4FD6-4285-A422-D31DD67A4723} = {CBD81696-EFB4-4D2F-8451-1B8DAA86155A}

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/Makefile.am
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/Makefile.am	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/Makefile.am	Wed Jun 20 13:06:05 2007
@@ -24,7 +24,7 @@
 
 ACLOCAL_AMFLAGS = -I m4
 
-EXTRA_DIST += 	m4/sac-general.m4 m4/sac-su.m4 m4/sac-coverage.m4 \
+EXTRA_DIST += 	m4/sac-general.m4 m4/sac-coverage.m4 \
 		m4/sac-su2.m4 m4/sac-tport.m4 m4/sac-openssl.m4 
 
 EXTRA_DIST +=   docs/build_system.txt \

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/RELEASE
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/RELEASE	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/RELEASE	Wed Jun 20 13:06:05 2007
@@ -24,6 +24,9 @@
 New features in API are marked with Doxytag macro @VERSION_1_12_7.
 
 libsofia-sip-ua:
+- Removed extra system headers from <sofia-sip/stun_common.h>
+- Added global variable su_socket_blocking. If it is set to true,
+  sockets are created as blocking.
 - Added accessor function nta_outgoing_branch()
 - **template**: Added foobar() function (sofia-sip/foobar.h).
 - This release is ABI/API compatible with applications linked against 

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/configure.ac
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/configure.ac	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/configure.ac	Wed Jun 20 13:06:05 2007
@@ -69,7 +69,6 @@
 SAC_SOFIA_SU
 SAC_OPENSSL
 SAC_TPORT
-SAC_SU
 
 ### internal modules
 ### ----------------

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/docs/hide_emails.sh
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/docs/hide_emails.sh	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/docs/hide_emails.sh	Wed Jun 20 13:06:05 2007
@@ -29,9 +29,13 @@
 #
 # --------------------------------------------------------------------
 
-echo "Hiding email addresses in ${1:-.}"
+echo "Postprocessing HTML in ${1:-.}: hiding email addresses, fixing links"
 
 find ${1:-.} -name '*.html' -print0 | 
 xargs -0 \
-sed -r -i 's/([:>;][a-z][-a-z.]*)(@[a-z][a-z]*)\.[a-z][a-z]*(["<\&])/\1\2-email.address.hidden\3/gi'
-
+sed -r -i '
+# Hide e-mail addresses
+s/([:>;][a-z][-a-z.]*)(@[a-z][a-z]*)\.[a-z][a-z]*(["<\&])/\1\2-email.address.hidden\3/gi;
+# Fix cross-module links
+s!doxygen="([a-z]*).doxytags:../\1/" href="../\1/\1_index.html"!doxygen="\1.doxytags:../\1/" href="../\1/index.html"!g;
+'

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_tag.h.in
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_tag.h.in	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_tag.h.in	Wed Jun 20 13:06:05 2007
@@ -102,7 +102,7 @@
 #define HTTPTAG_HTTP_REF(x)   httptag_http_ref, httptag_http_vr(&(x))
 SOFIAPUBVAR tag_typedef_t httptag_http_ref;
 
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 su_inline
 tag_value_t httptag_http_v(http_t const *v) { return (tag_value_t)v; }
 su_inline 
@@ -150,7 +150,7 @@
 #define HTTPTAG_HEADER_REF(x)   httptag_header_ref, httptag_header_vr(&(x))
 SOFIAPUBVAR tag_typedef_t httptag_header_ref;
 
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 su_inline tag_value_t
 httptag_header_v(http_header_t const *v)
 { return (tag_value_t)v; }
@@ -220,7 +220,7 @@
 #define HTTPTAG_#XXXXXX#_STR_REF(x)        HTTPTAG_STR_REF(#xxxxxx#, x)
 SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#_str_ref;
 
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 su_inline tag_value_t
 httptag_#xxxxxx#_v(http_#xxxxxx#_t const *v)
 { return (tag_value_t)v; }

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h	Wed Jun 20 13:06:05 2007
@@ -253,7 +253,7 @@
 #define AUTHTAG_MODULE_REF(x)	authtag_module_ref, authtag_module_vr((&x))
 SOFIAPUBVAR tag_typedef_t authtag_module_ref;
 
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 su_inline tag_value_t authtag_module_v(auth_mod_t *v) {
   return (tag_value_t)v;
 }

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c	Wed Jun 20 13:06:05 2007
@@ -1840,6 +1840,8 @@
 	return NULL;
       }
 
+      b = b2;
+
       continue;
     }
   }

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/msg/test_msg.c	Wed Jun 20 13:06:05 2007
@@ -797,7 +797,21 @@
 
   {
     size_t size = SIZE_MAX;
-    char *s = msg_as_string(msg_home(msg), msg, NULL, 0, &size);
+    char *s;
+    char body[66 * 15 + 1];
+    int i;
+    msg_payload_t *pl;
+
+    /* Bug #1726034 */
+    for (i = 0; i < 15; i++)
+      strcpy(body + i * 66, 
+	     "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+	     "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n");
+    pl = msg_payload_make(msg_home(msg), body);
+
+    TEST(msg_header_insert(msg, (msg_pub_t *)tst, (void *)pl), 0);
+
+    s = msg_as_string(msg_home(msg), msg, NULL, 0, &size);
     TEST_S(s, 
 "GET a-wife HTTP/1.1" CRLF
 "Foo: bar" CRLF
@@ -806,7 +820,23 @@
 "Content-Language: se-FI, fi-FI, sv-FI\r\n"
 "Accept-Language: se, fi, sv\r\n"
 CRLF
-"test" CRLF);
+"test" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" CRLF
+);
   }
 
   msg_destroy(msg);

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	Wed Jun 20 13:06:05 2007
@@ -2198,7 +2198,8 @@
 		       TPTAG_SDWN_AFTER(stream),
 		       TAG_END());
       }
-    } else {
+    }
+    else {
       msg_destroy(msg);
       if (stream)		/* Send FIN */
 	tport_shutdown(tport, 1);
@@ -6172,13 +6173,6 @@
 HTABLE_BODIES_WITH(outgoing_htable, oht, nta_outgoing_t, HTABLE_HASH_ORQ,
 		   size_t, hash_value_t);
 
-static nta_outgoing_t *outgoing_create(nta_agent_t *agent,
-				       nta_response_f *callback,
-				       nta_outgoing_magic_t *magic,
-				       url_string_t const *route_url,
-				       tp_name_t const *tpn,
-				       msg_t *msg,
-				       tag_type_t tag, tag_value_t value, ...);
 static int outgoing_features(nta_agent_t *agent, nta_outgoing_t *orq,
 			      msg_t *msg, sip_t *sip,
 			      tagi_t *tags);
@@ -6815,7 +6809,11 @@
   /* select the tport to use for the outgoing message  */
   if (override_tport) {
     /* note: no ref taken to the tport as its only used once here */
-    tpn = tport_name(override_tport);
+    if (tport_is_secondary(override_tport)) {
+      tpn = tport_name(override_tport);
+      orq->orq_user_tport = 1;
+    }
+    
   }
 
   if (route_url) {
@@ -7095,8 +7093,10 @@
     if (cc)
       nta_compartment_decref(&cc);
 
+    if (orq->orq_user_tport)
+      /* No retries */;
     /* RFC3261, 18.1.1 */
-    if (err == EMSGSIZE && !orq->orq_try_tcp_instead) {
+    else if (err == EMSGSIZE && !orq->orq_try_tcp_instead) {
       if (strcasecmp(tpn->tpn_proto, "udp") == 0 ||
 	  strcasecmp(tpn->tpn_proto, "*") == 0) {
 	outgoing_try_tcp_instead(orq);
@@ -10217,6 +10217,10 @@
 }
 
 
+/** Return a new reference to the transaction transport.
+ *
+ * @note The referenced transport must be unreferenced with tport_unref()
+ */
 tport_t *
 nta_incoming_transport(nta_agent_t *agent,
 		       nta_incoming_t *irq,

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h	Wed Jun 20 13:06:05 2007
@@ -504,6 +504,7 @@
   unsigned orq_completed : 1;
   unsigned orq_delayed : 1;
   unsigned orq_stripped_uri : 1;
+  unsigned orq_user_tport : 1;	/**< Application provided tport - don't retry */
   unsigned orq_try_tcp_instead : 1;
   unsigned orq_try_udp_instead : 1;
   unsigned orq_reliable : 1; /**< Transport is reliable */

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nth/sofia-sip/nth_tag.h
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nth/sofia-sip/nth_tag.h	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nth/sofia-sip/nth_tag.h	Wed Jun 20 13:06:05 2007
@@ -101,7 +101,7 @@
 NTH_DLL extern tag_typedef_t nthtag_error_msg_ref;
 #define NTHTAG_ERROR_MSG_REF(x) nthtag_error_msg_ref, tag_bool_vr(&(x))
 
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 struct nth_client_s;
 su_inline tag_value_t nthtag_template_v(struct nth_client_s const *v)
 { return (tag_value_t)v; }
@@ -119,7 +119,7 @@
 NTH_DLL extern tag_typedef_t nthtag_template_ref;
 #define NTHTAG_TEMPLATE_REF(x) nthtag_template_ref, nthtag_template_vr(&(x))
 
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 su_inline tag_value_t nthtag_message_v(struct msg_s *v)
 { return (tag_value_t)v; }
 su_inline tag_value_t nthtag_message_vr(struct msg_s **vp)

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nth/test_nth.c	Wed Jun 20 13:06:05 2007
@@ -570,6 +570,7 @@
 
   if (c == INVALID_SOCKET) {
     c = su_socket(t->t_addr->su_family, SOCK_STREAM, 0); TEST_1(c != SOCK_STREAM);
+    TEST_1(su_setblocking(c, 1) != -1);
     TEST_1(connect(c, &t->t_addr->su_sa, t->t_addrlen) != -1);
 
     while (su_root_step(t->t_root, 1) == 0);

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua.c	Wed Jun 20 13:06:05 2007
@@ -1049,7 +1049,7 @@
 /** Get request message from saved nua event. @NEW_1_12_4. */
 msg_t *nua_saved_event_request(nua_saved_event_t const *saved)
 {
-  return saved ? su_msg_data(saved)->e_msg : NULL;
+  return saved && saved[0] ? su_msg_data(saved)->e_msg : NULL;
 }
 
 /** Save nua event and its arguments */

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c	Wed Jun 20 13:06:05 2007
@@ -48,7 +48,10 @@
 /* ======================================================================== */
 /* MESSAGE */
 
-/** Send an instant message. 
+/**@fn void nua_message( \
+ *       nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
+ *
+ * Send an instant message. 
  *
  * Send an instant message using SIP MESSAGE method.
  *

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c	Wed Jun 20 13:06:05 2007
@@ -37,6 +37,8 @@
 /** @internal SU network changed detector argument pointer type */
 #define SU_NETWORK_CHANGED_MAGIC_T struct nua_s
 
+#define TP_CLIENT_T          struct register_usage
+
 #include <sofia-sip/string0.h>
 #include <sofia-sip/su_strlst.h>
 #include <sofia-sip/su_uniqueid.h>
@@ -46,7 +48,7 @@
 #include <sofia-sip/sip_util.h>
 #include <sofia-sip/sip_status.h>
 
-#define NTA_UPDATE_MAGIC_T   struct nua_s
+#define NTA_UPDATE_MAGIC_T   struct nua_handle_s
 
 #include "nua_stack.h"
 
@@ -126,6 +128,7 @@
 
   /** Status of registration */
   unsigned nr_ready:1;
+
   /** Kind of registration.
    *
    * If nr_default is true, this is not a real registration but placeholder
@@ -138,7 +141,11 @@
   unsigned nr_default:1, nr_secure:1, nr_public:1, nr_ip4:1, nr_ip6:1;
 
   /** Stack-generated contact */
-  unsigned nr_by_stack:1, :0;
+  unsigned nr_by_stack:1;
+
+  unsigned:0;
+  
+  int nr_error_report_id;	/**< ID used to ask for error reports from tport */
 
   sip_route_t *nr_route;	/**< Outgoing Service-Route */
   sip_path_t *nr_path;		/**< Incoming Path */
@@ -205,6 +212,12 @@
   nr->nr_compartment = NULL;
 #endif
 
+  if (nr->nr_error_report_id)
+    tport_release(nr->nr_tport, nr->nr_error_report_id, NULL, NULL, nr, 0);
+
+  if (nr->nr_tport)
+    tport_unref(nr->nr_tport), nr->nr_tport = NULL;
+
   ds->ds_has_register = 0;	/* There can be only one */
 }
 
@@ -222,6 +235,12 @@
 /* ======================================================================== */
 /* REGISTER */
 
+static void nua_register_connection_closed(tp_stack_t *sip_stack,
+					   nua_registration_t *nr,
+					   tport_t *tport,
+					   msg_t *msg,
+					   int error);
+
 /* Interface towards outbound_t */
 sip_contact_t *nua_handle_contact_by_via(nua_handle_t *nh,
 					 su_home_t *home,
@@ -764,6 +783,7 @@
 				  TAG_IF(unreg, NTATAG_SIGCOMP_CLOSE(1)),
 				  TAG_IF(!unreg, NTATAG_COMP("sigcomp")),
 #endif
+				  NTATAG_TPORT(nr->nr_tport),
 				  TAG_NEXT(tags));
 }
 
@@ -827,6 +847,8 @@
     msg_t *_reqmsg = nta_outgoing_getrequest(cr->cr_orq);
     sip_t *req = sip_object(_reqmsg);
 
+    tport_t *tport;
+
     msg_destroy(_reqmsg);
 
     assert(nr); assert(sip); assert(req);
@@ -927,10 +949,26 @@
       outbound_start_keepalive(nr->nr_ob, cr->cr_orq);
     }
 
-    /* persistant connection for registration */
-    if (!nr->nr_tport)
-      /* note: nta_outgoing_transport() takes a ref */
-      nr->nr_tport = nta_outgoing_transport (cr->cr_orq); 
+    tport = nta_outgoing_transport (cr->cr_orq);
+
+    /* cache persistant connection for registration */
+    if (tport && tport != nr->nr_tport) {
+      if (nr->nr_error_report_id) {
+	if (tport_release(nr->nr_tport, nr->nr_error_report_id, NULL, NULL, nr, 0) < 0)
+	  SU_DEBUG_1(("nua_register: tport_release() failed\n"));
+	nr->nr_error_report_id = 0;
+      }
+      tport_unref(nr->nr_tport);
+      nr->nr_tport = tport;
+
+      if (tport_is_secondary(tport)) {
+	tport_set_params(tport, TPTAG_SDWN_ERROR(1), TAG_END());
+	nr->nr_error_report_id = 
+	  tport_pend(tport, NULL, nua_register_connection_closed, nr);
+      }
+    }
+    else
+      tport_unref(tport);    /* note: nta_outgoing_transport() makes a ref */
 
     nua_registration_set_ready(nr, 1);
   }
@@ -943,9 +981,15 @@
     outbound_stop_keepalive(nr->nr_ob);
 
     /* release the persistant transport for registration */
-    if (nr->nr_tport)
-      tport_decref(&nr->nr_tport), nr->nr_tport = NULL;
+    if (nr->nr_tport) {
+      if (nr->nr_error_report_id) {
+	if (tport_release(nr->nr_tport, nr->nr_error_report_id, NULL, NULL, nr, 0) < 0)
+	  SU_DEBUG_1(("nua_register: tport_release() failed\n"));
+	nr->nr_error_report_id = 0;
+      }
 
+      tport_unref(nr->nr_tport), nr->nr_tport = NULL;
+    }
     nua_registration_set_ready(nr, 0);
   }
 
@@ -953,6 +997,24 @@
   return nua_base_client_response(cr, status, phrase, sip, NULL);
 }
 
+static
+void nua_register_connection_closed(tp_stack_t *sip_stack,
+				    nua_registration_t *nr,
+				    tport_t *tport,
+				    msg_t *msg,
+				    int error)
+{
+  if (tport_release(nr->nr_tport, nr->nr_error_report_id, NULL, NULL, nr, 0) < 0)
+    SU_DEBUG_1(("nua_register: tport_release() failed\n"));
+
+  nr->nr_error_report_id = 0;
+  tport_unref(nr->nr_tport), nr->nr_tport = NULL;
+
+  /* Schedule re-REGISTER immediately */
+  nua_dialog_usage_refresh_at(nua_dialog_usage_public(nr), sip_now());
+}
+
+
 static void nua_register_usage_refresh(nua_handle_t *nh,
 				       nua_dialog_state_t *ds,
 				       nua_dialog_usage_t *du,
@@ -978,8 +1040,8 @@
  * @retval <0  try again later
  */
 static int nua_register_usage_shutdown(nua_handle_t *nh,
-				     nua_dialog_state_t *ds,
-				     nua_dialog_usage_t *du)
+				       nua_dialog_state_t *ds,
+				       nua_dialog_usage_t *du)
 {
   nua_client_request_t *cr = du->du_cr;
   nua_registration_t *nr = nua_dialog_usage_private(du);
@@ -1209,7 +1271,7 @@
     }
   }
 
-  nta_agent_bind_tport_update(nua->nua_nta, nua, nua_stack_tport_update);
+  nta_agent_bind_tport_update(nua->nua_nta, (nta_update_magic_t *)nua, nua_stack_tport_update);
 
   return 0;
 }

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c	Wed Jun 20 13:06:05 2007
@@ -1627,7 +1627,8 @@
  *               (maybe NULL if call handle was created for this call)
  * @param sip    incoming INVITE request
  * @param tags   SOATAG_ACTIVE_AUDIO(), SOATAG_ACTIVE_VIDEO()
- * 
+ *
+ * @par
  * @par Responding to INVITE with nua_respond()
  *
  * If @a status in #nua_i_invite event is below 200, the application should
@@ -1700,6 +1701,7 @@
  * #nua_i_prack, #nua_i_update, nua_update(),
  * nua_invite(), #nua_r_invite
  *
+ * @par
  * @par Third Party Call Control
  *
  * When so called 2rd party call control is used, the initial @b INVITE may

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c	Wed Jun 20 13:06:05 2007
@@ -121,7 +121,9 @@
 /* ====================================================================== */
 /* SUBSCRIBE */
 
-/** Subscribe to a SIP event. 
+/**@fn void nua_subscribe(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
+ *
+ *  Subscribe to a SIP event. 
  *
  * Subscribe a SIP event using the SIP SUBSCRIBE request. If the 
  * SUBSCRBE is successful a subscription state is established and 
@@ -145,7 +147,9 @@
  * @sa NUTAG_SUBSTATE(), @RFC3265
  */
 
-/** Unsubscribe an event. 
+/**@fn void nua_unsubscribe(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
+ *
+ * Unsubscribe an event. 
  *
  * Unsubscribe an active or pending subscription with SUBSCRIBE request 
  * containing Expires: header with value 0. The dialog associated with 
@@ -689,7 +693,9 @@
 /* ======================================================================== */
 /* REFER */
 
-/** Transfer a call. 
+/**@fn void nua_refer(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
+ *
+ * Transfer a call. 
  * 
  * Send a REFER request asking the recipient to transfer the call. 
  *

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h	Wed Jun 20 13:06:05 2007
@@ -166,7 +166,7 @@
  *    nua_respond()
  *
  * @par Parameter type
- *    msg_t *
+ *    nua_saved_event_t *
  *
  * @par Values
  *   Pointer to a saved event.
@@ -2270,7 +2270,7 @@
 SOFIAPUBVAR tag_typedef_t nutag_detect_network_updates_ref;
 
 /* Pass nua handle as tagged argument */
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 su_inline tag_value_t nutag_handle_v(nua_handle_t *v) { return (tag_value_t)v; }
 su_inline tag_value_t nutag_handle_vr(nua_handle_t **vp) {return(tag_value_t)vp;}
 #else

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c	Wed Jun 20 13:06:05 2007
@@ -128,7 +128,7 @@
 
   struct endpoint *a = &ctx->a,  *b = &ctx->b;
   struct call *a_call = a->call, *b_call = b->call;
-  struct event *e;
+  struct event *e, *ep, *ei;
   sip_t *sip;
 
   if (print_headings)
@@ -193,10 +193,17 @@
   TEST_1(is_answer_recv(e->data->e_tags));
   TEST_1(!is_offer_sent(e->data->e_tags));
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+  ei = event_by_type(e->next, nua_r_invite);
+  ep = event_by_type(e->next, nua_r_prack);
+  if (!ep) {
+    run_a_until(ctx, -1, until_final_response);
+    ep = event_by_type(e->next, nua_r_prack);
+  }
+
+  TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_prack);
   TEST(e->data->e_status, 200);
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   TEST_1(sip = sip_object(e->data->e_msg));
   TEST_1(sip->sip_content_type);
@@ -206,7 +213,8 @@
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
   TEST_1(!is_offer_answer_done(e->data->e_tags));
-  TEST_1(!e->next);
+
+  TEST_1(!e->next || !ep->next);
   free_events_in_list(ctx, a->events);
 
   /*
@@ -321,13 +329,13 @@
 
   struct endpoint *c = &ctx->c,  *b = &ctx->b;
   struct call *c_call = c->call, *b_call = b->call;
-  struct event *e;
+  struct event *e, *ep, *ei;
   sip_t *sip;
   sip_proxy_authenticate_t *au;
   char const *md5 = NULL, *md5sess = NULL;
 
   if (print_headings)
-    printf("TEST NUA-10.1.1: Call with 100rel and 180\n");
+    printf("TEST NUA-10.1.3: Call with 100rel and 180\n");
 
 /* Test for authentication during 100rel
 
@@ -405,8 +413,14 @@
   TEST_1(is_answer_recv(e->data->e_tags));
   TEST_1(!is_offer_sent(e->data->e_tags));
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+  ei = event_by_type(e->next, nua_r_invite);
+  ep = event_by_type(e->next, nua_r_prack);
+  if (!ep) {
+    run_a_until(ctx, -1, until_final_response);
+    ep = event_by_type(e->next, nua_r_prack);
+  }
 
+  TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_prack);
   if (e->data->e_status != 200 && md5 && !md5sess) {
     if (e->data->e_status != 100) {
       TEST(e->data->e_status, 407);
@@ -419,16 +433,15 @@
 
     TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
   }
-
   TEST(e->data->e_status, 200);
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
 
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
   TEST_1(!is_offer_answer_done(e->data->e_tags));
-  TEST_1(!e->next);
+  TEST_1(!e->next || !ep->next || (ep->data->e_status != 200 && !e->next->next->next));
   free_events_in_list(ctx, c->events);
 
   /*
@@ -466,10 +479,10 @@
   free_events_in_list(ctx, b->events);
 
   if (print_headings)
-    printf("TEST NUA-10.1.1: PASSED\n");
+    printf("TEST NUA-10.1.3: PASSED\n");
 
   if (print_headings)
-    printf("TEST NUA-10.1.2: terminate call\n");
+    printf("TEST NUA-10.1.4: terminate call\n");
 
   BYE(b, b_call, b_call->nh, TAG_END());
   run_bc_until(ctx, -1, until_terminated, -1, until_terminated);
@@ -496,7 +509,7 @@
   nua_handle_destroy(b_call->nh), b_call->nh = NULL;
 
   if (print_headings)
-    printf("TEST NUA-10.1.2: PASSED\n");
+    printf("TEST NUA-10.1.4: PASSED\n");
   
   END();
 }
@@ -558,7 +571,7 @@
 
   struct endpoint *a = &ctx->a,  *b = &ctx->b;
   struct call *a_call = a->call, *b_call = b->call;
-  struct event *e;
+  struct event *e, *ei, *ep;
 
   if (print_headings)
     printf("TEST NUA-10.2.1: Call with 100rel, 183 and 180\n");
@@ -590,26 +603,43 @@
   TEST_1(is_answer_recv(e->data->e_tags));
   TEST_1(!is_offer_sent(e->data->e_tags));
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
-  TEST(e->data->e_status, 200);
+  TEST_1(e = e->next);
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  ep = e->data->e_event == nua_r_prack ? e : NULL;
+
+  if (ep) {
+    TEST(ep->data->e_status, 200); TEST_1(e = e->next);
+  }
+
+  TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 180);
 
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
   TEST_1(!is_offer_answer_done(e->data->e_tags));
+  
+  if (!ep) {
+    TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+    TEST(e->data->e_status, 200);
+  }
+    
+  ei = event_by_type(e->next, nua_r_invite);
+  ep = event_by_type(e->next, nua_r_prack);
+  if (!ep) {
+    run_a_until(ctx, -1, until_final_response);
+    ep = event_by_type(e->next, nua_r_prack);
+  }
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+  TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_prack);
   TEST(e->data->e_status, 200);
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
 
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
   TEST_1(!is_offer_answer_done(e->data->e_tags));
-  TEST_1(!e->next);
+  TEST_1(!e->next || !ep->next);
   free_events_in_list(ctx, a->events);
 
   /*
@@ -879,7 +909,7 @@
 
   struct endpoint *a = &ctx->a,  *b = &ctx->b;
   struct call *a_call = a->call, *b_call = b->call;
-  struct event *e;
+  struct event *e, *ep, *ei;
   sip_t *sip;
 
   if (print_headings)
@@ -969,7 +999,10 @@
   TEST_1(!is_answer_recv(e->data->e_tags));
   TEST_1(is_offer_sent(e->data->e_tags));
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_update);
+  ei = event_by_type(e->next, nua_r_invite);
+  ep = event_by_type(e->next, nua_r_update);
+
+  TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_update);
   TEST(e->data->e_status, 200);
   TEST_1(sip = sip_object(e->data->e_msg));
   TEST_1(sip->sip_session_expires);
@@ -979,17 +1012,27 @@
   TEST_1(is_answer_recv(e->data->e_tags));
   TEST_1(!is_offer_sent(e->data->e_tags));
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 180);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
   TEST_1(!is_offer_answer_done(e->data->e_tags));
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+  if (e == ep)			/* invite was responded before update */
+    e = ep->next->next;
+
+  ei = event_by_type(e->next, nua_r_invite);
+  ep = event_by_type(e->next, nua_r_prack);
+  if (!ep) {
+    run_a_until(ctx, -1, until_final_response);
+    ep = event_by_type(e->next, nua_r_prack);
+  }
+
+  TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_prack);
   TEST(e->data->e_status, 200);
   /* Does not have effect on call state */
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   TEST_1(sip = sip_object(e->data->e_msg));
   if (ctx->proxy_tests) {
@@ -1001,7 +1044,7 @@
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
   TEST_1(!is_offer_answer_done(e->data->e_tags));
-  TEST_1(!e->next);
+  TEST_1(!e->next || !ep->next);
   free_events_in_list(ctx, a->events);
 
   /*
@@ -1169,7 +1212,7 @@
 
   struct endpoint *a = &ctx->a,  *b = &ctx->b;
   struct call *a_call = a->call, *b_call = b->call;
-  struct event *e;
+  struct event *e, *eu, *ei;
 
   if (print_headings)
     printf("TEST NUA-10.4.1: Call with preconditions and non-100rel 180\n");
@@ -1253,22 +1296,25 @@
   TEST_1(!is_answer_recv(e->data->e_tags));
   TEST_1(is_offer_sent(e->data->e_tags));
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_update);
-  TEST(e->data->e_status, 200);
+  eu = event_by_type(e->next, nua_r_update);
+  ei = event_by_type(e->next, nua_r_invite);
 
+  TEST_1(e = eu); TEST_E(e->data->e_event, nua_r_update);
+  TEST(e->data->e_status, 200);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
   TEST_1(is_answer_recv(e->data->e_tags));
   TEST_1(!is_offer_sent(e->data->e_tags));
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 180);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
   TEST_1(!is_offer_answer_done(e->data->e_tags));
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
-  TEST(e->data->e_status, 200);
+  TEST_1(e = eu->next->next == ei ? ei->next->next : eu->next->next);
+
+  TEST_E(e->data->e_event, nua_r_invite); TEST(e->data->e_status, 200);
 
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
@@ -1445,7 +1491,7 @@
 
   struct endpoint *a = &ctx->a,  *b = &ctx->b;
   struct call *a_call = a->call, *b_call = b->call;
-  struct event *e;
+  struct event *e, *ep, *ei;
   sip_t *sip;
 
   /* -------------------------------------------------------------------- */
@@ -1563,11 +1609,18 @@
   TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
   TEST_1(!is_offer_answer_done(e->data->e_tags));
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_prack);
+  ei = event_by_type(e->next, nua_r_invite);
+  ep = event_by_type(e->next, nua_r_prack);
+  if (!ep) {
+    run_a_until(ctx, -1, until_final_response);
+    ep = event_by_type(e->next, nua_r_prack);
+  }
+
+  TEST_1(e = ep); TEST_E(e->data->e_event, nua_r_prack);
   TEST(e->data->e_status, 200);
   /* Does not have effect on call state */
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  TEST_1(e = ei); TEST_E(e->data->e_event, nua_r_invite);
   TEST(e->data->e_status, 200);
   if (ctx->proxy_tests) {
     TEST_1(sip = sip_object(e->data->e_msg));
@@ -1579,7 +1632,7 @@
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
   TEST_1(!is_offer_answer_done(e->data->e_tags));
-  TEST_1(!e->next);
+  TEST_1(!e->next || !ep->next);
   free_events_in_list(ctx, a->events);
 
   /*
@@ -1846,7 +1899,7 @@
 
   struct endpoint *a = &ctx->a,  *b = &ctx->b;
   struct call *a_call = a->call, *b_call = b->call;
-  struct event *e;
+  struct event *e, *ep, *ec;
 
   if (print_headings)
     printf("TEST NUA-10.7: CANCEL after 100rel 180\n");
@@ -1911,17 +1964,21 @@
   TEST_1(is_answer_recv(e->data->e_tags));
   TEST_1(!is_offer_sent(e->data->e_tags));
 
-#define NEXT_SKIP_PRACK_CANCEL() \
+#define NEXT_SKIP(x) \
   do { TEST_1(e = e->next); } \
-  while (e->data->e_event == nua_r_prack || e->data->e_event == nua_r_cancel)
+  while (x);
 
-  NEXT_SKIP_PRACK_CANCEL();
+  NEXT_SKIP(e->data->e_event == nua_r_prack ||
+	    e->data->e_event == nua_r_cancel ||
+	    e->data->e_event == nua_i_state);
 
   TEST_E(e->data->e_event, nua_r_invite);
   if (e->data->e_status == 487) {
     TEST(e->data->e_status, 487);
     TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
     TEST(callstate(e->data->e_tags), nua_callstate_terminated);
+    if (e->next)
+      NEXT_SKIP(e->data->e_event == nua_r_prack || e->data->e_event == nua_r_cancel);
     TEST_1(!e->next);
   }
   else {
@@ -1932,7 +1989,8 @@
     BYE(a, a_call, a_call->nh, TAG_END());
     run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
 
-    NEXT_SKIP_PRACK_CANCEL(); TEST_E(e->data->e_event, nua_r_bye);
+    NEXT_SKIP(e->data->e_event == nua_r_prack || e->data->e_event == nua_r_cancel);
+    TEST_E(e->data->e_event, nua_r_bye);
     TEST(e->data->e_status, 200);
     TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
     TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
@@ -1963,18 +2021,20 @@
   TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
   TEST_1(is_answer_sent(e->data->e_tags));
 
-  /* 180 is PRACKed */
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_prack);
-  /* Does not have effect on call state */
+  ec = event_by_type(e->next, nua_i_cancel);
 
-  if (e->next->data->e_event == nua_i_cancel) {
-    TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_cancel);
+  if (ec) {
+    TEST_1(e = ec); TEST_E(e->data->e_event, nua_i_cancel);
     TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
     TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
   }
   else {
-    /* Respond with 200 OK */
-    TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+    /* 180 is PRACKed, PRACK does not have effect on call state */
+    ep = event_by_type(e->next, nua_i_prack);
+    if (ep) e = ep;
+    /* Responded with 200 OK */
+    TEST_1(e = event_by_type(e->next, nua_i_state));
+    TEST_E(e->data->e_event, nua_i_state);
     TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
     TEST_1(!is_offer_answer_done(e->data->e_tags));
     TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_ack);

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c	Wed Jun 20 13:06:05 2007
@@ -1100,7 +1100,7 @@
   nua_handle_destroy(b_call->nh), b_call->nh = NULL;
 
   if (print_headings)
-    printf("TEST NUA-3.4: PASSED\n");
+    printf("TEST NUA-3.5: PASSED\n");
 
   END();
 }

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c	Wed Jun 20 13:06:05 2007
@@ -1520,7 +1520,7 @@
     test_reject_302(ctx) ||
     test_reject_401(ctx) ||
     test_mime_negotiation(ctx) ||
-    test_call_timeouts(ctx) ||
     test_reject_401_aka(ctx) ||
+    test_call_timeouts(ctx) ||
     0;
 }

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c	Wed Jun 20 13:06:05 2007
@@ -1349,11 +1349,14 @@
   struct endpoint *a = &ctx->a,  *b = &ctx->b;
   struct call *a_call = a->call, *b_call = b->call;
   struct event *e;
+  sip_t *sip = NULL;
+
+  int seen_401;
 
   a_call->sdp = "m=audio 5008 RTP/AVP 8";
   b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
 
-/* Early BYE 2
+/* Bad Contact URI
 
    A			B
    |-------INVITE------>|
@@ -1362,14 +1365,17 @@
    |<----180 Ringing----|
    |<-------200---------|
    |			|
-   |--------BYE-------->|
-   |<------200 OK-------|
    |--------ACK-------->|
    |			|
+   |<-------BYE---------|
+   |--------400-------->|
+   |			|
+   |--------BYE-------->|
+   |<------200 OK-------|
    |			|
 */
   if (print_headings)
-    printf("TEST NUA-6.4.3: BYE call when completing\n");
+    printf("TEST NUA-6.4.3: Test dialog with bad Contact info\n");
 
   TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
 
@@ -1448,6 +1454,42 @@
   if (print_headings)
     printf("TEST NUA-6.4.3: PASSED\n");
 
+  if (!ctx->p)
+    return 0;
+
+  if (print_headings)
+    printf("TEST NUA-6.4.4: Wait for re-REGISTER after connection has been closed\n");
+
+  /* B is supposed to re-register pretty soon, wait for re-registration */
+
+  run_b_until(ctx, -1, save_until_final_response);
+
+  seen_401 = 0;
+
+  for (e = b->events->head; e; e = e->next) {
+    TEST_E(e->data->e_event, nua_r_register);
+    TEST_1(sip = sip_object(e->data->e_msg));
+
+    if (e->data->e_status == 200) {
+      TEST(e->data->e_status, 200);
+      TEST_1(seen_401);
+      TEST_1(sip->sip_contact);
+    }
+    else if (sip->sip_status && sip->sip_status->st_status == 401) {
+      seen_401 = 1;
+    }
+
+    if (!e->next)
+      break;
+  }
+  TEST_1(e);
+  TEST_S(sip->sip_contact->m_expires, "3600");
+  TEST_1(!e->next);
+  free_events_in_list(ctx, b->events);
+
+  if (print_headings)
+    printf("TEST NUA-6.4.4: PASSED\n");
+
   END();
 }
 

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_init.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_init.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_init.c	Wed Jun 20 13:06:05 2007
@@ -70,8 +70,9 @@
   sip_allow_t const *allow = NULL;
   sip_supported_t const *supported = NULL;
   char const *appl_method = NULL;
-  url_t const *p_uri, *a_uri;		/* Proxy URI */
+  url_t const *p_uri, *a_uri, *b_uri;		/* Proxy URI */
   char const *a_bind, *a_bind2;
+  url_t b_proxy[1];
 
   a_bind = a_bind2 = "sip:0.0.0.0:*";
 
@@ -121,7 +122,7 @@
       printf("TEST NUA-2.1.1: PASSED\n");
   }
 
-  p_uri = a_uri = test_proxy_uri(ctx->p);
+  p_uri = a_uri = b_uri = test_proxy_uri(ctx->p);
 
   if (start_nat && p_uri == NULL)
     p_uri = url_hdup(ctx->home, (void *)o_proxy);
@@ -257,8 +258,15 @@
 
   ctx->b.instance = nua_generate_instance_identifier(ctx->home);
 
+  if (ctx->p) {
+    /* B uses TCP when talking with proxy */
+    *b_proxy = *b_uri;
+    b_uri = b_proxy;
+    b_proxy->url_params = "transport=tcp";
+  }
+
   ctx->b.nua = nua_create(ctx->root, b_callback, ctx,
-			  NUTAG_PROXY(p_uri ? p_uri : o_proxy),
+			  NUTAG_PROXY(b_uri ? b_uri : o_proxy),
 			  SIPTAG_FROM_STR("sip:bob at example.org"),
 			  NUTAG_URL("sip:0.0.0.0:*"),
 			  SOATAG_USER_SDP_STR("m=audio 5006 RTP/AVP 8 0"),

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c	Wed Jun 20 13:06:05 2007
@@ -211,6 +211,18 @@
     else if (strcmp(argv[i], "--loop") == 0) {
       o_alarm = 0, o_loop = 1;
     }
+    else if (strcmp(argv[i], "--print-tags") == 0) {
+      ctx->print_tags = 1;
+    }
+    else if (strcmp(argv[i], "--tags=a") == 0) {
+      ctx->a.print_tags = 1;
+    }
+    else if (strcmp(argv[i], "--tags=b") == 0) {
+      ctx->b.print_tags = 1;
+    }
+    else if (strcmp(argv[i], "--tags=c") == 0) {
+      ctx->c.print_tags = 1;
+    }
     else if (strcmp(argv[i], "--log=a") == 0) {
       ctx->a.logging = 1;
     }
@@ -317,8 +329,8 @@
       retval |= test_rejects(ctx); SINGLE_FAILURE_CHECK();
       retval |= test_call_cancel(ctx); SINGLE_FAILURE_CHECK();
       retval |= test_call_destroy(ctx); SINGLE_FAILURE_CHECK();
-      retval |= test_offer_answer(ctx); SINGLE_FAILURE_CHECK();
       retval |= test_early_bye(ctx); SINGLE_FAILURE_CHECK();
+      retval |= test_offer_answer(ctx); SINGLE_FAILURE_CHECK();
       retval |= test_reinvites(ctx); SINGLE_FAILURE_CHECK();
       retval |= test_session_timer(ctx); SINGLE_FAILURE_CHECK();
       retval |= test_refer(ctx); SINGLE_FAILURE_CHECK();

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.h
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.h	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.h	Wed Jun 20 13:06:05 2007
@@ -124,6 +124,7 @@
   su_root_t *root;
 
   int threading, proxy_tests, expensive, quit_on_single_failure, osx_runloop;
+  int print_tags;
   char const *external_proxy;
 
   int proxy_logging;
@@ -133,6 +134,7 @@
     struct context *ctx;	/* Backpointer */
 
     int logging;
+    int print_tags;
 
     int running;
 
@@ -196,6 +198,9 @@
 			struct eventlist *list,
 			struct event *e);
 
+struct event *event_by_type(struct event *e, nua_event_t);
+size_t count_events(struct event const *e);
+
 #define CONDITION_PARAMS			\
   nua_event_t event,				\
   int status, char const *phrase,		\

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c	Wed Jun 20 13:06:05 2007
@@ -190,7 +190,8 @@
 	      ep->name, (void *)nh, operation);
   }
 
-  if ((tstflags & tst_verbatim) && tags)
+  if (tags && 
+      ((tstflags & tst_verbatim) || ctx->print_tags || ep->print_tags))
     tl_print(stderr, "", tags);
 }
 
@@ -499,6 +500,27 @@
   }
 }			      
 
+struct event *event_by_type(struct event *e, nua_event_t etype)
+{
+  for (; e; e = e->next) {
+    if (e->data->e_event == etype)
+      break;
+  }
+
+  return e;
+}
+
+size_t count_events(struct event const *e)
+{
+  size_t n;
+
+  for (n = 0; e; e = e->next)
+    n++;
+
+  return n;
+}
+
+
 int is_special(nua_event_t e)
 {
   if (e == nua_i_active || e == nua_i_terminated)

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c	Wed Jun 20 13:06:05 2007
@@ -53,6 +53,8 @@
 #include <sofia-sip/su_tagarg.h>
 #include <sofia-sip/msg_addr.h>
 #include <sofia-sip/hostdomain.h>
+#include <sofia-sip/tport.h>
+#include <sofia-sip/nta_tport.h>
 
 #include <stdlib.h>
 #include <assert.h>
@@ -111,6 +113,8 @@
     sip_time_t min_expires, expires, max_expires;
     
     sip_time_t session_expires, min_se;
+
+    int outbound_tcp;		/**< Use inbound TCP connection as outbound */
   } prefs;
 }; 
 
@@ -119,7 +123,6 @@
 							 url_t const *);
 static void registration_entry_destroy(struct registration_entry *e);
 
-
 struct registration_entry
 {
   struct registration_entry *next, **prev;
@@ -132,14 +135,16 @@
 struct binding
 {
   struct binding *next, **prev;
-  sip_contact_t *contact;	/* bindings */
+  sip_contact_t *contact;	/* binding */
   sip_time_t registered, expires; /* When registered and when expires */
-  sip_call_id_t *call_id;	
+  sip_call_id_t *call_id;
   uint32_t cseq;
+  tport_t *tport;		/**< Reference to tport */
 };
 
 static struct binding *binding_new(su_home_t *home, 
 				   sip_contact_t *contact,
+				   tport_t *tport,
 				   sip_call_id_t *call_id,
 				   uint32_t cseq,
 				   sip_time_t registered, 
@@ -147,7 +152,9 @@
 static void binding_destroy(su_home_t *home, struct binding *b);
 static int binding_is_active(struct binding const *b)
 {
-  return b->expires > sip_now();
+  return
+    b->expires > sip_now() && 
+    (b->tport == NULL || tport_is_clear_to_send(b->tport));
 }
 
 LIST_PROTOS(static, proxy_transaction, struct proxy_transaction);
@@ -195,6 +202,8 @@
 static struct registration_entry *
 registration_entry_find(struct proxy const *proxy, url_t const *uri);
 
+static int close_tports(void *proxy);
+
 static auth_challenger_t registrar_challenger[1];
 static auth_challenger_t proxy_challenger[1];
 
@@ -268,6 +277,8 @@
   proxy->prefs.session_expires = 180;
   proxy->prefs.min_se = 90;
 
+  proxy->prefs.outbound_tcp = 1;
+
   if (!proxy->defleg || 
       !proxy->example_net || !proxy->example_org || !proxy->example_com)
     return -1;
@@ -302,11 +313,11 @@
     nta_outgoing_destroy(t->client), t->client = NULL;
   }
 
-  nta_agent_destroy(proxy->agent);
-
   while (proxy->entries)
     registration_entry_destroy(proxy->entries);
 
+  nta_agent_destroy(proxy->agent);
+
   free(proxy->tags);
 }
 
@@ -396,6 +407,38 @@
   }
 }
 
+void test_proxy_set_outbound(struct proxy *p,
+			     int use_outbound)
+{
+  if (p) {
+    p->prefs.outbound_tcp = use_outbound;
+  }
+}
+
+void test_proxy_get_outbound(struct proxy *p,
+			     int *return_use_outbound)
+{
+  if (p) {
+    if (return_use_outbound)
+      *return_use_outbound = p->prefs.outbound_tcp;
+  }
+}
+
+int test_proxy_close_tports(struct proxy *p)
+{
+  if (p) {
+    int retval = -EPROTO;
+
+    su_task_execute(su_clone_task(p->clone), close_tports, p, &retval);
+
+    if (retval < 0)
+      return errno = -retval, -1;
+    else
+      return 0;
+  }
+  return errno = EFAULT, -1;
+}
+
 /* ---------------------------------------------------------------------- */
 
 static sip_contact_t *create_transport_contacts(struct proxy *p)
@@ -449,6 +492,7 @@
   sip_session_expires_t *x = NULL, x0[1];
   sip_min_se_t *min_se = NULL, min_se0[1];
   char const *require = NULL;
+  tport_t *tport = NULL;
 
   mf = sip->sip_max_forwards;
 
@@ -529,8 +573,9 @@
       nta_incoming_treply(irq, SIP_480_TEMPORARILY_UNAVAILABLE, TAG_END());
       return 480;
     }
-    
+
     target = b->contact->m_url;
+    tport = b->tport;
   }
 
   t = proxy_transaction_new(proxy);
@@ -560,6 +605,7 @@
 				   SIPTAG_SESSION_EXPIRES(x),
 				   SIPTAG_MIN_SE(min_se),
 				   SIPTAG_REQUIRE_STR(require),
+				   NTATAG_TPORT(tport),
 				   TAG_END());
   if (t->client == NULL) {
     proxy_transaction_destroy(t);
@@ -734,9 +780,10 @@
 static int check_out_of_order(struct proxy *p, auth_status_t *as,
 			      struct registration_entry *e, sip_t const *);
 static int binding_update(struct proxy *p,
-       		   auth_status_t *as,
-       		   struct registration_entry *e,
-       		   sip_t const *sip);
+			  auth_status_t *as,
+			  struct registration_entry *e,
+			  nta_incoming_t *irq,
+			  sip_t const *sip);
 
 sip_contact_t *binding_contacts(su_home_t *home, struct binding *bindings);
 
@@ -768,10 +815,11 @@
   assert(as->as_status >= 200);
 
   nta_incoming_treply(irq,
-       	       as->as_status, as->as_phrase,
-       	       SIPTAG_HEADER((void *)as->as_info),
-       	       SIPTAG_HEADER((void *)as->as_response),
-       	       TAG_END());
+		      as->as_status, as->as_phrase,
+		      SIPTAG_HEADER((void *)as->as_info),
+		      SIPTAG_HEADER((void *)as->as_response),
+		      TAG_END());
+
   status = as->as_status;
 
   su_home_unref(as->as_home);
@@ -816,7 +864,7 @@
   if (!e)
     return set_status(as, SIP_500_INTERNAL_SERVER_ERROR);
 
-  if (binding_update(p, as, e, sip))
+  if (binding_update(p, as, e, irq, sip))
     return as->as_status;
 
   msg_header_free(p->home, (void *)e->contacts);
@@ -954,6 +1002,7 @@
 static
 struct binding *binding_new(su_home_t *home, 
 			    sip_contact_t *contact,
+			    tport_t *tport,
 			    sip_call_id_t *call_id,
 			    uint32_t cseq,
 			    sip_time_t registered, 
@@ -968,6 +1017,7 @@
     *m = *contact; m->m_next = NULL;
 
     b->contact = sip_contact_dup(home, m);
+    b->tport = tport_ref(tport);
     b->call_id = sip_call_id_dup(home, call_id);
     b->cseq = cseq;
     b->registered = registered;
@@ -992,6 +1042,7 @@
   }
   msg_header_free(home, (void *)b->contact);
   msg_header_free(home, (void *)b->call_id);
+  tport_unref(b->tport);
   su_free(home, b);
 }
 
@@ -999,16 +1050,21 @@
 int binding_update(struct proxy *p,
 		   auth_status_t *as,
 		   struct registration_entry *e,
+		   nta_incoming_t *irq,
 		   sip_t const *sip)
 {
   struct binding *b, *old, *next, *last, *bindings = NULL, **bb = &bindings;
   sip_contact_t *m;
   sip_time_t expires;
-
   sip_time_t now = sip_now();
+  tport_t *tport = NULL;
 
   assert(sip->sip_contact);
 
+  if (p->prefs.outbound_tcp && 
+      str0casecmp(sip->sip_via->v_protocol, sip_transport_tcp) == 0)
+    tport = nta_incoming_transport(p->agent, irq, NULL);
+
   /* Create new bindings */
   for (m = sip->sip_contact; m; m = m->m_next) {
     if (m->m_url->url_type == url_any)
@@ -1022,7 +1078,7 @@
 
     msg_header_remove_param(m->m_common, "expires");
 
-    b = binding_new(p->home, m, sip->sip_call_id, sip->sip_cseq->cs_seq, 
+    b = binding_new(p->home, m, tport, sip->sip_call_id, sip->sip_cseq->cs_seq, 
 		    now, now + expires);
     if (!b)
       break;
@@ -1030,6 +1086,8 @@
     *bb = b, b->prev = bb, bb = &b->next;
   }
 
+  tport_unref(tport);
+
   last = NULL;
 
   if (m == NULL) {
@@ -1095,3 +1153,25 @@
 
   return retval;
 }
+
+/* ---------------------------------------------------------------------- */
+
+static int close_tports(void *_proxy)
+{
+  struct proxy *p = _proxy;
+  struct registration_entry *e;
+  struct binding *b;
+  
+  /* Close all outbound transports */
+  for (e = p->entries; e; e = e->next) {
+    for (b = e->bindings; b; b = b->next) {
+      if (b->tport) {
+	tport_shutdown(b->tport, 2);
+	tport_unref(b->tport);
+	b->tport = NULL;
+      }
+    }
+  }
+  
+  return 0;
+}

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h	Wed Jun 20 13:06:05 2007
@@ -56,6 +56,8 @@
 				  sip_time_t *return_session_expires,
 				  sip_time_t *return_min_se);
 
+int test_proxy_close_tports(struct proxy *p);
+
 SOFIA_END_DECLS
 
 #endif

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_refer.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_refer.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_refer.c	Wed Jun 20 13:06:05 2007
@@ -113,7 +113,7 @@
   struct call *a_call = a->call, *b_call = b->call, *c_call = c->call;
   struct call *a_refer, *a_c2, *b_refer;
   struct eventlist *a_revents, *b_revents;
-  struct event *e;
+  struct event *e, *notify_e;
   sip_t const *sip;
   sip_event_t const *a_event, *b_event;
   sip_refer_to_t const *refer_to;
@@ -280,21 +280,38 @@
 	       TAG_END()), 1);
   TEST_1(b_event); TEST_1(b_event->o_id);
   TEST_1(b_event = sip_event_dup(tmphome, b_event));
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_refer);
+
+  notify_e = NULL;
+
+  TEST_1(e = e->next);
+  if (e->data->e_event == nua_i_notify) {
+    notify_e = e;
+    TEST_1(e = e->next);
+  }
+  TEST_E(e->data->e_event, nua_r_refer);
   TEST(e->data->e_status, 202);
   TEST_1(sip = sip_object(e->data->e_msg));
   TEST_SIZE(strtoul(b_event->o_id, NULL, 10), sip->sip_cseq->cs_seq);
 
   if (a_refer != a_call) {
-    if (b_revents->head->next->next == NULL)
-      run_ab_until(ctx, -1, save_until_received, nua_i_notify, save_events);
-    else if (a_revents->head->next == NULL)
+    while (!notify_e) {
+      for (e = b_revents->head; e; e = e->next) {
+	if (e->data->e_event == nua_i_notify) {
+	  notify_e = e;
+	  break;
+	}
+      }
+      if (!notify_e)
+	run_ab_until(ctx, -1, save_until_received, nua_i_notify, save_events);
+    }
+
+    if (a_revents->head->next == NULL)
       run_a_until(ctx, -1, save_until_received);
 
     TEST_1(e = a_revents->head->next); TEST_E(e->data->e_event, nua_r_notify);
     TEST_1(!e->next);
 
-    TEST_1(e = b_revents->head->next->next);
+    TEST_1(e = notify_e);
     TEST_E(e->data->e_event, nua_i_notify);
     TEST(e->data->e_status, 200);
     TEST_1(sip = sip_object(e->data->e_msg));
@@ -304,8 +321,8 @@
     TEST_1(sip->sip_subscription_state);
     TEST_S(sip->sip_subscription_state->ss_substate, "pending");
     TEST_1(sip->sip_payload && sip->sip_payload->pl_data);
-    TEST_S(sip->sip_payload->pl_data, "SIP/2.0 100 Trying\r\n");
-    TEST_1(!e->next);
+    TEST_M(sip->sip_payload->pl_data, "SIP/2.0 100 Trying\r\n",
+	   sip->sip_payload->pl_len);
   }
 
   free_events_in_list(ctx, a_revents);
@@ -363,7 +380,8 @@
   TEST_1(sip->sip_subscription_state);
   TEST_S(sip->sip_subscription_state->ss_substate, "pending");
   TEST_1(sip->sip_payload && sip->sip_payload->pl_data);
-  TEST_S(sip->sip_payload->pl_data, "SIP/2.0 100 Trying\r\n");
+  TEST_M(sip->sip_payload->pl_data, "SIP/2.0 100 Trying\r\n",
+	 sip->sip_payload->pl_len);
   TEST_1(e = e->next);
   }
   TEST_E(e->data->e_event, nua_r_subscribe);
@@ -476,7 +494,7 @@
   TEST_1(sip->sip_subscription_state);
   TEST_S(sip->sip_subscription_state->ss_substate, "active");
   TEST_1(sip->sip_payload && sip->sip_payload->pl_data);
-  TEST_S(sip->sip_payload->pl_data, "SIP/2.0 180 Ringing\r\n");
+  TEST_M(sip->sip_payload->pl_data, "SIP/2.0 180 Ringing\r\n", sip->sip_payload->pl_len);
   TEST_1(sip->sip_event);
   if (refer_with_id)
     TEST_S(sip->sip_event->o_id, b_event->o_id);
@@ -486,7 +504,7 @@
   TEST_1(sip->sip_subscription_state);
   TEST_S(sip->sip_subscription_state->ss_substate, "terminated");
   TEST_1(sip->sip_payload && sip->sip_payload->pl_data);
-  TEST_S(sip->sip_payload->pl_data, "SIP/2.0 200 OK\r\n");
+  TEST_M(sip->sip_payload->pl_data, "SIP/2.0 200 OK\r\n", sip->sip_payload->pl_len);
   TEST_1(sip->sip_event);
   if (refer_with_id)
     TEST_S(sip->sip_event->o_id, b_event->o_id);

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c	Wed Jun 20 13:06:05 2007
@@ -200,6 +200,10 @@
     m->m_display = "B";
     m->m_url->url_user = "b";
 
+    /* Include "tcp" transport parameter in Contact */
+    if (ctx->p)
+      m->m_url->url_params = "transport=tcp";
+
     REGISTER(b, b_reg, b_reg->nh, SIPTAG_TO(b->to), 
 	     SIPTAG_CONTACT(m),
 	     /* Do not include credentials unless challenged */
@@ -229,11 +233,14 @@
   TEST_S(sip->sip_contact->m_display, "B");
   TEST_S(sip->sip_contact->m_url->url_user, "b");
   free_events_in_list(ctx, b->events);
+
   if (print_headings)
     printf("TEST NUA-2.3.2: PASSED\n");
 
-  if (ctx->p)
+  if (ctx->p) {
+    test_proxy_close_tports(ctx->p);
     test_proxy_set_expiration(ctx->p, 600, 3600, 36000);
+  }
 
   if (print_headings)
     printf("TEST NUA-2.3.3: REGISTER c\n");

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c	Wed Jun 20 13:06:05 2007
@@ -1194,7 +1194,7 @@
 
   struct endpoint *a = &ctx->a,  *b = &ctx->b;
   struct call *a_call = a->call, *b_call = b->call;
-  struct event *e;
+  struct event *e, *en, *es;
   sip_t const *sip;
   tagi_t const *n_tags, *r_tags;
 
@@ -1220,22 +1220,16 @@
   /* Client events:
      nua_method(), nua_i_notify/nua_r_method, nua_i_notify
   */
-  TEST_1(e = a->events->head);
-  if (e->data->e_event == nua_i_notify) {
-    TEST_E(e->data->e_event, nua_i_notify);
-    TEST_1(sip = sip_object(e->data->e_msg));
-    n_tags = e->data->e_tags;
-    TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_subscribe);
-    r_tags = e->data->e_tags;
-  }
-  else {
-    TEST_E(e->data->e_event, nua_r_method);
-    TEST(e->data->e_status, 202);
-    r_tags = e->data->e_tags;
-    TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
-    TEST_1(sip = sip_object(e->data->e_msg));
-    n_tags = e->data->e_tags;
-  }
+  TEST_1(en = event_by_type(a->events->head, nua_i_notify));
+  TEST_1(es = event_by_type(a->events->head, nua_r_method));
+
+  TEST_1(e = en); TEST_E(e->data->e_event, nua_i_notify);
+  TEST_1(sip = sip_object(e->data->e_msg));
+  n_tags = e->data->e_tags;
+
+  TEST_1(e = es); TEST_E(e->data->e_event, nua_r_method);
+  r_tags = e->data->e_tags;
+
   TEST_1(sip->sip_event); TEST_S(sip->sip_event->o_type, "presence");
   TEST_1(sip->sip_content_type);
   TEST_S(sip->sip_content_type->c_type, "application/pidf+xml");
@@ -1245,7 +1239,12 @@
   TEST_1(tl_find(n_tags, nutag_substate));
   TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_pending);
 
-  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
+  if (es->next == en)
+    e = en->next;
+  else
+    e = es->next;
+
+  TEST_1(e); TEST_E(e->data->e_event, nua_i_notify);
   n_tags = e->data->e_tags;
   TEST_1(tl_find(n_tags, nutag_substate));
   TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_terminated);

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c	Wed Jun 20 13:06:05 2007
@@ -89,9 +89,9 @@
 
   struct endpoint *a = &ctx->a,  *b = &ctx->b;
   struct call *a_call = a->call, *b_call = b->call;
-  struct event *e;
+  struct event *e, *en, *es;
   sip_t const *sip;
-  tagi_t const *n_tags, *r_tags;
+  tagi_t const *t, *n_tags, *r_tags;
   url_t b_url[1];
   nea_sub_t *sub = NULL;
 
@@ -206,26 +206,25 @@
   /* Client events:
      nua_subscribe(), nua_i_notify/nua_r_subscribe
   */
-  TEST_1(e = a->events->head);
-  if (e->data->e_event == nua_i_notify) {
-    TEST_E(e->data->e_event, nua_i_notify);
-    TEST_1(sip = sip_object(e->data->e_msg));
-    n_tags = e->data->e_tags;
-    TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_subscribe);
-    r_tags = e->data->e_tags;
-    TEST_1(tl_find(r_tags, nutag_substate));
-    TEST(tl_find(r_tags, nutag_substate)->t_value, nua_substate_active);
+  TEST_1(en = event_by_type(a->events->head, nua_i_notify));
+  TEST_1(es = event_by_type(a->events->head, nua_r_subscribe));
+
+  TEST_1(e = es); TEST_E(e->data->e_event, nua_r_subscribe);
+  r_tags = e->data->e_tags;
+  TEST_1(tl_find(r_tags, nutag_substate));
+  if (es->next == en) {
+    TEST_1(200 <= e->data->e_status && e->data->e_status < 300);
+    TEST(tl_find(r_tags, nutag_substate)->t_value, nua_substate_embryonic);
   }
   else {
-    TEST_E(e->data->e_event, nua_r_subscribe);
-    TEST(e->data->e_status, 202);
-    r_tags = e->data->e_tags;
-    TEST_1(tl_find(r_tags, nutag_substate));
-    TEST(tl_find(r_tags, nutag_substate)->t_value, nua_substate_embryonic);
-    TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
-    TEST_1(sip = sip_object(e->data->e_msg));
-    n_tags = e->data->e_tags;
+    TEST_1(200 <= e->data->e_status && e->data->e_status < 300);
+    TEST(tl_find(r_tags, nutag_substate)->t_value, nua_substate_active);
   }
+
+  TEST_1(e = en); TEST_E(e->data->e_event, nua_i_notify);
+  TEST_1(sip = sip_object(e->data->e_msg));
+  n_tags = e->data->e_tags;
+
   TEST_1(sip->sip_event); TEST_S(sip->sip_event->o_type, "presence");
   TEST_1(sip->sip_content_type);
   TEST_S(sip->sip_content_type->c_type, "application/pidf+xml");
@@ -234,7 +233,7 @@
   TEST_1(sip->sip_subscription_state->ss_expires);
   TEST_1(tl_find(n_tags, nutag_substate));
   TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_active);
-  TEST_1(!e->next);
+  TEST_1(!en->next || !es->next);
   free_events_in_list(ctx, a->events);
 
   if (print_headings)
@@ -302,7 +301,7 @@
 
   UNSUBSCRIBE(a, a_call, a_call->nh, TAG_END());
 
-  run_ab_until(ctx, -1, save_until_notified_and_responded,
+  run_ab_until(ctx, -1, save_until_final_response,
 	       -1, NULL /* XXX save_until_received */);
 
   /* Client events:
@@ -313,26 +312,21 @@
     TEST_E(e->data->e_event, nua_i_notify);
     TEST_1(sip = sip_object(e->data->e_msg));
     n_tags = e->data->e_tags;
-    TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_unsubscribe);
-    TEST_1(tl_find(e->data->e_tags, nutag_substate));
-    TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
-	 nua_substate_terminated);
-  }
-  else {
-    TEST_E(e->data->e_event, nua_r_unsubscribe);
-    TEST(e->data->e_status, 202);
-    TEST_1(tl_find(e->data->e_tags, nutag_substate));
-    TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
-    TEST_1(sip = sip_object(e->data->e_msg));
-    n_tags = e->data->e_tags;
+    TEST_1(sip->sip_event);
+    TEST_1(sip->sip_subscription_state);
+    TEST_S(sip->sip_subscription_state->ss_substate, "terminated");
+    TEST_1(!sip->sip_subscription_state->ss_expires);
+    TEST_1(tl_find(n_tags, nutag_substate));
+    TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_terminated);
+    TEST_1(e = e->next);
   }
-  TEST_1(sip->sip_event);
-  TEST_1(sip->sip_subscription_state);
-  TEST_S(sip->sip_subscription_state->ss_substate, "terminated");
-  TEST_1(!sip->sip_subscription_state->ss_expires);
-  TEST_1(tl_find(n_tags, nutag_substate));
-  TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_terminated);
-  TEST_1(!e->next);
+  TEST_E(e->data->e_event, nua_r_unsubscribe);
+  TEST_1(tl_find(e->data->e_tags, nutag_substate));
+  TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
+       nua_substate_terminated);
+  /* Currently, NOTIFY is dropped after successful response to unsubscribe */
+  /* But we don't really care.. */
+  /* TEST_1(!e->next); */
   free_events_in_list(ctx, a->events);
 
   if (print_headings)
@@ -383,26 +377,18 @@
   /* Client events:
      nua_subscribe(), nua_i_notify/nua_r_subscribe
   */
-  TEST_1(e = a->events->head);
-  if (e->data->e_event == nua_i_notify) {
-    TEST_E(e->data->e_event, nua_i_notify);
-    TEST_1(sip = sip_object(e->data->e_msg));
-    n_tags = e->data->e_tags;
-    TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_subscribe);
-    TEST_1(tl_find(e->data->e_tags, nutag_substate));
-    TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
-	 nua_substate_pending);
-  }
-  else {
-    TEST_E(e->data->e_event, nua_r_subscribe);
-    TEST(e->data->e_status, 202);
-    TEST_1(tl_find(e->data->e_tags, nutag_substate));
-    TEST(tl_find(e->data->e_tags, nutag_substate)->t_value,
-	 nua_substate_embryonic);
-    TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
-    TEST_1(sip = sip_object(e->data->e_msg));
-    n_tags = e->data->e_tags;
-  }
+  TEST_1(en = event_by_type(a->events->head, nua_i_notify));
+  TEST_1(es = event_by_type(a->events->head, nua_r_subscribe));
+
+  e = es; TEST_E(e->data->e_event, nua_r_subscribe);
+  TEST_1(t = tl_find(e->data->e_tags, nutag_substate));
+  TEST_1(t->t_value == nua_substate_pending ||
+	 t->t_value == nua_substate_embryonic);
+
+  e = en; TEST_E(e->data->e_event, nua_i_notify);
+  TEST_1(sip = sip_object(e->data->e_msg));
+  n_tags = e->data->e_tags;
+
   TEST_1(sip->sip_event); TEST_S(sip->sip_event->o_type, "presence");
   TEST_S(sip->sip_event->o_id, "1");
   TEST_1(sip->sip_content_type);
@@ -417,7 +403,7 @@
   TEST_1(tl_find(n_tags, nutag_substate));
   TEST(tl_find(n_tags, nutag_substate)->t_value,
        nua_substate_pending);
-  TEST_1(!e->next);
+  TEST_1(!en->next || !es->next);
   free_events_in_list(ctx, a->events);
 
   /*

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c	Wed Jun 20 13:06:05 2007
@@ -718,6 +718,9 @@
    * it is like "Contact: url:foo,sip:bar,sip:zunk"
    */
   c = *s; *s = '\0';		/* terminate temporarily */
+  /* Do not accept an empty URL */
+  if (addr_spec[0] == '\0')
+    return -1;
   if (url_d(return_url, addr_spec) == -1)
     return -1;
   *s = c;			/* return terminator */

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_tag.h.in	Wed Jun 20 13:06:05 2007
@@ -104,7 +104,7 @@
 #define SIPTAG_SIP_REF(x)   siptag_sip_ref, siptag_sip_vr(&(x))
 SOFIAPUBVAR tag_typedef_t siptag_sip_ref;
 
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 su_inline
 tag_value_t siptag_sip_v(sip_t const *v) { return (tag_value_t)v; }
 su_inline 
@@ -136,7 +136,7 @@
 #define SIPTAG_HEADER_REF(x)   siptag_header_ref, siptag_header_vr(&(x))
 SOFIAPUBVAR tag_typedef_t siptag_header_ref;
 
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 su_inline tag_value_t
 siptag_header_v(sip_header_t const *v)
 { return (tag_value_t)v; }
@@ -240,7 +240,7 @@
 #define SIPTAG_#XXXXXX#_STR_REF(x) siptag_#xxxxxx#_str_ref, tag_str_vr(&(x))
 SOFIAPUBVAR tag_typedef_t siptag_#xxxxxx#_str_ref;
 
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 su_inline tag_value_t
 siptag_#xxxxxx#_v(sip_#xxxxxx#_t const *v)
 { return (tag_value_t)v; }

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c	Wed Jun 20 13:06:05 2007
@@ -405,6 +405,8 @@
 
     TEST_1(!sip_from_create(home, (void *)"sip:joe@[baa"));
 
+    TEST_1(!sip_from_make(home, (void *)"tester <>;tag=fasjfuios"));
+
     TEST_1(f = sip_from_make(home, (void *)"sip:joe at bar (foo)"));
     su_free(home, f);
 

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c	Wed Jun 20 13:06:05 2007
@@ -80,9 +80,19 @@
 {
   soa_session_t sss_session[1];
   char *sss_audio_aux;
+  int sss_ordered_user;  /**< User SDP is ordered */
+  int sss_reuse_rejected; /**< Try to reuse rejected media line slots */
+
+  /** Mapping from user SDP m= lines to session SDP m= lines */
+  int  *sss_u2s;
+  /** Mapping from session SDP m= lines to user SDP m= lines */
+  int *sss_s2u;
 }
 soa_static_session_t;
 
+#define U2S_NOT_USED (-1)
+#define U2S_SENTINEL (-2)
+
 static int soa_static_init(char const *, soa_session_t *, soa_session_t *);
 static void soa_static_deinit(soa_session_t *);
 static int soa_static_set_params(soa_session_t *ss, tagi_t const *tags);
@@ -152,10 +162,14 @@
 {
   soa_static_session_t *sss = (soa_static_session_t *)ss;
   char const *audio_aux = sss->sss_audio_aux;
+  int ordered_user = sss->sss_ordered_user;
+  int reuse_rejected = sss->sss_reuse_rejected;
   int n, m;
 
   n = tl_gets(tags,
 	      SOATAG_AUDIO_AUX_REF(audio_aux),
+	      SOATAG_ORDERED_USER_REF(ordered_user),
+	      SOATAG_REUSE_REJECTED_REF(reuse_rejected),
 	      TAG_END());
 
   if (n > 0 && str0casecmp(audio_aux, sss->sss_audio_aux)) {
@@ -167,6 +181,9 @@
       su_free(ss->ss_home, tbf);
   }
 
+  sss->sss_ordered_user = ordered_user != 0;
+  sss->sss_reuse_rejected = reuse_rejected != 0;
+
   m = soa_base_set_params(ss, tags);
   if (m < 0)
     return m;
@@ -182,6 +199,8 @@
 
   n = tl_tgets(tags,
 	       SOATAG_AUDIO_AUX(sss->sss_audio_aux),
+	       SOATAG_ORDERED_USER(sss->sss_ordered_user),
+	       SOATAG_REUSE_REJECTED(sss->sss_reuse_rejected),
 	       TAG_END());
   m = soa_base_get_params(ss, tags);
   if (m < 0)
@@ -204,6 +223,10 @@
   tl = soa_base_get_paramlist(ss,
 			      TAG_IF(sss->sss_audio_aux,
 				     SOATAG_AUDIO_AUX(sss->sss_audio_aux)),
+			      TAG_IF(sss->sss_ordered_user,
+				     SOATAG_ORDERED_USER(1)),
+			      TAG_IF(sss->sss_reuse_rejected,
+				     SOATAG_REUSE_REJECTED(1)),
 			      TAG_NEXT(ta_args(ta)));
 
   ta_end(ta);
@@ -239,6 +262,7 @@
 }
 
 /** Generate a rejected m= line */
+static
 sdp_media_t *soa_sdp_make_rejected_media(su_home_t *home, 
 					 sdp_media_t const *m,
 					 sdp_session_t *sdp,
@@ -263,6 +287,7 @@
 
 /** Expand a @a truncated SDP.
  */
+static
 sdp_session_t *soa_sdp_expand_media(su_home_t *home,
 				    sdp_session_t const *truncated,
 				    sdp_session_t const *complete)
@@ -312,6 +337,7 @@
 }
 
 /** Check if codec is in auxiliary list */
+static
 int soa_sdp_is_auxiliary_codec(sdp_rtpmap_t const *rm, char const *auxiliary)
 {
   char const *codec;
@@ -342,68 +368,84 @@
   return 0;
 }
 
+static
+sdp_rtpmap_t *soa_sdp_media_matching_rtpmap(sdp_rtpmap_t const *from,
+					    sdp_rtpmap_t const *anylist,
+					    char const *auxiliary)
+{
+  sdp_rtpmap_t const *rm;
+
+  for (rm = anylist; rm; rm = rm->rm_next) {
+    /* Ignore auxiliary codecs */
+    if (auxiliary && soa_sdp_is_auxiliary_codec(rm, auxiliary))
+      continue;
 
-/** Find first matching media in table. */
-sdp_media_t *soa_sdp_matching(soa_session_t *ss, 
-			      sdp_media_t *mm[],
-			      sdp_media_t const *with,
-			      int *return_common_codecs)
+    if (sdp_rtpmap_find_matching(from, rm))
+      return (sdp_rtpmap_t *)rm;
+  }
+
+  return NULL;
+}
+
+#define SDP_MEDIA_NONE ((sdp_media_t *)-1)
+
+/** Find first matching media in table @a mm.
+ *
+ * - if allow_rtp_mismatch == 0, search for a matching codec 
+ * - if allow_rtp_mismatch == 1, prefer m=line with matching codec
+ * - if allow_rtp_mismatch > 1, ignore codecs
+ */
+static
+int soa_sdp_matching_mindex(soa_session_t *ss, 
+			    sdp_media_t *mm[],
+			    sdp_media_t const *with,
+			    int *return_codec_mismatch)
 {
   int i, j = -1;
-  sdp_media_t *m;
-  sdp_rtpmap_t const *rm;
   soa_static_session_t *sss = (soa_static_session_t *)ss;
-  char const *auxiliary;
+  int rtp = sdp_media_uses_rtp(with), dummy;
+  char const *auxiliary = NULL;
 
-  auxiliary = with->m_type == sdp_media_audio ? sss->sss_audio_aux : NULL;
+  if (return_codec_mismatch == NULL)
+    return_codec_mismatch = &dummy;
 
-  /* Looking for a single codec */
-  if (with->m_rtpmaps && with->m_rtpmaps->rm_next == NULL)
-    auxiliary = NULL;
+  if (with->m_type == sdp_media_audio) {
+    auxiliary = sss->sss_audio_aux;
+    /* Looking for a single codec */
+    if (with->m_rtpmaps && with->m_rtpmaps->rm_next == NULL)
+      auxiliary = NULL;
+  }
 
   for (i = 0; mm[i]; i++) {
+    if (mm[i] == SDP_MEDIA_NONE)
+      continue;
+
     if (!sdp_media_match_with(mm[i], with))
       continue;
     
-    if (!sdp_media_uses_rtp(with))
+    if (!rtp)
       break;
 
-    if (!return_common_codecs)
+    if (soa_sdp_media_matching_rtpmap(with->m_rtpmaps, 
+				      mm[i]->m_rtpmaps,
+				      auxiliary))
       break;
 
-    /* Check also rtpmaps  */
-    for (rm = mm[i]->m_rtpmaps; rm; rm = rm->rm_next) {
-      /* Ignore auxiliary codecs */
-      if (auxiliary && soa_sdp_is_auxiliary_codec(rm, auxiliary))
-	continue;
-
-      if (sdp_rtpmap_find_matching(with->m_rtpmaps, rm))
-	break;
-    }
-    if (rm)
-      break;
     if (j == -1)
       j = i;
   }
 
-  if (return_common_codecs)
-    *return_common_codecs = mm[i] != NULL;
-
-  if (mm[i] == NULL && j != -1)
-    i = j;			/* return m= line without common codecs */
-
-  m = mm[i];
-
-  for (; mm[i]; i++)
-    mm[i] = mm[i + 1];
-
-  return m;
+  if (mm[i])
+    return *return_codec_mismatch = 0, i;
+  else
+    return *return_codec_mismatch = 1, j;
 }
 
 /** Set payload types in @a l_m according to the values in @a r_m.
  * 
  * @retval number of common codecs
  */
+static
 int soa_sdp_set_rtpmap_pt(sdp_media_t *l_m, 
 			  sdp_media_t const *r_m)
 {
@@ -511,6 +553,7 @@
  *
  * @return Number of common codecs
  */
+static
 int soa_sdp_sort_rtpmap(sdp_rtpmap_t **inout_list, 
 			sdp_rtpmap_t const *rrm,
 			char const *auxiliary)
@@ -564,6 +607,7 @@
  *
  * @return Number of common codecs
  */
+static
 int soa_sdp_select_rtpmap(sdp_rtpmap_t **inout_list, 
 			  sdp_rtpmap_t const *rrm,
 			  char const *auxiliary,
@@ -597,139 +641,220 @@
   return common_codecs;
 }
 
-/** Sort and select rtpmaps within session */ 
-int soa_sdp_upgrade_rtpmaps(soa_session_t *ss,
-			    sdp_session_t *session,
-			    sdp_session_t const *remote)
+
+/** Sort and select rtpmaps  */ 
+static
+int soa_sdp_media_upgrade_rtpmaps(soa_session_t *ss,
+				  sdp_media_t *sm,
+				  sdp_media_t const *rm)
 {
   soa_static_session_t *sss = (soa_static_session_t *)ss;
+  char const *auxiliary = NULL;
+  int common_codecs;
+
+  common_codecs = soa_sdp_set_rtpmap_pt(sm, rm);
+
+  if (rm->m_type == sdp_media_audio)
+    auxiliary = sss->sss_audio_aux;
+
+  if (ss->ss_rtp_sort == SOA_RTP_SORT_REMOTE || 
+      (ss->ss_rtp_sort == SOA_RTP_SORT_DEFAULT &&
+       rm->m_mode == sdp_recvonly)) {
+    soa_sdp_sort_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary);
+  }
+
+  if (common_codecs == 0)
+    ;
+  else if (ss->ss_rtp_select == SOA_RTP_SELECT_SINGLE) {
+    soa_sdp_select_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary, 1);
+  }
+  else if (ss->ss_rtp_select == SOA_RTP_SELECT_COMMON) {
+    soa_sdp_select_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary, 0);
+  }
+
+  return common_codecs;
+}
+
+
+/** Sort and select rtpmaps within session */ 
+static
+int soa_sdp_session_upgrade_rtpmaps(soa_session_t *ss,
+				    sdp_session_t *session,
+				    sdp_session_t const *remote)
+{
   sdp_media_t *sm;
   sdp_media_t const *rm;
 
   for (sm = session->sdp_media, rm = remote->sdp_media; 
        sm && rm; 
        sm = sm->m_next, rm = rm->m_next) {
-    if (sm->m_rejected)
-      continue;
-    if (sdp_media_uses_rtp(sm)) {
-      int common_codecs = soa_sdp_set_rtpmap_pt(sm, rm);
-
-      char const *auxiliary =
-	rm->m_type == sdp_media_audio ? sss->sss_audio_aux : NULL;
-
-      if (ss->ss_rtp_sort == SOA_RTP_SORT_REMOTE || 
-	  (ss->ss_rtp_sort == SOA_RTP_SORT_DEFAULT &&
-	   rm->m_mode == sdp_recvonly)) {
-	soa_sdp_sort_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary);
-      }
-
-      if (common_codecs == 0)
-	;
-      else if (ss->ss_rtp_select == SOA_RTP_SELECT_SINGLE) {
-	soa_sdp_select_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary, 1);
-      }
-      else if (ss->ss_rtp_select == SOA_RTP_SELECT_COMMON) {
-	soa_sdp_select_rtpmap(&sm->m_rtpmaps, rm->m_rtpmaps, auxiliary, 0);
-      }
-    }
+    if (!sm->m_rejected && sdp_media_uses_rtp(sm))
+      soa_sdp_media_upgrade_rtpmaps(ss, sm, rm);
   }
 
   return 0;
 }
 
-
 /** Upgrade m= lines within session */ 
+static
 int soa_sdp_upgrade(soa_session_t *ss,
 		    su_home_t *home,
 		    sdp_session_t *session,
-		    sdp_session_t const *caps,
-		    sdp_session_t const *upgrader)
+		    sdp_session_t const *user,
+		    sdp_session_t const *remote,
+		    int **return_u2s,
+		    int **return_s2u)
 {
   soa_static_session_t *sss = (soa_static_session_t *)ss;
 
-  int Ns, Nc, Nu, size, i, j;
-  sdp_media_t *m, **mm, *cm;
-  sdp_media_t **s_media, **o_media, **c_media;
-  sdp_media_t const **u_media;
+  int Ns, Nu, Nr, size, i, j;
+  sdp_media_t *m, **mm, *um;
+  sdp_media_t **s_media, **o_media, **u_media;
+  sdp_media_t const *rm, **r_media;
+  int *u2s = NULL, *s2u = NULL;
+
+  if (session == NULL || user == NULL)
+    return (errno = EFAULT), -1;
 
   Ns = sdp_media_count(session, sdp_media_any, 0, 0, 0);
-  Nc = sdp_media_count(caps, sdp_media_any, 0, 0, 0);
-  Nu = sdp_media_count(upgrader, sdp_media_any, 0, 0, 0);
+  Nu = sdp_media_count(user, sdp_media_any, 0, 0, 0);
+  Nr = sdp_media_count(remote, sdp_media_any, 0, 0, 0);
 
-  if (caps == upgrader)
-    size = Ns + Nc + 1;
-  else if (Ns < Nu)
-    size = Nu + 1;
+  if (remote == NULL)
+    size = Ns + Nu + 1;
+  else if (Ns < Nr)
+    size = Nr + 1;
   else
     size = Ns + 1;
 
   s_media = su_zalloc(home, size * (sizeof *s_media));
   o_media = su_zalloc(home, (Ns + 1) * (sizeof *o_media));
-  c_media = su_zalloc(home, (Nc + 1) * (sizeof *c_media));
   u_media = su_zalloc(home, (Nu + 1) * (sizeof *u_media));
+  r_media = su_zalloc(home, (Nr + 1) * (sizeof *r_media));
 
-  cm = sdp_media_dup_all(home, caps->sdp_media, session); 
+  um = sdp_media_dup_all(home, user->sdp_media, session); 
 
-  if (!s_media || !c_media || !u_media || !cm)
+  if (!s_media || !u_media || !r_media || !um)
     return -1;
 
+  u2s = su_alloc(home, (Nu + 1) * sizeof(*u2s));
+  s2u = su_alloc(home, size * sizeof(*s2u));
+  if (!u2s || !s2u)
+    return -1;
+
+  for (i = 0; i < Nu; i++)
+    u2s[i] = U2S_NOT_USED;
+  u2s[i] = U2S_SENTINEL;
+
+  for (i = 0; i <= size; i++)
+    s2u[i] = U2S_NOT_USED;
+  s2u[i] = U2S_SENTINEL;
+
   for (i = 0, m = session->sdp_media; m && i < Ns; m = m->m_next)
     o_media[i++] = m;
   assert(i == Ns);
-  for (i = 0, m = cm; m && i < Nc; m = m->m_next)
-    c_media[i++] = m;
-  assert(i == Nc);
-  for (i = 0, m = upgrader->sdp_media; m && i < Nu; m = m->m_next)
+  for (i = 0, m = um; m && i < Nu; m = m->m_next)
     u_media[i++] = m;
   assert(i == Nu);
+  m = remote ? remote->sdp_media : NULL;
+  for (i = 0; m && i < Nr; m = m->m_next)
+      r_media[i++] = m;
+  assert(i == Nr);
+
+  if (sss->sss_ordered_user && sss->sss_u2s) {     /* User SDP is ordered */
+    for (j = 0; sss->sss_u2s[j] != U2S_SENTINEL; j++) {
+      i = sss->sss_u2s[j];
+      if (i == U2S_NOT_USED)
+	continue;
+      if (j >= Nu) /* lines removed from user SDP */
+	continue;
+      s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
+      u2s[j] = i, s2u[i] = j;
+    }
+  }
 
-  if (caps != upgrader) {
+  if (remote) {
     /* Update session according to remote */
-    for (i = 0; i < Nu; i++) {
-      int common_codecs = 0;
+    for (i = 0; i < Nr; i++) {
+      rm = r_media[i];
+      m = s_media[i];
+
+      if (!m) {
+	int codec_mismatch = 0;
+
+	if (!rm->m_rejected)
+	  j = soa_sdp_matching_mindex(ss, u_media, rm, &codec_mismatch);
+	else
+	  j = -1;
+
+	if (j == -1) {
+	  s_media[i] = soa_sdp_make_rejected_media(home, rm, session, 0);
+	  continue;
+	}
+	else if (codec_mismatch && !ss->ss_rtp_mismatch) {
+	  m = soa_sdp_make_rejected_media(home, u_media[j], session, 1);
+	  soa_sdp_set_rtpmap_pt(s_media[i] = m, rm);
+	  continue;
+	}
+
+	s_media[i] = m = u_media[j]; u_media[j] = SDP_MEDIA_NONE;
+	u2s[j] = i, s2u[i] = j;
+      }
 
-      m = soa_sdp_matching(ss, c_media, u_media[i], &common_codecs);
+      if (sdp_media_uses_rtp(rm))
+	soa_sdp_media_upgrade_rtpmaps(ss, m, rm);
+    }
+  }
+  else if (sss->sss_ordered_user) {
+    /* Update session with unused media in u_media */
 
-      if (!m || u_media[i]->m_rejected) {
-	m = soa_sdp_make_rejected_media(home, u_media[i], session, 0);
+    if (!sss->sss_reuse_rejected) {
+      /* Mark previously used slots */
+      for (i = 0; i < Ns; i++) {
+	if (s_media[i])
+	  continue;
+	s_media[i] = soa_sdp_make_rejected_media(home, o_media[i], session, 0);
       }
-      else if (sdp_media_uses_rtp(m)) {
-	/* Process rtpmaps */
-	char const *auxiliary =
-	  m->m_type == sdp_media_audio ? sss->sss_audio_aux : NULL;
-
-	if (!common_codecs && !ss->ss_rtp_mismatch)
-	  m = soa_sdp_make_rejected_media(home, m, session, 1);
-	soa_sdp_set_rtpmap_pt(m, u_media[i]);
-
-	if (ss->ss_rtp_sort == SOA_RTP_SORT_REMOTE || 
-	    (ss->ss_rtp_sort == SOA_RTP_SORT_DEFAULT &&
-	     u_media[i]->m_mode == sdp_recvonly)) {
-	  soa_sdp_sort_rtpmap(&m->m_rtpmaps, u_media[i]->m_rtpmaps, auxiliary);
-	}
+    }
 
-	if (common_codecs &&
-	    (ss->ss_rtp_select == SOA_RTP_SELECT_SINGLE ||
-	     ss->ss_rtp_select == SOA_RTP_SELECT_COMMON)) {
-	  soa_sdp_select_rtpmap(&m->m_rtpmaps, u_media[i]->m_rtpmaps, auxiliary,
-				ss->ss_rtp_select == SOA_RTP_SELECT_SINGLE);
-	}
+    for (j = 0; j < Nu; j++) {
+      if (u_media[j] == SDP_MEDIA_NONE)
+	continue;
+
+      for (i = 0; i < size - 1; i++) {
+	if (s_media[i] != NULL)
+	  continue;
+	s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
+	u2s[j] = i, s2u[i] = j;
       }
 
-      s_media[i] = m;
+      assert(i != size);
     }
   }
   else {
-    /* Update session according to local */
+    /* Match unused user media by media types with the existing session */
     for (i = 0; i < Ns; i++) {
-      m = soa_sdp_matching(ss, c_media, o_media[i], NULL);
-      if (!m)
-	m = soa_sdp_make_rejected_media(home, o_media[i], session, 0);
-      s_media[i] = m;
+      if (s_media[i])
+	continue;
+
+      j = soa_sdp_matching_mindex(ss, u_media, o_media[i], NULL);
+      if (j == -1) {
+	s_media[i] = soa_sdp_make_rejected_media(home, o_media[i], session, 0);
+	continue;
+      }
+
+      s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
+      u2s[j] = i, s2u[i] = j;
     }
+
     /* Here we just append new media at the end */
-    for (j = 0; c_media[j]; j++)
-      s_media[i++] = c_media[j];
+    for (j = 0; j < Nu; j++) {
+      if (u_media[j] != SDP_MEDIA_NONE) {
+	s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
+	u2s[j] = i, s2u[i] = j;
+	i++;
+      }
+    }
     assert(i <= size);
   }
 
@@ -739,10 +864,46 @@
   }
   *mm = NULL;
 
+#ifndef NDEBUG
+  for (j = i; j < size; j++)
+    assert(s2u[j] == U2S_NOT_USED);
+#endif
+
+  s2u[size = i] = U2S_SENTINEL;
+  *return_u2s = u2s;
+  *return_s2u = s2u;
+
+#ifndef NDEBUG			/* X check */
+  for (j = 0; j < Nu; j++) {
+    i = u2s[j];
+    assert(i == U2S_NOT_USED || s2u[i] == j);
+  }
+  for (i = 0; i < size; i++) {
+    j = s2u[i];
+    assert(j == U2S_NOT_USED || u2s[j] == i);
+  }
+#endif
+
   return 0;
 }
 
+int *u2s_alloc(su_home_t *home, int const *u2s)
+{
+  if (u2s) {
+    int i, *a;
+    for (i = 0; u2s[i] != U2S_SENTINEL; i++)
+      ;
+    a = su_alloc(home, (i + 1) * (sizeof *u2s));
+    if (a)
+      memcpy(a, u2s, (i + 1) * (sizeof *u2s));
+    return a;
+  }
+
+  return NULL;
+}
+
 /** Check if @a session contains media that are rejected by @a remote. */ 
+static
 int soa_sdp_reject_is_needed(sdp_session_t const *session,
 			     sdp_session_t const *remote)
 {
@@ -774,6 +935,7 @@
 }
 
 /** If m= line is rejected by remote mark m= line rejected within session */ 
+static
 int soa_sdp_reject(su_home_t *home,
 		   sdp_session_t *session,
 		   sdp_session_t const *remote)
@@ -813,6 +975,7 @@
 }
 
 /** Check if @a session mode should be changed. */ 
+static
 int soa_sdp_mode_set_is_needed(sdp_session_t const *session,
 			       sdp_session_t const *remote,
 			       char const *hold)
@@ -855,6 +1018,7 @@
 
 
 /** Update mode within session */ 
+static
 int soa_sdp_mode_set(sdp_session_t *session,
 		     sdp_session_t const *remote,
 		     char const *hold)
@@ -908,6 +1072,8 @@
 			     enum offer_answer_action action,
 			     char const *by)
 {
+  soa_static_session_t *sss = (soa_static_session_t *)ss;
+
   char c_address[64];
   sdp_session_t *local = ss->ss_local->ssd_sdp;
   sdp_session_t local0[1];
@@ -922,6 +1088,8 @@
   sdp_connection_t *c, c0[1] = {{ sizeof(c0) }};
   sdp_time_t t[1] = {{ sizeof(t) }};
 
+  int *u2s = NULL, *s2u = NULL, *tbf;
+
   char const *phrase = "Internal Media Error";
 
   su_home_t tmphome[SU_HOME_AUTO_SIZE(8192)];
@@ -991,7 +1159,7 @@
       *local0 = *local, local = local0;
     SU_DEBUG_7(("soa_static(%p, %s): %s\n", (void *)ss, by, 
 		"upgrade with local description"));
-    soa_sdp_upgrade(ss, tmphome, local, user, user);
+    soa_sdp_upgrade(ss, tmphome, local, user, NULL, &u2s, &s2u);
     break;
   case generate_answer:
     /* Upgrade local SDP based on remote SDP */
@@ -1003,7 +1171,7 @@
 	*local0 = *local, local = local0;
       SU_DEBUG_7(("soa_static(%p, %s): %s\n", (void *)ss, by,
 		  "upgrade with remote description"));
-      soa_sdp_upgrade(ss, tmphome, local, user, remote);
+      soa_sdp_upgrade(ss, tmphome, local, user, remote, &u2s, &s2u);
     }
     break;
   case process_answer:
@@ -1074,7 +1242,7 @@
 	*local0 = *local, local = local0; 
 	DUP_LOCAL(local);
       }
-      soa_sdp_upgrade_rtpmaps(ss, local, remote);
+      soa_sdp_session_upgrade_rtpmaps(ss, local, remote);
     }
     break;
   case generate_offer:
@@ -1125,9 +1293,16 @@
 
   soa_description_free(ss, ss->ss_previous);
 
+  if (u2s) {
+    u2s = u2s_alloc(ss->ss_home, u2s); 
+    s2u = u2s_alloc(ss->ss_home, s2u);
+    if (!u2s || !s2u)
+      goto internal_error;
+  }
+
   if (ss->ss_local->ssd_sdp != local &&
       sdp_session_cmp(ss->ss_local->ssd_sdp, local)) {
-    /* We have modfied local session: update origin-line */
+    /* We have modified local session: update origin-line */
     if (local->sdp_origin != o)
       *o = *local->sdp_origin, local->sdp_origin = o;
     o->o_version++;
@@ -1151,10 +1326,24 @@
 
     /* Update the unparsed and pretty-printed descriptions  */
     if (soa_description_set(ss, ss->ss_local, local, NULL, 0) < 0) {
+      if (action == generate_offer) {
+	/* Remove 2nd reference to local session state */
+	memset(ss->ss_previous, 0, (sizeof *ss->ss_previous));
+	ss->ss_previous_user_version = 0;
+	ss->ss_previous_remote_version = 0;
+      }
+      
+      su_free(ss->ss_home, u2s), su_free(ss->ss_home, s2u);
+
       goto internal_error;
     }
   }
 
+  if (u2s) {
+    tbf = sss->sss_u2s, sss->sss_u2s = u2s, su_free(ss->ss_home, tbf);
+    tbf = sss->sss_s2u, sss->sss_s2u = s2u, su_free(ss->ss_home, tbf);
+  }
+
   /* Update version numbers */
   switch (action) {
   case generate_offer:

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c	Wed Jun 20 13:06:05 2007
@@ -604,3 +604,32 @@
  * @sa soa_set_params(), nua_invite(), @ref nua_event_diagram_call_hold
  */
 tag_typedef_t soatag_hold = STRTAG_TYPEDEF(hold);
+
+
+/**@def SOATAG_ORDERED_USER(x)
+ *
+ * Take account strict ordering of user SDP m=lines. If user SDP has been
+ * updated, the new media lines replace old ones even if the media type has
+ * been changed. This allows the application to replace @b m=audio with
+ * @b m=image/t38, for instance.
+ *
+ * @par Used with
+ *    soa_set_params(), soa_get_params(), soa_get_paramlist() \n
+ *
+ * @par Parameter type
+ *    boolean
+ *
+ * @par Values
+ *   - false (0) - update session with user SDP based on media type
+ *   - true (1) - update session with m= line in user SDP based on their order
+ *
+ * The default value is false and session are updated based on media types.
+ * 
+ *
+ * Corresponding tag taking a reference parameter is SOATAG_RTP_SELECT_REF().
+ *
+ * @sa @RFC3264 section 8.3.3, T.38
+ */
+tag_typedef_t soatag_ordered_user = BOOLTAG_TYPEDEF(ordered_user);
+
+tag_typedef_t soatag_reuse_rejected = BOOLTAG_TYPEDEF(reuse_rejected);

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_tag.h
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_tag.h	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_tag.h	Wed Jun 20 13:06:05 2007
@@ -244,6 +244,20 @@
 #define SOATAG_HOLD_REF(x)       soatag_hold_ref, tag_str_vr(&(x))
 SOFIAPUBVAR tag_typedef_t soatag_hold_ref;
 
+#define SOATAG_ORDERED_USER(x) soatag_ordered_user, tag_bool_v(x)
+SOFIAPUBVAR tag_typedef_t soatag_ordered_user;
+
+#define SOATAG_ORDERED_USER_REF(x) \
+  soatag_ordered_user_ref, tag_bool_vr(&(x))
+SOFIAPUBVAR tag_typedef_t soatag_ordered_user_ref;
+
+#define SOATAG_REUSE_REJECTED(x) soatag_reuse_rejected, tag_bool_v(x)
+SOFIAPUBVAR tag_typedef_t soatag_reuse_rejected;
+
+#define SOATAG_REUSE_REJECTED_REF(x) \
+  soatag_reuse_rejected_ref, tag_bool_vr(&(x))
+SOFIAPUBVAR tag_typedef_t soatag_reuse_rejected_ref;
+
 SOFIA_END_DECLS
 
 #endif /* SOA_TAG_H */

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c	Wed Jun 20 13:06:05 2007
@@ -519,7 +519,7 @@
   /* 'B' will reject. */ 
   TEST(soa_set_params(a,
 		      SOATAG_HOLD(NULL),  /* 'A' will release hold. */ 
-		      SOATAG_USER_SDP_STR("m=audio 5004 RTP/AVP 0 8\r\n"
+		      SOATAG_USER_SDP_STR("m=audio 5008 RTP/AVP 0 8\r\ni=x\r\n"
 					  "m=video 5006 RTP/AVP 34\r\n"),
 		      TAG_END()), 2);
 
@@ -663,7 +663,7 @@
   TEST_1(m = b_sdp->sdp_media); TEST_1(m->m_rejected);
   TEST_1(rm = m->m_rtpmaps); TEST(rm->rm_pt, 96);
   TEST_S(rm->rm_encoding, "G7231");
-  /* Not using payload type 97 from offer */
+  /* Not reusing payload type 97 from offer */
   TEST_1(rm = rm->rm_next); TEST(rm->rm_pt, 98);
   TEST_S(rm->rm_encoding, "G729");
   TEST_1(!rm->rm_next);
@@ -1141,6 +1141,128 @@
   END();
 }
 
+int test_media_replace(struct context *ctx)
+{
+  BEGIN();
+  int n;
+  
+  soa_session_t *a, *b;
+
+  char const *offer = NONE, *answer = NONE;
+  isize_t offerlen = (isize_t)-1, answerlen = (isize_t)-1;
+
+  sdp_session_t const *a_sdp, *b_sdp;
+  sdp_media_t const *m;
+
+  char const a_caps[] = 
+    "v=0\r\n"
+    "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
+    "c=IN IP4 127.0.0.2\r\n"
+    "m=audio 5008 RTP/AVP 0 8\r\n"
+    ;
+
+  char const b_caps[] = 
+    "m=audio 5004 RTP/AVP 0 8\n"
+    "a=rtpmap:96 G7231/8000\n"
+    "a=rtpmap:97 G729/8000\n"
+    "m=image 5556 UDPTL t38\r\n"
+    "a=T38FaxVersion:0\r\n"
+    "a=T38MaxBitRate:9600\r\n"
+    "a=T38FaxFillBitRemoval:0\r\n"
+    "a=T38FaxTranscodingMMR:0\r\n"
+    "a=T38FaxTranscodingJBIG:0\r\n"
+    "a=T38FaxRateManagement:transferredTCF\r\n"
+    "a=T38FaxMaxDatagram:400\r\n";
+
+  TEST_1(a = soa_create("static", ctx->root, ctx));
+  TEST_1(b = soa_create("static", ctx->root, ctx));
+
+  TEST(soa_set_user_sdp(a, 0, a_caps, strlen(a_caps)), 1);
+  TEST(soa_set_user_sdp(b, 0, b_caps, strlen(b_caps)), 1);
+
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(a, NULL, &offer, &offerlen); TEST(n, 1);
+  TEST_1(offer != NULL && offer != NONE);
+  n = soa_set_remote_sdp(b, 0, offer, offerlen); TEST(n, 1);
+  n = soa_get_local_sdp(b, NULL, &answer, &answerlen); TEST(n, 0);
+  n = soa_generate_answer(b, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(b, &b_sdp, &answer, &answerlen); TEST(n, 1);
+  TEST_1(answer != NULL && answer != NONE);
+  n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
+  n = soa_process_answer(a, test_completed); TEST(n, 0);
+
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+
+  TEST_1(soa_is_complete(a));
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
+
+  /* ---------------------------------------------------------------------- */
+
+  /* Re-O/A: replace media stream */
+
+  /* Accept media without common codecs */
+  TEST_1(soa_set_params(a, SOATAG_RTP_MISMATCH(0),
+			SOATAG_ORDERED_USER(1),
+			SOATAG_USER_SDP_STR(
+    "v=0\r\n"
+    "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
+    "c=IN IP4 127.0.0.2\r\n"
+    "m=image 16384 UDPTL t38\r\n"
+    "a=T38FaxVersion:0\r\n"
+    "a=T38MaxBitRate:9600\r\n"
+    "a=T38FaxFillBitRemoval:0\r\n"
+    "a=T38FaxTranscodingMMR:0\r\n"
+    "a=T38FaxTranscodingJBIG:0\r\n"
+    "a=T38FaxRateManagement:transferredTCF\r\n"
+    "a=T38FaxMaxDatagram:400\r\n"
+    ),			
+			TAG_END()));
+
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(a, &a_sdp, &offer, &offerlen); TEST(n, 1);
+  TEST_1(offer != NULL && offer != NONE);
+  n = soa_set_remote_sdp(b, 0, offer, offerlen); TEST(n, 1);
+  n = soa_generate_answer(b, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(b, &b_sdp, &answer, &answerlen); TEST(n, 1);
+  TEST_1(answer != NULL && answer != NONE);
+  n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
+  n = soa_process_answer(a, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(a, &a_sdp, NULL, NULL); TEST(n, 1);
+
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+
+  TEST_1(soa_is_complete(a));
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST_1(m = a_sdp->sdp_media); TEST_1(!m->m_rejected);
+  TEST(m->m_type, sdp_media_image);
+  TEST(m->m_proto, sdp_proto_udptl);
+  TEST_1(m->m_format); 
+  TEST_S(m->m_format->l_text, "t38"); 
+
+  TEST_1(m = b_sdp->sdp_media); TEST_1(!m->m_rejected);
+  TEST(m->m_type, sdp_media_image);
+  TEST(m->m_proto, sdp_proto_udptl);
+  TEST_1(m->m_format); 
+  TEST_S(m->m_format->l_text, "t38"); 
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_DISABLED);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_DISABLED);
+
+  TEST_VOID(soa_terminate(a, NULL));
+  TEST_VOID(soa_terminate(b, NULL));
+  
+  TEST_VOID(soa_destroy(a));
+  TEST_VOID(soa_destroy(b));
+
+  END();
+}
+
 
 int test_asynch_offer_answer(struct context *ctx)
 {
@@ -1332,6 +1454,7 @@
     retval |= test_params(ctx); SINGLE_FAILURE_CHECK();
     retval |= test_static_offer_answer(ctx); SINGLE_FAILURE_CHECK();
     retval |= test_codec_selection(ctx); SINGLE_FAILURE_CHECK();
+    retval |= test_media_replace(ctx); SINGLE_FAILURE_CHECK();
 
     retval |= test_asynch_offer_answer(ctx); SINGLE_FAILURE_CHECK();
   }

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_configure.h.in
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_configure.h.in	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_configure.h.in	Wed Jun 20 13:06:05 2007
@@ -88,6 +88,9 @@
 /** Define as suitable declarator static inline functions */
 #undef su_inline
 
+/** Define as 1 the tag value casts use inlined functions */
+#undef SU_INLINE_TAG_CAST
+
 /** Define this as 1 if we can use tags directly from stack. */
 #undef SU_HAVE_TAGSTACK 
 

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag.h	Wed Jun 20 13:06:05 2007
@@ -171,7 +171,7 @@
 #define SU_ALIGN(x) \
 ((sizeof(void *) - ((intptr_t)(x) & (sizeof(void *) - 1))) & (sizeof(void *) - 1))
 
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 su_inline tag_value_t tag_int_v(int v) { return (tag_value_t)v; }
 su_inline tag_value_t tag_int_vr(int *vp) { return (tag_value_t)vp; }
 su_inline tag_value_t tag_uint_v(unsigned v) { return (tag_value_t)v; }

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_io.h
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_io.h	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_tag_io.h	Wed Jun 20 13:06:05 2007
@@ -48,7 +48,7 @@
 
 SOFIAPUBFUN void tl_print(FILE *f, char const *title, tagi_t const lst[]);
 
-#if SU_HAVE_INLINE
+#if SU_INLINE_TAG_CAST
 su_inline tag_value_t tag_socket_v(su_socket_t v) {
   return (tag_value_t)v;
 }

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/su.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/su.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/su.c	Wed Jun 20 13:06:05 2007
@@ -51,14 +51,18 @@
 #endif
 
 int su_socket_close_on_exec = 0;
+int su_socket_blocking = 0;
 
 /** Create an endpoint for communication. */
 su_socket_t su_socket(int af, int socktype, int proto)
 {
   su_socket_t s = socket(af, socktype, proto);
 #if SU_HAVE_BSDSOCK
-  if (s != INVALID_SOCKET && su_socket_close_on_exec) {
-    fcntl(s, F_SETFD, FD_CLOEXEC); /* Close on exec */
+  if (s != INVALID_SOCKET) {
+    if (su_socket_close_on_exec)
+      fcntl(s, F_SETFD, FD_CLOEXEC); /* Close on exec */
+    if (!su_socket_blocking)	/* All sockets are born blocking */
+      su_setblocking(s, 0);
   }
 #endif
   return s;

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c	Wed Jun 20 13:06:05 2007
@@ -540,7 +540,6 @@
       init(child, magic) == 0)
     return 0;
 
-  deinit(child, magic);
   su_msg_destroy(return_clone);
   su_root_destroy(child);
   return -1;

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/su/torture_su.c	Wed Jun 20 13:06:05 2007
@@ -204,6 +204,8 @@
 
   TEST(getsockname(l, &su.su_sa, &sulen), 0);
   TEST(listen(l, 5), 0);
+
+  TEST(su_setblocking(s, 1), 0);
   
   TEST(connect(s, &su.su_sa, sulen), 0);
   a = accept(l, &csu.su_sa, &csulen); TEST_1(a != -1);

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport.h	Wed Jun 20 13:06:05 2007
@@ -279,6 +279,9 @@
 /** Test if transport is connected. @NEW_1_12_5 */
 TPORT_DLL int tport_is_connected(tport_t const *self);
 
+/** Test if transport can be used to send message. @NEW_1_12_7 */
+TPORT_DLL int tport_is_clear_to_send(tport_t const *self);
+
 /** Set transport magic. */
 TPORT_DLL void tport_set_magic(tport_t *self, tp_magic_t *magic);
 

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/sofia-sip/tport_tag.h	Wed Jun 20 13:06:05 2007
@@ -403,7 +403,7 @@
  * Use with tport_tcreate(), nua_create(), nta_agent_create(), 
  * nth_engine_create(), or initial nth_site_create().
  *
- * @sa #TPORT_DUMP, TPTAG_DUMP()
+ * @sa #TPORT_LOG environment variable, TPTAG_DUMP()
  *
  * @NEW_1_12_5
  */
@@ -418,7 +418,7 @@
  * Use with tport_tcreate(), nta_agent_create(), nua_create(),
  * nth_engine_create(), or initial nth_site_create().
  *
- * @sa #TPORT_DUMP, TPTAG_LOG().
+ * @sa #TPORT_DUMP environment variable, TPTAG_LOG().
  *
  * @NEW_1_12_5
  */

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	Wed Jun 20 13:06:05 2007
@@ -166,7 +166,7 @@
     self->tp_pri->pri_primary != self;
 }
 
-/** Test if transport has been registered */
+/** Test if transport has been registered to su_root_t */
 int tport_is_registered(tport_t const *self)
 {
   return self->tp_index != 0;
@@ -291,6 +291,19 @@
   return self->tp_is_connected;
 }
 
+/** Test if transport can be used to send message. @NEW_1_12_7 */
+int tport_is_clear_to_send(tport_t const *self)
+{
+  return
+    tport_is_master(self) || 
+    tport_is_primary(self) || 
+    (tport_is_secondary(self) &&
+     tport_is_registered(self) &&
+     self->tp_reusable &&
+     !self->tp_closed &&
+     !self->tp_send_close);
+}
+
 /** MTU for transport  */
 su_inline unsigned tport_mtu(tport_t const *self)
 {
@@ -1164,7 +1177,7 @@
   if (self == NULL)
     return su_seterrno(EINVAL);
 
-  memcpy(tpp, tpp0 = self->tp_params, sizeof *tpp);
+  memcpy(tpp, tpp0 = self->tp_params, sizeof tpp);
 
   mtu = tpp->tpp_mtu;
   connect = tpp->tpp_conn_orient;
@@ -1220,9 +1233,10 @@
   if (tport_is_secondary(self) && 
       self->tp_params == self->tp_pri->pri_primary->tp_params) {
     tpp0 = su_zalloc(self->tp_home, sizeof *tpp0); if (!tpp0) return -1;
+    self->tp_params = tpp0;
   }
 
-  memcpy(tpp0, tpp, sizeof *tpp);
+  memcpy(tpp0, tpp, sizeof tpp);
 
   return n;
 }
@@ -1963,7 +1977,7 @@
  */
 void tport_close(tport_t *self)
 {
-	SU_DEBUG_5(("%s(%p): " TPN_FORMAT "\n", "tport_close", (void *)self,
+  SU_DEBUG_5(("%s(%p): " TPN_FORMAT "\n", "tport_close", (void *)self,
 	      TPN_ARGS(self->tp_name)));
 
   self->tp_closed = 1;
@@ -2360,6 +2374,7 @@
   else if (errcode > 0)
     errmsg = su_strerror(errcode);
   else
+    /* Should be something  like ENOTCONN */
     errcode = 0, errmsg = "stream closed";
 
   if (addr && addr->su_family == AF_UNSPEC)
@@ -2369,12 +2384,12 @@
   if (errcode > 0 && tport_has_connection(self))
     self->tp_reusable = 0;
 
-  if (addr == NULL && tport_is_connection_oriented(self))
-    addr = self->tp_addr;
-
   /* Report error */
   if (addr && tport_pending_error(self, addr, errcode))
     ;
+  else if (tport_is_secondary(self) &&
+	   tport_pending_error(self, NULL, errcode) > 0)
+    ;
   else if (self->tp_master->mr_tpac->tpac_error) {
     char *dstname = NULL;
     char hp[TPORT_HOSTPORTSIZE];
@@ -3070,30 +3085,24 @@
     /* Select a primary protocol, make a fresh connection */
     self = primary->pri_primary;
   }
+  else if (tport_is_secondary(self) && tport_is_clear_to_send(self)) {
+    self = self;
+  }
+  /*
+   * Try to find an already open connection to the destination, 
+   * or get a primary protocol 
+   */
   else {
-    if (tport_is_secondary(self) && 
-	tport_is_registered(self) && 
-	self->tp_reusable &&
-	!self->tp_closed &&
-	!self->tp_send_close) {
-      self = self;
-    }
-    /*
-     * Try to find an already open connection to the destination, 
-     * or get a primary protocol 
-     */
-    else {
-      /* If primary, resolve the destination address, store it in the msg */
-      if (tport_resolve(primary->pri_primary, msg, tpn) < 0) {
-	return NULL;
-      }
-      resolved = 1;
-
-      self = tport_by_addrinfo(primary, msg_addrinfo(msg), tpn);
-
-      if (!self)
-	self = primary->pri_primary;
+    /* If primary, resolve the destination address, store it in the msg */
+    if (tport_resolve(primary->pri_primary, msg, tpn) < 0) {
+      return NULL;
     }
+    resolved = 1;
+    
+    self = tport_by_addrinfo(primary, msg_addrinfo(msg), tpn);
+
+    if (!self)
+      self = primary->pri_primary;
   }
 
   if (tport_is_primary(self)) {
@@ -3878,9 +3887,12 @@
 {
   tport_pending_t *pending;
 
-  if (self == NULL || msg == NULL || callback == NULL || client == NULL)
+  if (self == NULL || callback == NULL || client == NULL)
     return -1;
-  
+
+  if (msg == NULL && tport_is_primary(self))
+    return -1;
+
   SU_DEBUG_7(("tport_pend(%p): pending %p for %s/%s:%s (already %u)\n", 
 			  (void *)self, (void *)msg, 
 	      self->tp_protoname, self->tp_host, self->tp_port,
@@ -3930,7 +3942,7 @@
 {
   tport_pending_t *pending;
 
-  if (self == NULL || msg == NULL || pendd <= 0 || pendd > (int)self->tp_plen)
+  if (self == NULL || pendd <= 0 || pendd > (int)self->tp_plen)
     return su_seterrno(EINVAL), -1;
 
   pending = self->tp_pending + (pendd - 1);
@@ -3968,7 +3980,7 @@
   msg_t *msg;
   su_addrinfo_t const *ai;
 
-  assert(self); assert(dst);
+  assert(self);
 
   callbacks = 0;
   reported = ++self->tp_reported;
@@ -3979,22 +3991,25 @@
   for (i = 0; i < self->tp_plen; i++) {
     pending = self->tp_pending + i;
 
-    if (!pending->p_callback || !pending->p_msg)
+    if (!pending->p_callback)
       continue;
 
     if (pending->p_reported == reported)
       continue;
 
     msg = pending->p_msg;
-    ai = msg_addrinfo(msg);
 
-    if (su_cmp_sockaddr(dst, (su_sockaddr_t *)ai->ai_addr) != 0)
-      continue;
+    if (dst && msg) {
+      ai = msg_addrinfo(msg);
 
-    pending->p_reported = reported;
+      if (su_cmp_sockaddr(dst, (su_sockaddr_t *)ai->ai_addr) != 0)
+	continue;
+    }
 
     msg_set_errno(msg, error);
 
+    pending->p_reported = reported;
+
     pending->p_callback(self->TP_STACK, pending->p_client, self, msg, error);
 
     callbacks++;

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c	Wed Jun 20 13:06:05 2007
@@ -252,9 +252,9 @@
     tport_dump_iovec(self, msg, n, iovec, veclen, "recv", "from");
 
   /* Mark buffer as used */
-  msg_recv_commit(msg, n, 0);
+  msg_recv_commit(msg, n, n == 0);
 
-  return 1;
+  return n != 0;
 }
 
 ssize_t tport_send_stream(tport_t const *self, msg_t *msg, 

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/url/torture_url.c
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/url/torture_url.c	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/libsofia-sip-ua/url/torture_url.c	Wed Jun 20 13:06:05 2007
@@ -214,6 +214,15 @@
     TEST_S(u->url_fragment, "foo");
   }
 
+  {
+    url_t u[1];
+    char b2[6] = "";
+
+    memset(u, 0xff, sizeof u);
+    TEST(url_d(u, b2), 0);
+    TEST(u->url_type, url_unknown);
+  }
+
   su_home_deinit(home);
   
   END();

Modified: freeswitch/branches/greenlizard/libs/sofia-sip/m4/sac-su2.m4
==============================================================================
--- freeswitch/branches/greenlizard/libs/sofia-sip/m4/sac-su2.m4	(original)
+++ freeswitch/branches/greenlizard/libs/sofia-sip/m4/sac-su2.m4	Wed Jun 20 13:06:05 2007
@@ -2,11 +2,11 @@
 dnl su module
 dnl ======================================================================
 
+AC_DEFUN([SAC_SU])
+
 AC_DEFUN([SAC_SOFIA_SU], [
 # Beginning of SAC_SOFIA_SU
 
-AC_REQUIRE([SAC_WITH_RT])
-
 # ======================================================================
 # Check for features used by su
 
@@ -66,6 +66,16 @@
 
 AC_REQUIRE([AC_C_INLINE])
 
+AC_ARG_ENABLE(tag-cast,
+[  --disable-tag-cast      cast tag values with inlined functions [[enabled]]],
+ , enable_tag_cast=yes)
+
+if test "$enable_tag_cast" = "yes"; then
+    tag_cast=1
+else
+    tag_cast=0
+fi
+
 case "$ac_cv_c_inline" in
   yes) SAC_SU_DEFINE(su_inline, static inline, [
 		Define to declarator for static inline functions.
@@ -76,15 +86,20 @@
        SAC_SU_DEFINE(SU_HAVE_INLINE, 1, [
 		Define to 1 if you have inline functions.
 	])dnl
+       SAC_SU_DEFINE_UNQUOTED(SU_INLINE_TAG_CAST, $tag_cast, [
+		Define to 1 if you use inline function to cast tag values.
+	])dnl
   ;;
   no | "" )
        SAC_SU_DEFINE(su_inline, static)dnl
        SAC_SU_DEFINE(SU_INLINE, /*inline*/)dnl
        SAC_SU_DEFINE(SU_HAVE_INLINE, 0)dnl
+       SAC_SU_DEFINE(SU_INLINE_TAG_CAST, 0)dnl
   ;;
   *)   SAC_SU_DEFINE_UNQUOTED(su_inline, static $ac_cv_c_inline)dnl
        SAC_SU_DEFINE_UNQUOTED(SU_INLINE, $ac_cv_c_inline)dnl
        SAC_SU_DEFINE(SU_HAVE_INLINE, 1)dnl
+       SAC_SU_DEFINE_UNQUOTED(SU_INLINE_TAG_CAST, $tag_cast)dnl
   ;;
 esac
 
@@ -368,7 +383,15 @@
 # Checks for libraries
 # ===========================================================================
 
-SAC_CHECK_SU_LIBS
+AC_CHECK_LIB(pthread, pthread_create)
+AC_CHECK_LIB(socket, socketpair,,,-lnsl)
+
+AC_ARG_WITH(rt,  
+[  --with-rt               use POSIX realtime library [[used by default]]])
+if test "${with_rt}" != no; then
+	AC_SEARCH_LIBS(clock_gettime, rt)
+        AC_CHECK_FUNCS([clock_gettime clock_getcpuclockid])
+fi
 
 # No GLib path explicitly defined, use pkg-config
 AC_ARG_WITH(glib,
@@ -470,11 +493,6 @@
     [Define to 1 if you have if_nameindex().])
 fi
 
-AC_REQUIRE([SAC_WITH_RT])
-if test "${with_rt}" != no; then
-    AC_CHECK_FUNCS([clock_gettime clock_getcpuclockid])
-fi
-
 SAC_REPLACE_FUNCS([memmem memccpy memspn memcspn strcasestr strtoull \
 		   inet_ntop inet_pton poll])
 

Modified: freeswitch/branches/greenlizard/src/include/switch.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch.h	(original)
+++ freeswitch/branches/greenlizard/src/include/switch.h	Wed Jun 20 13:06:05 2007
@@ -99,7 +99,6 @@
 #include <switch_resample.h>
 #include <switch_ivr.h>
 #include <switch_rtp.h>
-#include <switch_stun.h>
 #include <switch_log.h>
 #include <switch_xml.h>
 #include <switch_core_event_hook.h>

Modified: freeswitch/branches/greenlizard/src/include/switch_event.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_event.h	(original)
+++ freeswitch/branches/greenlizard/src/include/switch_event.h	Wed Jun 20 13:06:05 2007
@@ -208,7 +208,7 @@
   \param user_data optional user specific data to pass whenever the callback is invoked
   \return SWITCH_STATUS_SUCCESS if the event was binded
 */
-SWITCH_DECLARE(switch_status_t) switch_event_bind(char *id, switch_event_types_t event, char *subclass_name, switch_event_callback_t callback,
+SWITCH_DECLARE(switch_status_t) switch_event_bind(const char *id, switch_event_types_t event, char *subclass_name, switch_event_callback_t callback,
 												  void *user_data);
 
 /*!

Modified: freeswitch/branches/greenlizard/src/include/switch_loadable_module.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_loadable_module.h	(original)
+++ freeswitch/branches/greenlizard/src/include/switch_loadable_module.h	Wed Jun 20 13:06:05 2007
@@ -257,18 +257,60 @@
   \return SWITCH_STATUS_SUCCESS on a successful load
 */
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename);
-SWITCH_MOD_DECLARE(switch_status_t) switch_module_reload(void);
-SWITCH_MOD_DECLARE(switch_status_t) switch_module_pause(void);
-SWITCH_MOD_DECLARE(switch_status_t) switch_module_resume(void);
-SWITCH_MOD_DECLARE(switch_status_t) switch_module_status(void);
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void);
 
-
 /*!
   \brief Shutdown a module
   \return SWITCH_STATUS_SUCCESS on a successful shutdown
 */
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void);
+
+#define SWITCH_ADD_API(api_int, int_name, descript, funcptr, syntax_string) \
+	for (;;) { \
+	api_int = (switch_api_interface_t *)switch_loadable_module_create_interface(*module_interface, SWITCH_API_INTERFACE); \
+	api_int->interface_name = int_name; \
+	api_int->desc = descript; \
+	api_int->function = funcptr; \
+	api_int->syntax = syntax_string; \
+	break; \
+	}
+
+#define SWITCH_ADD_CHAT(chat_int, int_name, funcptr) \
+	for (;;) { \
+	chat_int = (switch_chat_interface_t *)switch_loadable_module_create_interface(*module_interface, SWITCH_CHAT_INTERFACE); \
+	chat_int->chat_send = funcptr; \
+	chat_int->interface_name = int_name; \
+	break; \
+	}
+
+#define SWITCH_ADD_APP(app_int, int_name, short_descript, long_descript, funcptr, syntax_string, app_flags) \
+	for (;;) { \
+	app_int = (switch_application_interface_t *)switch_loadable_module_create_interface(*module_interface, SWITCH_APPLICATION_INTERFACE); \
+	app_int->interface_name = int_name; \
+	app_int->application_function = funcptr; \
+	app_int->short_desc = short_descript; \
+	app_int->long_desc = long_descript; \
+	app_int->syntax = syntax_string; \
+	app_interface->flags = app_flags; \
+	break; \
+	}
+
+#define SWITCH_ADD_DIALPLAN(dp_int, int_name, funcptr) \
+	for (;;) { \
+	dp_int = (switch_dialplan_interface_t *)switch_loadable_module_create_interface(*module_interface, SWITCH_DIALPLAN_INTERFACE); \
+	dp_int->hunt_function = funcptr; \
+	dp_int->interface_name = int_name; \
+	break; \
+	}
+
+#define SWITCH_ADD_CODEC(codec_int, int_name, implementation) \
+	for (;;) { \
+	codec_int = (switch_codec_interface_t *)switch_loadable_module_create_interface(*module_interface, SWITCH_CODEC_INTERFACE); \
+	codec_int->implementations = implementation; \
+	codec_int->interface_name = int_name; \
+	break; \
+	}
+
 ///\}
 
 SWITCH_END_EXTERN_C

Modified: freeswitch/branches/greenlizard/src/include/switch_log.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_log.h	(original)
+++ freeswitch/branches/greenlizard/src/include/switch_log.h	Wed Jun 20 13:06:05 2007
@@ -61,7 +61,7 @@
 	switch_time_t timestamp;
 	/*! A pointer to where the actual content of the message starts (skipping past the preformatted portion) */
 	char *content;
-
+	const char *userdata;
 	/* To maintain abi, only add new elements to the end of this struct and do not delete any elements */
 
 } switch_log_node_t;
@@ -95,7 +95,7 @@
   \note there are channel macros to supply the first 4 parameters
 */
 SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
-									   switch_log_level_t level, const char *fmt, ...) PRINTF_FUNCTION(6, 7);
+									   const char *userdata, switch_log_level_t level, const char *fmt, ...) PRINTF_FUNCTION(7, 8);
 
 /*! 
   \brief Shut down  the logging engine

Modified: freeswitch/branches/greenlizard/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_types.h	(original)
+++ freeswitch/branches/greenlizard/src/include/switch_types.h	Wed Jun 20 13:06:05 2007
@@ -511,9 +511,9 @@
 	SCSMF_DYNAMIC = (1 << 0)
 } switch_core_session_message_flag_t;
 
-#define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__
-#define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__
-#define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__
+#define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
+#define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
+#define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
 
 /*!
   \enum switch_channel_state_t
@@ -1034,9 +1034,14 @@
 typedef struct switch_core_port_allocator switch_core_port_allocator_t;
 typedef struct switch_media_bug switch_media_bug_t;
 typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t);
+
 typedef void (*switch_application_function_t) (switch_core_session_t *, char *);
+#define SWITCH_STANDARD_APP(name) static void name (switch_core_session_t *session, char *data)
+
 typedef void (*switch_event_callback_t) (switch_event_t *);
 typedef switch_caller_extension_t *(*switch_dialplan_hunt_function_t) (switch_core_session_t *, void *, switch_caller_profile_t *);
+#define SWITCH_STANDARD_DIALPLAN(name) static switch_caller_extension_t * name (switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile)
+
 
 typedef struct switch_scheduler_task switch_scheduler_task_t;
 

Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_commands/mod_commands.c	Wed Jun 20 13:06:05 2007
@@ -39,25 +39,6 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load);
 SWITCH_MODULE_DEFINITION(mod_commands, mod_commands_load, NULL, NULL);
 
-static switch_api_interface_t ctl_api_interface;
-static switch_api_interface_t uuid_bridge_api_interface;
-static switch_api_interface_t session_record_api_interface;
-static switch_api_interface_t status_api_interface;
-static switch_api_interface_t show_api_interface;
-static switch_api_interface_t pause_api_interface;
-static switch_api_interface_t transfer_api_interface;
-static switch_api_interface_t load_api_interface;
-static switch_api_interface_t unload_api_interface;
-static switch_api_interface_t reload_api_interface;
-static switch_api_interface_t kill_api_interface;
-static switch_api_interface_t originate_api_interface;
-static switch_api_interface_t media_api_interface;
-static switch_api_interface_t hold_api_interface;
-static switch_api_interface_t broadcast_api_interface;
-static switch_api_interface_t sched_broadcast_api_interface;
-static switch_api_interface_t sched_transfer_api_interface;
-static switch_api_interface_t sched_hangup_api_interface;
-
 SWITCH_STANDARD_API(status_function)
 {
 	uint8_t html = 0;
@@ -108,6 +89,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define CTL_SYNTAX "[hupall|pause|resume|shutdown]"
 SWITCH_STANDARD_API(ctl_function)
 {
 	int argc;
@@ -115,7 +97,7 @@
 	uint32_t arg = 0;
 
 	if (switch_strlen_zero(cmd)) {
-		stream->write_function(stream, "USAGE: %s\n", ctl_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", CTL_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -150,6 +132,7 @@
 
 }
 
+#define LOAD_SYNTAX "<mod_name>"
 SWITCH_STANDARD_API(load_function)
 {
 	const char *err;
@@ -159,7 +142,7 @@
 	}
 
 	if (switch_strlen_zero(cmd)) {
-		stream->write_function(stream, "USAGE: %s\n", load_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", LOAD_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -181,7 +164,7 @@
 	}
 
 	if (switch_strlen_zero(cmd)) {
-		stream->write_function(stream, "USAGE: %s\n", unload_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", LOAD_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -212,6 +195,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define KILL_SYNTAX "<uuid>"
 SWITCH_STANDARD_API(kill_function)
 {
 	switch_core_session_t *ksession = NULL;
@@ -221,7 +205,7 @@
 	}
 
 	if (!cmd) {
-		stream->write_function(stream, "USAGE: %s\n", kill_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", KILL_SYNTAX);
 	} else if ((ksession = switch_core_session_locate(cmd))) {
 		switch_channel_t *channel = switch_core_session_get_channel(ksession);
 		switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
@@ -234,6 +218,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define TRANSFER_SYNTAX "<uuid> <dest-exten> [<dialplan>] [<context>]"
 SWITCH_STANDARD_API(transfer_function)
 {
 	switch_core_session_t *tsession = NULL;
@@ -269,13 +254,14 @@
 		}
 	}
 
-	stream->write_function(stream, "USAGE: %s\n", transfer_api_interface.syntax);
+	stream->write_function(stream, "USAGE: %s\n", TRANSFER_SYNTAX);
 
 done:
 	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define TONE_DETECT_SYNTAX "<uuid> <key> <tone_spec> [<flags> <timeout> <app> <args>]"
 SWITCH_STANDARD_API(tone_detect_session_function)
 {
 	char *argv[6] = { 0 };
@@ -325,6 +311,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define SCHED_TRANSFER_SYNTAX "[+]<time> <uuid> <extension> [<dialplan>] [<context>]"
 SWITCH_STANDARD_API(sched_transfer_function)
 {
 	switch_core_session_t *tsession = NULL;
@@ -340,7 +327,7 @@
 	}
 
 	if (switch_strlen_zero(cmd) || argc < 2 || argc > 5) {
-		stream->write_function(stream, "USAGE: %s\n", sched_transfer_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", SCHED_TRANSFER_SYNTAX);
 	} else {
 		char *uuid = argv[1];
 		char *dest = argv[2];
@@ -367,6 +354,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define SCHED_HANGUP_SYNTAX "[+]<time> <uuid> [<cause>]"
 SWITCH_STANDARD_API(sched_hangup_function)
 {
 	switch_core_session_t *hsession = NULL;
@@ -382,7 +370,7 @@
 	}
 
 	if (switch_strlen_zero(cmd) || argc < 1) {
-		stream->write_function(stream, "USAGE: %s\n", sched_hangup_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", SCHED_HANGUP_SYNTAX);
 	} else {
 		char *uuid = argv[1];
 		char *cause_str = argv[2];
@@ -412,7 +400,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
+#define MEDIA_SYNTAX "<uuid>"
 SWITCH_STANDARD_API(uuid_media_function)
 {
 	char *mycmd = NULL, *argv[4] = { 0 };
@@ -428,7 +416,7 @@
 	}
 
 	if (switch_strlen_zero(cmd) || argc < 1) {
-		stream->write_function(stream, "USAGE: %s\n", media_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", MEDIA_SYNTAX);
 	} else {
 		if (!strcmp(argv[0], "off")) {
 			status = switch_ivr_nomedia(argv[1], SMF_REBRIDGE);
@@ -447,7 +435,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
+#define BROADCAST_SYNTAX "<uuid> <path> [aleg|bleg|both]"
 SWITCH_STANDARD_API(uuid_broadcast_function)
 {
 	char *mycmd = NULL, *argv[4] = { 0 };
@@ -463,7 +451,7 @@
 	}
 
 	if (switch_strlen_zero(cmd) || argc < 2) {
-		stream->write_function(stream, "USAGE: %s\n", broadcast_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", BROADCAST_SYNTAX);
 	} else {
 		switch_media_flag_t flags = SMF_NONE;
 
@@ -487,7 +475,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
+#define SCHED_BROADCAST_SYNTAX "[+]<time> <uuid> <path> [aleg|bleg|both]"
 SWITCH_STANDARD_API(sched_broadcast_function)
 {
 	char *mycmd = NULL, *argv[4] = { 0 };
@@ -503,7 +491,7 @@
 	}
 
 	if (switch_strlen_zero(cmd) || argc < 3) {
-		stream->write_function(stream, "USAGE: %s\n", sched_broadcast_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", SCHED_BROADCAST_SYNTAX);
 	} else {
 		switch_media_flag_t flags = SMF_NONE;
 		time_t when;
@@ -534,6 +522,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define HOLD_SYNTAX "<uuid>"
 SWITCH_STANDARD_API(uuid_hold_function)
 {
 	char *mycmd = NULL, *argv[4] = { 0 };
@@ -549,7 +538,7 @@
 	}
 
 	if (switch_strlen_zero(cmd) || argc < 1) {
-		stream->write_function(stream, "USAGE: %s\n", hold_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", HOLD_SYNTAX);
 	} else {
 		if (!strcmp(argv[0], "off")) {
 			status = switch_ivr_unhold_uuid(argv[1]);
@@ -568,6 +557,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define UUID_SYNTAX "<uuid> <other_uuid>"
 SWITCH_STANDARD_API(uuid_bridge_function)
 {
 	char *mycmd = NULL, *argv[4] = { 0 };
@@ -582,7 +572,7 @@
 	}
 
 	if (switch_strlen_zero(cmd) || argc != 2) {
-		stream->write_function(stream, "USAGE: %s\n", uuid_bridge_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", UUID_SYNTAX);
 	} else {
 		if (switch_ivr_uuid_bridge(argv[0], argv[1]) != SWITCH_STATUS_SUCCESS) {
 			stream->write_function(stream, "Invalid uuid\n");
@@ -593,6 +583,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define SESS_REC_SYNTAX "<uuid> [start|stop] <path> [<limit>]"
 SWITCH_STANDARD_API(session_record_function)
 {
 	switch_core_session_t *rsession = NULL;
@@ -643,7 +634,7 @@
 
   usage:
 
-	stream->write_function(stream, "USAGE: %s\n", session_record_api_interface.syntax);
+	stream->write_function(stream, "USAGE: %s\n", SESS_REC_SYNTAX);
 	switch_safe_free(mycmd);
 
 
@@ -724,6 +715,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define PAUSE_SYNTAX "<uuid> <on|off>"
 SWITCH_STANDARD_API(pause_function)
 {
 	switch_core_session_t *psession = NULL;
@@ -739,7 +731,7 @@
 	}
 
 	if (switch_strlen_zero(cmd) || argc < 2) {
-		stream->write_function(stream, "USAGE: %s\n", pause_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", PAUSE_SYNTAX);
 	} else {
 		char *uuid = argv[0];
 		char *dest = argv[1];
@@ -764,6 +756,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define ORIGINATE_SYNTAX "<call url> <exten>|&<application_name>(<app_args>) [<dialplan>] [<context>] [<cid_name>] [<cid_num>] [<timeout_sec>]"
 SWITCH_STANDARD_API(originate_function)
 {
 	switch_channel_t *caller_channel;
@@ -785,7 +778,7 @@
 	}
 
 	if (switch_strlen_zero(cmd) || argc < 2 || argc > 7) {
-		stream->write_function(stream, "USAGE: %s\n", originate_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", ORIGINATE_SYNTAX);
 		switch_safe_free(mycmd);
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -1097,6 +1090,7 @@
 	return 0;
 }
 
+#define SHOW_SYNTAX "codec|application|api|dialplan|file|timer|calls|channels"
 SWITCH_STANDARD_API(show_function)
 {
 	char sql[1024];
@@ -1129,7 +1123,7 @@
 	// If you changes the field qty or order of any of these select
 	// statmements, you must also change show_callback and friends to match!
 	if (!command) {
-		stream->write_function(stream, "USAGE: %s\n", show_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", SHOW_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
 	} else if (!strcmp(command, "codec") || !strcmp(command, "dialplan") || !strcmp(command, "file") || !strcmp(command, "timer")) {
 		sprintf(sql, "select type, name from interfaces where type = '%s'", command);
@@ -1153,7 +1147,7 @@
 			snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api'");
 		}
 	} else {
-		stream->write_function(stream, "USAGE: %s\n", show_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", SHOW_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -1247,224 +1241,36 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
-static switch_api_interface_t xml_wrap_api_interface = {
-	/*.interface_name */ "xml_wrap",
-	/*.desc */ "Wrap another api command in xml",
-	/*.function */ xml_wrap_api_function,
-	/*.syntax */ "<command> <args>",
-	/*.next */ NULL
-};
-
-static switch_api_interface_t sched_del_api_interface = {
-	/*.interface_name */ "sched_del",
-	/*.desc */ "Delete a Scheduled task",
-	/*.function */ sched_del_function,
-	/*.syntax */ "<task_id>|<group_id>",
-	/*.next */ &xml_wrap_api_interface
-};
-
-static switch_api_interface_t sched_api_api_interface = {
-	/*.interface_name */ "sched_api",
-	/*.desc */ "Schedule an api command",
-	/*.function */ sched_api_function,
-	/*.syntax */ "[+]<time> <group_name> <command_string>",
-	/*.next */ &sched_del_api_interface
-};
-
-static switch_api_interface_t sched_transfer_api_interface = {
-	/*.interface_name */ "sched_transfer",
-	/*.desc */ "Schedule a broadcast event to a running call",
-	/*.function */ sched_transfer_function,
-	/*.syntax */ "[+]<time> <uuid> <extension> [<dialplan>] [<context>]",
-	/*.next */ &sched_api_api_interface
-};
-
-static switch_api_interface_t sched_broadcast_api_interface = {
-	/*.interface_name */ "sched_broadcast",
-	/*.desc */ "Schedule a broadcast event to a running call",
-	/*.function */ sched_broadcast_function,
-	/*.syntax */ "[+]<time> <uuid> <path> [aleg|bleg|both]",
-	/*.next */ &sched_transfer_api_interface
-};
-
-static switch_api_interface_t sched_hangup_api_interface = {
-	/*.interface_name */ "sched_hangup",
-	/*.desc */ "Schedule a running call to hangup",
-	/*.function */ sched_hangup_function,
-	/*.syntax */ "[+]<time> <uuid> [<cause>]",
-	/*.next */ &sched_broadcast_api_interface
-};
-
-static switch_api_interface_t version_api_interface = {
-	/*.interface_name */ "version",
-	/*.desc */ "Show version of the switch",
-	/*.function */ version_function,
-	/*.syntax */ "",
-	/*.next */ &sched_hangup_api_interface
-};
-
-static switch_api_interface_t help_api_interface = {
-	/*.interface_name */ "help",
-	/*.desc */ "Show help for all the api commands",
-	/*.function */ help_function,
-	/*.syntax */ "",
-	/*.next */ &version_api_interface,
-};
-
-static switch_api_interface_t ctl_api_interface = {
-	/*.interface_name */ "fsctl",
-	/*.desc */ "control messages",
-	/*.function */ ctl_function,
-	/*.syntax */ "[hupall|pause|resume|shutdown]",
-	/*.next */ &help_api_interface
-};
-
-static switch_api_interface_t media_api_interface = {
-	/*.interface_name */ "media",
-	/*.desc */ "media",
-	/*.function */ uuid_media_function,
-	/*.syntax */ "<uuid>",
-	/*.next */ &ctl_api_interface
-};
-
-static switch_api_interface_t hold_api_interface = {
-	/*.interface_name */ "hold",
-	/*.desc */ "hold",
-	/*.function */ uuid_hold_function,
-	/*.syntax */ "<uuid>",
-	/*.next */ &media_api_interface
-};
-
-static switch_api_interface_t broadcast_api_interface = {
-	/*.interface_name */ "broadcast",
-	/*.desc */ "broadcast",
-	/*.function */ uuid_broadcast_function,
-	/*.syntax */ "<uuid> <path> [aleg|bleg|both]",
-	/*.next */ &hold_api_interface
-};
-
-static switch_api_interface_t session_record_api_interface = {
-	/*.interface_name */ "session_record",
-	/*.desc */ "session record",
-	/*.function */ session_record_function,
-	/*.syntax */ "<uuid> [start|stop] <path> [<limit>]",
-	/*.next */ &broadcast_api_interface
-};
-
-static switch_api_interface_t session_displace_api_interface = {
-	/*.interface_name */ "session_displace",
-	/*.desc */ "session displace",
-	/*.function */ session_displace_function,
-	/*.syntax */ "<uuid> [start|stop] <path> [<limit>] [mux]",
-	/*.next */ &broadcast_api_interface
-};
-
-static switch_api_interface_t uuid_bridge_api_interface = {
-	/*.interface_name */ "uuid_bridge",
-	/*.desc */ "uuid_bridge",
-	/*.function */ uuid_bridge_function,
-	/*.syntax */ "<uuid> <other_uuid>",
-	/*.next */ &session_displace_api_interface
-};
-
-static switch_api_interface_t status_api_interface = {
-	/*.interface_name */ "status",
-	/*.desc */ "status",
-	/*.function */ status_function,
-	/*.syntax */ "",
-	/*.next */ &uuid_bridge_api_interface
-};
-
-static switch_api_interface_t show_api_interface = {
-	/*.interface_name */ "show",
-	/*.desc */ "Show",
-	/*.function */ show_function,
-	/*.syntax */ "codec|application|api|dialplan|file|timer|calls|channels",
-	/*.next */ &status_api_interface
-};
-
-static switch_api_interface_t pause_api_interface = {
-	/*.interface_name */ "pause",
-	/*.desc */ "Pause",
-	/*.function */ pause_function,
-	/*.syntax */ "<uuid> <on|off>",
-	/*.next */ &show_api_interface
-};
-
-static switch_api_interface_t transfer_api_interface = {
-	/*.interface_name */ "transfer",
-	/*.desc */ "Transfer",
-	/*.function */ transfer_function,
-	/*.syntax */ "<uuid> <dest-exten> [<dialplan>] [<context>]",
-	/*.next */ &pause_api_interface
-};
-
-static switch_api_interface_t load_api_interface = {
-	/*.interface_name */ "load",
-	/*.desc */ "Load Module",
-	/*.function */ load_function,
-	/*.syntax */ "<mod_name>",
-	/*.next */ &transfer_api_interface
-};
-
-static switch_api_interface_t unload_api_interface = {
-	/*.interface_name */ "unload",
-	/*.desc */ "Unoad Module",
-	/*.function */ unload_function,
-	/*.syntax */ "<mod_name>",
-	/*.next */ &load_api_interface
-};
-
-static switch_api_interface_t reload_api_interface = {
-	/*.interface_name */ "reloadxml",
-	/*.desc */ "Reload XML",
-	/*.function */ reload_function,
-	/*.syntax */ "",
-	/*.next */ &unload_api_interface,
-
-};
-
-static switch_api_interface_t kill_api_interface = {
-	/*.interface_name */ "killchan",
-	/*.desc */ "Kill Channel",
-	/*.function */ kill_function,
-	/*.syntax */ "<uuid>",
-	/*.next */ &reload_api_interface
-};
-
-static switch_api_interface_t tone_detect_session_interface = {
-	/*.interface_name */ "tone_detect",
-	/*.desc */ "Start Tone Detection on a channel",
-	/*.function */ tone_detect_session_function,
-	/*.syntax */
-	"<uuid> <key> <tone_spec> [<flags> <timeout> <app> <args>]",
-	/*.next */ &kill_api_interface
-};
-
-static switch_api_interface_t originate_api_interface = {
-	/*.interface_name */ "originate",
-	/*.desc */ "Originate a Call",
-	/*.function */ originate_function,
-	/*.syntax */
-	"<call url> <exten>|&<application_name>(<app_args>) [<dialplan>] [<context>] [<cid_name>] [<cid_num>] [<timeout_sec>]",
-	/*.next */ &tone_detect_session_interface
-};
-
-static switch_loadable_module_interface_t commands_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ &originate_api_interface
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
 {
-	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &commands_module_interface;
+	switch_api_interface_t *commands_api_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+	SWITCH_ADD_API(commands_api_interface, "originate", "Originate a Call", originate_function, ORIGINATE_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "tone_detect", "Start Tone Detection on a channel", tone_detect_session_function, TONE_DETECT_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "killchan", "Kill Channel", kill_function, KILL_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "reloadxml", "Reload XML", reload_function, "");
+	SWITCH_ADD_API(commands_api_interface, "unload", "Unload Module", unload_function, LOAD_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "load", "Load Module", load_function, LOAD_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "transfer", "Transfer Module", transfer_function, TRANSFER_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "pause", "Pause", pause_function, PAUSE_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "show", "Show", show_function, SHOW_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "status", "status", status_function, "");
+	SWITCH_ADD_API(commands_api_interface, "uuid_bridge", "uuid_bridge", uuid_bridge_function, UUID_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "session_displace", "session displace", session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
+	SWITCH_ADD_API(commands_api_interface, "session_record", "session record", session_record_function, SESS_REC_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "hold", "hold", uuid_hold_function, HOLD_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "media", "media", uuid_media_function, MEDIA_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "fsctl", "control messages", ctl_function, CTL_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "help", "Show help for all the api commands", help_function, "");
+	SWITCH_ADD_API(commands_api_interface, "version", "Show version of the switch", version_function, "");
+	SWITCH_ADD_API(commands_api_interface, "sched_hangup", "Schedule a running call to hangup", sched_hangup_function, SCHED_HANGUP_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "sched_broadcast", "Schedule a broadcast event to a running call", sched_broadcast_function, SCHED_BROADCAST_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "sched_transfer", "Schedule a broadcast event to a running call", sched_transfer_function, SCHED_TRANSFER_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "sched_api", "Schedule an api command", sched_api_function, "[+]<time> <group_name> <command_string>");
+	SWITCH_ADD_API(commands_api_interface, "sched_del", "Delete a Scheduled task", sched_del_function, "<task_id>|<group_id>");
+	SWITCH_ADD_API(commands_api_interface, "xml_wrap", "Wrap another api command in xml", xml_wrap_api_function, "<command> <args>");
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_NOUNLOAD;

Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_conference/mod_conference.c	Wed Jun 20 13:06:05 2007
@@ -39,7 +39,7 @@
 
 static const char global_app_name[] = "conference";
 static char *global_cf_name = "conference.conf";
-static switch_api_interface_t conf_api_interface;
+static char *api_syntax;
 
 /* Size to allocate for audio buffers */
 #define CONF_BUFFER_SIZE 1024 * 128
@@ -307,7 +307,7 @@
 static switch_status_t conference_outcall_bg(conference_obj_t * conference,
 											 char *conference_name,
 											 switch_core_session_t *session, char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num);
-static void conference_function(switch_core_session_t *session, char *data);
+SWITCH_STANDARD_APP(conference_function);
 static void launch_conference_thread(conference_obj_t * conference);
 static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t * thread, void *obj);
 static switch_status_t conference_local_play_file(conference_obj_t * conference,
@@ -3523,7 +3523,7 @@
 			if (strcasecmp(argv[0], "list") == 0) {
 				conf_api_sub_list(NULL, stream, argc, argv);
 			} else if (strcasecmp(argv[0], "help") == 0 || strcasecmp(argv[0], "commands") == 0) {
-				stream->write_function(stream, "%s\n", conf_api_interface.syntax);
+				stream->write_function(stream, "%s\n", api_syntax);
 			} else if (argv[1] && strcasecmp(argv[1], "dial") == 0) {
 				if (conf_api_sub_dial(NULL, stream, argc, argv) != SWITCH_STATUS_SUCCESS) {
 					/* command returned error, so show syntax usage */
@@ -3855,7 +3855,7 @@
 
 }
 
-static void conference_auto_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(conference_auto_function)
 {
 	switch_channel_t *channel = NULL;
 	call_list_t *call_list, *np;
@@ -3890,7 +3890,7 @@
 }
 
 /* Application interface function that is called from the dialplan to join the channel to a conference */
-static void conference_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(conference_function)
 {
 	switch_codec_t *read_codec = NULL;
 	uint32_t flags = 0;
@@ -4338,30 +4338,6 @@
 	switch_thread_create(&thread, thd_attr, conference_record_thread_run, rec, rec->pool);
 }
 
-static switch_application_interface_t conference_autocall_application_interface = {
-	/*.interface_name */ "conference_set_auto_outcall",
-	/*.application_function */ conference_auto_function,
-	NULL, NULL, NULL,
-	/* flags */ SAF_NONE,
-	/*.next */
-};
-
-static switch_application_interface_t conference_application_interface = {
-	/*.interface_name */ global_app_name,
-	/*.application_function */ conference_function,
-	NULL, NULL, NULL,
-	/* flags */ SAF_NONE,
-	/*.next */ &conference_autocall_application_interface
-};
-
-static switch_api_interface_t conf_api_interface = {
-	/*.interface_name */ "conference",
-	/*.desc */ "Conference module commands",
-	/*.function */ conf_api_main,
-	/*.syntax *//* see switch_module_load, this is built on the fly */
-	/*.next */
-};
-
 static switch_status_t chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint)
 {
 	char name[512] = "", *p, *lbuf = NULL;
@@ -4412,7 +4388,7 @@
 #if 0
 			else {
 				if (strcasecmp(argv[0], "help") == 0 || strcasecmp(argv[0], "commands") == 0) {
-					stream.write_function(&stream, "%s\n", conf_api_interface.syntax);
+					stream.write_function(&stream, "%s\n", api_syntax);
 					/* find a normal command */
 				} else {
 					conf_api_dispatch(conference, &stream, argc, argv, (const char *) body, 0);
@@ -4431,26 +4407,6 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_chat_interface_t conference_chat_interface = {
-	/*.name */ CONF_CHAT_PROTO,
-	/*.chat_send */ chat_send,
-
-};
-
-static switch_loadable_module_interface_t conference_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ &conference_application_interface,
-	/*.api_interface */ &conf_api_interface,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL,
-	/*.chat_interface */ &conference_chat_interface
-};
-
 static switch_status_t conf_default_controls(conference_obj_t * conference)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
@@ -4941,10 +4897,16 @@
 	uint32_t i;
 	size_t nl, ol = 0;
 	char *p = NULL;
+	switch_chat_interface_t *chat_interface;
+	switch_api_interface_t *api_interface;
+	switch_application_interface_t *app_interface;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
 	memset(&globals, 0, sizeof(globals));
 
+	/* Connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
 	/* build api interface help ".syntax" field string */
 	p = strdup("");
 	for (i = 0; i < CONFFUNCAPISIZE; i++) {
@@ -4962,13 +4924,12 @@
 		}
 
 	}
-	/* install api interface help ".syntax" field string */
-	if (p != NULL) {
-		conf_api_interface.syntax = p;
-	}
+	api_syntax = p;
 
-	/* Connect my internal structure to the blank pointer passed to me */
-	*module_interface = &conference_module_interface;
+	SWITCH_ADD_API(api_interface, "conference", "Conference module commands", conf_api_main, p);
+	SWITCH_ADD_APP(app_interface, global_app_name, global_app_name, NULL, conference_function, NULL, SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "conference_set_auto_outcall", "conference_set_auto_outcall", NULL, conference_auto_function, NULL, SAF_NONE);
+	SWITCH_ADD_CHAT(chat_interface, CONF_CHAT_PROTO, chat_send);
 
 	/* create/register custom event message type */
 	if (switch_event_reserve_subclass(CONF_EVENT_MAINT) != SWITCH_STATUS_SUCCESS) {
@@ -4977,10 +4938,7 @@
 	}
 
 	/* Setup the pool */
-	if (switch_core_new_memory_pool(&globals.conference_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no conference pool\n");
-		return SWITCH_STATUS_TERM;
-	}
+	globals.conference_pool = pool;
 
 	/* Setup a hash to store conferences by name */
 	switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
@@ -5015,9 +4973,7 @@
 		}
 
 		/* free api interface help ".syntax" field string */
-		if (conf_api_interface.syntax != NULL) {
-			free((char *) conf_api_interface.syntax);
-		}
+		switch_safe_free(api_syntax);
 	}
 
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_dptools/mod_dptools.c	Wed Jun 20 13:06:05 2007
@@ -37,10 +37,8 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load);
 SWITCH_MODULE_DEFINITION(mod_dptools, mod_dptools_load, NULL, NULL);
 
-static switch_application_interface_t detect_speech_application_interface;
-static switch_application_interface_t exe_application_interface;
-
-static void detect_speech_function(switch_core_session_t *session, char *data)
+#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume"
+SWITCH_STANDARD_APP(detect_speech_function)
 {
 	char *argv[4];
 	int argc;
@@ -62,12 +60,13 @@
 			switch_ivr_detect_speech(session, argv[0], argv[1], argv[2], argv[3], NULL);
 		}
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", detect_speech_application_interface.syntax);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", DETECT_SPEECH_SYNTAX);
 	}
 
 }
 
-static void exe_function(switch_core_session_t *session, char *data)
+#define EXE_SYNTAX "<extension> <dialplan> <context>"
+SWITCH_STANDARD_APP(exe_function)
 {
 	char *argv[4];
 	int argc;
@@ -83,11 +82,11 @@
 		context = argv[2];
 		switch_core_session_execute_exten(session, extension, dialplan, context);
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", exe_application_interface.syntax);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", EXE_SYNTAX);
 	}
 }
 
-static void ring_ready_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(ring_ready_function)
 {
 	switch_channel_t *channel;
 	channel = switch_core_session_get_channel(session);
@@ -95,7 +94,7 @@
 	switch_channel_ring_ready(channel);
 }
 
-static void queue_dtmf_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(queue_dtmf_function)
 {
 	switch_channel_t *channel;
 	if (!switch_strlen_zero(data)) {
@@ -105,7 +104,7 @@
 	}
 }
 
-static void transfer_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(transfer_function)
 {
 	int argc;
 	char *argv[4] = { 0 };
@@ -120,7 +119,7 @@
 	}
 }
 
-static void sched_transfer_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(sched_transfer_function)
 {
 	int argc;
 	char *argv[4] = { 0 };
@@ -143,7 +142,7 @@
 	}
 }
 
-static void sched_hangup_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(sched_hangup_function)
 {
 	int argc;
 	char *argv[5] = { 0 };
@@ -177,7 +176,7 @@
 }
 
 
-static void sched_broadcast_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(sched_broadcast_function)
 {
 	int argc;
 	char *argv[6] = { 0 };
@@ -213,7 +212,7 @@
 	}
 }
 
-static void sleep_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(sleep_function)
 {
 
 	if (switch_strlen_zero(data)) {
@@ -224,12 +223,12 @@
 	}
 }
 
-static void eval_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(eval_function)
 {
 	return;
 }
 
-static void phrase_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(phrase_function)
 {
 	switch_channel_t *channel;
 	char *mydata = NULL;
@@ -255,7 +254,7 @@
 }
 
 
-static void hangup_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(hangup_function)
 {
 	switch_channel_t *channel;
 	switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
@@ -270,7 +269,7 @@
 	switch_channel_hangup(channel, cause);
 }
 
-static void answer_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(answer_function)
 {
 	switch_channel_t *channel;
 	channel = switch_core_session_get_channel(session);
@@ -279,7 +278,7 @@
 	switch_channel_answer(channel);
 }
 
-static void pre_answer_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(pre_answer_function)
 {
 	switch_channel_t *channel;
 	channel = switch_core_session_get_channel(session);
@@ -288,7 +287,7 @@
 	switch_channel_pre_answer(channel);
 }
 
-static void redirect_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(redirect_function)
 {
 	switch_core_session_message_t msg = { 0 };
 
@@ -300,7 +299,7 @@
 
 }
 
-static void reject_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(reject_function)
 {
 	switch_core_session_message_t msg = { 0 };
 
@@ -313,7 +312,7 @@
 }
 
 
-static void set_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(set_function)
 {
 	switch_channel_t *channel;
 	char *var, *val = NULL;
@@ -339,7 +338,7 @@
 	}
 }
 
-static void export_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(export_function)
 {
 	switch_channel_t *channel;
 	char *exports, *new_exports = NULL, *new_exports_d = NULL, *var, *val = NULL, *var_name = NULL;
@@ -387,7 +386,7 @@
 	}
 }
 
-static void unset_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(unset_function)
 {
 	switch_channel_t *channel;
 
@@ -402,7 +401,7 @@
 	}
 }
 
-static void log_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(log_function)
 {
 	switch_channel_t *channel;
 	char *level, *log_str;
@@ -426,7 +425,7 @@
 }
 
 
-static void info_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(info_function)
 {
 	switch_channel_t *channel;
 	switch_event_t *event;
@@ -444,7 +443,7 @@
 
 }
 
-static void privacy_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(privacy_function)
 {
 	switch_channel_t *channel;
 	switch_caller_profile_t *caller_profile;
@@ -480,7 +479,7 @@
 	}
 }
 
-static void strftime_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(strftime_function)
 {
 	char *argv[2];
 	int argc;
@@ -607,7 +606,7 @@
 }
 #endif
 
-static void ivr_application_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(ivr_application_function)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	char *params;
@@ -651,23 +650,29 @@
 }
 
 
-static void dtm_session_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(dtmf_session_function)
 {
 	switch_ivr_inband_dtmf_session(session);
 }
 
 
-static void stop_dtmf_session_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(stop_dtmf_session_function)
 {
 	switch_ivr_stop_inband_dtmf_session(session);
 }
 
-static void fax_detect_session_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(fax_detect_session_function)
 {
 	switch_ivr_tone_detect_session(session, "fax", "1100.0", "r", 0, NULL, NULL);
 }
 
-static void tone_detect_session_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(system_session_function)
+{
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Executing command: %s\n",data);
+    system(data);
+}
+
+SWITCH_STANDARD_APP(tone_detect_session_function)
 {
 	char *argv[6] = { 0 };
 	int argc;
@@ -699,13 +704,13 @@
 	switch_ivr_tone_detect_session(session, argv[0], argv[1], argv[2], to, argv[4], argv[5]);
 }
 
-static void stop_fax_detect_session_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(stop_fax_detect_session_function)
 {
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Disabling tone detection\n");
 	switch_ivr_stop_tone_detect_session(session);
 }
 
-static void echo_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(echo_function)
 {
 	switch_channel_t *channel;
 
@@ -717,7 +722,7 @@
 	switch_channel_set_state(channel, CS_LOOPBACK);
 }
 
-static void park_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(park_function)
 {
 	switch_ivr_park(session, NULL);
 
@@ -753,7 +758,7 @@
 }
 
 
-static void speak_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(speak_function)
 {
 	switch_channel_t *channel;
 	char buf[10];
@@ -802,7 +807,7 @@
 
 }
 
-static void playback_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(playback_function)
 {
 	switch_channel_t *channel;
 	char *file_name = NULL;
@@ -820,7 +825,7 @@
 
 }
 
-static void gentones_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(gentones_function)
 {
 	switch_channel_t *channel;
 	char *tone_script = NULL;
@@ -849,7 +854,7 @@
 
 }
 
-static void displace_session_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(displace_session_function)
 {
 	switch_channel_t *channel;
 	char *path = NULL;
@@ -877,7 +882,7 @@
 }
 
 
-static void stop_displace_session_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(stop_displace_session_function)
 {
 	switch_channel_t *channel;
 	channel = switch_core_session_get_channel(session);
@@ -887,7 +892,7 @@
 }
 
 
-static void record_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(record_function)
 {
 	switch_channel_t *channel;
 	switch_status_t status;
@@ -919,7 +924,7 @@
 }
 
 
-static void record_session_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(record_session_function)
 {
 	switch_channel_t *channel;
 	char *p, *path = NULL;
@@ -943,7 +948,7 @@
 }
 
 
-static void stop_record_session_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(stop_record_session_function)
 {
 	switch_channel_t *channel;
 	channel = switch_core_session_get_channel(session);
@@ -956,7 +961,7 @@
 /*								Bridge Functions								*/
 /********************************************************************************/
 
-static void audio_bridge_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(audio_bridge_function)
 {
 	switch_channel_t *caller_channel;
 	switch_core_session_t *peer_session = NULL;
@@ -1040,460 +1045,73 @@
 	}
 }
 
-static switch_api_interface_t strepoch_api_interface = {
-	/*.interface_name */ "strepoch",
-	/*.desc */ "Convert a date string into epoch time",
-	/*.function */ strepoch_api_function,
-	/*.syntax */ "<string>",
-	/*.next */ NULL
-};
-
-static switch_api_interface_t chat_api_interface = {
-	/*.interface_name */ "chat",
-	/*.desc */ "chat",
-	/*.function */ chat_api_function,
-	/*.syntax */ "<proto>|<from>|<to>|<message>",
-	/*.next */ &strepoch_api_interface
-};
-
-static switch_api_interface_t dptools_api_interface = {
-	/*.interface_name */ "strftime",
-	/*.desc */ "strftime",
-	/*.function */ strftime_api_function,
-	/*.syntax */ "<format_string>",
-	/*.next */ &chat_api_interface
-};
-
-static switch_api_interface_t presence_api_interface = {
-	/*.interface_name */ "presence",
-	/*.desc */ "presence",
-	/*.function */ presence_api_function,
-	/*.syntax */ "<user> <rpid> <message>",
-	/*.next */ &dptools_api_interface
-};
-
-
-static switch_application_interface_t bridge_application_interface = {
-	/*.interface_name */ "bridge",
-	/*.application_function */ audio_bridge_function,
-	/* long_desc */ "Bridge the audio between two sessions",
-	/* short_desc */ "Bridge Audio",
-	/* syntax */ "<channel_url>",
-	/* flags */ SAF_SUPPORT_NOMEDIA
-};
-
-static switch_application_interface_t speak_application_interface = {
-	/*.interface_name */ "speak",
-	/*.application_function */ speak_function,
-	/* long_desc */ "Speak text to a channel via the tts interface",
-	/* short_desc */ "Speak text",
-	/* syntax */ "<engine>|<voice>|<text>",
-	/* flags */ SAF_NONE,
-	&bridge_application_interface
-};
-
-static switch_application_interface_t displace_application_interface = {
-	/*.interface_name */ "displace_session",
-	/*.application_function */ displace_session_function,
-	/* long_desc */ "Displace audio from a file to the channels input",
-	/* short_desc */ "Displace File",
-	/* syntax */ "<path> [+time_limit_ms] [mux]",
-	/* flags */ SAF_NONE,
-	&speak_application_interface
-};
-
-static switch_application_interface_t stop_displace_application_interface = {
-	/*.interface_name */ "stop_displace_session",
-	/*.application_function */ stop_displace_session_function,
-	/* long_desc */ "Stop Displacing to a file",
-	/* short_desc */ "Stop Displace File",
-	/* syntax */ "<path>",
-	/* flags */ SAF_NONE,
-	&displace_application_interface
-};
-
-static switch_application_interface_t record_application_interface = {
-	/*.interface_name */ "record",
-	/*.application_function */ record_function,
-	/* long_desc */ "Record a file from the channels input",
-	/* short_desc */ "Record File",
-	/* syntax */ "<path> [+time_limit_ms]",
-	/* flags */ SAF_NONE,
-	&stop_displace_application_interface
-};
-
-
-static switch_application_interface_t record_session_application_interface = {
-	/*.interface_name */ "record_session",
-	/*.application_function */ record_session_function,
-	/* long_desc */ "Starts a background recording of the entire session",
-	/* short_desc */ "Record Session",
-	/* syntax */ "<path>",
-	/* flags */ SAF_NONE,
-	&record_application_interface
-};
-
-
-static switch_application_interface_t stop_record_session_application_interface = {
-	/*.interface_name */ "stop_record_session",
-	/*.application_function */ stop_record_session_function,
-	/* long_desc */ "Stops a background recording of the entire session",
-	/* short_desc */ "Stop Record Session",
-	/* syntax */ "<path>",
-	/* flags */ SAF_NONE,
-	&record_session_application_interface
-};
-
-static switch_application_interface_t playback_application_interface = {
-	/*.interface_name */ "playback",
-	/*.application_function */ playback_function,
-	/* long_desc */ "Playback a file to the channel",
-	/* short_desc */ "Playback File",
-	/* syntax */ "<path>",
-	/* flags */ SAF_NONE,
-	/*.next */ &stop_record_session_application_interface
-};
-
-static switch_application_interface_t gentones_application_interface = {
-	/*.interface_name */ "gentones",
-	/*.application_function */ gentones_function,
-	/* long_desc */ "Generate tones to the channel",
-	/* short_desc */ "Generate Tones",
-	/* syntax */ "<tgml_script>[|<loops>]",
-	/* flags */ SAF_NONE,
-	/*.next */ &playback_application_interface
-};
-
-static switch_application_interface_t park_application_interface = {
-	/*.interface_name */ "park",
-	/*.application_function */ park_function,
-	/* long_desc */ NULL,
-	/* short_desc */ NULL,
-	/* syntax */ NULL,
-	/* flags */ SAF_NONE,
-	/*.next */ &gentones_application_interface
-};
-
-static switch_application_interface_t echo_application_interface = {
-	/*.interface_name */ "echo",
-	/*.application_function */ echo_function,
-	/* long_desc */ "Perform an echo test against the calling channel",
-	/* short_desc */ "Echo",
-	/* syntax */ "",
-	/* flags */ SAF_NONE,
-	/*.next */ &park_application_interface
-};
-
-
-static switch_application_interface_t tone_detect_application_interface = {
-	/*.interface_name */ "tone_detect",
-	/*.application_function */ tone_detect_session_function,
-	/* long_desc */ "Detect tones",
-	/* short_desc */ "Detect tones",
-	/* syntax */ "",
-	/* flags */ SAF_NONE,
-	/*.next */ &echo_application_interface
-};
-
-static switch_application_interface_t fax_detect_application_interface = {
-	/*.interface_name */ "fax_detect",
-	/*.application_function */ fax_detect_session_function,
-	/* long_desc */ "Detect fax send tone",
-	/* short_desc */ "Detect faxes",
-	/* syntax */ "",
-	/* flags */ SAF_NONE,
-	/*.next */ &tone_detect_application_interface
-};
-
-static switch_application_interface_t stop_tone_detect_application_interface = {
-	/*.interface_name */ "stop_tone_detect",
-	/*.application_function */ stop_fax_detect_session_function,
-	/* long_desc */ "Stop detecting tones",
-	/* short_desc */ "stop detecting tones",
-	/* syntax */ "",
-	/* flags */ SAF_NONE,
-	/* next */ &fax_detect_application_interface
-};
-
-static switch_application_interface_t dtmf_application_interface = {
-	/*.interface_name */ "start_dtmf",
-	/*.application_function */ dtm_session_function,
-	/* long_desc */ "Detect inband dtmf on the session",
-	/* short_desc */ "Detect dtmf",
-	/* syntax */ "",
-	/* flags */ SAF_NONE,
-	/* next */ &stop_tone_detect_application_interface
-};
-
-static switch_application_interface_t stop_dtmf_application_interface = {
-	/*.interface_name */ "stop_dtmf",
-	/*.application_function */ stop_dtmf_session_function,
-	/* long_desc */ "Stop detecting inband dtmf.",
-	/* short_desc */ "stop inband dtmf.",
-	/* syntax */ "",
-	/* flags */ SAF_NONE,
-	&dtmf_application_interface
-};
-
-static switch_application_interface_t exe_application_interface = {
-	/*.interface_name */ "execute_extension",
-	/*.application_function */ exe_function,
-	/*.long_desc */ "Execute an extension",
-	/*.short_desc */ "Execute an extension",
-	/*.syntax */ "<extension> <dialplan> <context>",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &stop_dtmf_application_interface
-};
-
-static switch_application_interface_t sched_transfer_application_interface = {
-	/*.interface_name */ "sched_transfer",
-	/*.application_function */ sched_transfer_function,
-	/*.long_desc */ "Schedule a transfer in the future",
-	/*.short_desc */ "Schedule a transfer in the future",
-	/*.syntax */ "[+]<time> <extension> <dialplan> <context>",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &exe_application_interface
-};
-
-static switch_application_interface_t sched_broadcast_application_interface = {
-	/*.interface_name */ "sched_broadcast",
-	/*.application_function */ sched_broadcast_function,
-	/*.long_desc */ "Schedule a broadcast in the future",
-	/*.short_desc */ "Schedule a broadcast in the future",
-	/*.syntax */ "[+]<time> <path> [aleg|bleg|both]",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &sched_transfer_application_interface
-};
-
-static switch_application_interface_t sched_hangup_application_interface = {
-	/*.interface_name */ "sched_hangup",
-	/*.application_function */ sched_hangup_function,
-	/*.long_desc */ "Schedule a hangup in the future",
-	/*.short_desc */ "Schedule a hangup in the future",
-	/*.syntax */ "[+]<time> [<cause>]",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &sched_broadcast_application_interface
-};
-
-
-static switch_application_interface_t queuedtmf_application_interface = {
-	/*.interface_name */ "queue_dtmf",
-	/*.application_function */ queue_dtmf_function,
-	/* long_desc */ "Queue dtmf to be sent from a session",
-	/* short_desc */ "Queue dtmf to be sent",
-	/* syntax */ "<dtmf_data>",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &sched_hangup_application_interface
-};
-
-static switch_application_interface_t reject_application_interface = {
-	/*.interface_name */ "reject",
-	/*.application_function */ reject_function,
-	/* long_desc */ "Send a reject message to a session.",
-	/* short_desc */ "Send session reject",
-	/* syntax */ "<reject_data>",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &queuedtmf_application_interface
-};
-
-static switch_application_interface_t redirect_application_interface = {
-	/*.interface_name */ "redirect",
-	/*.application_function */ redirect_function,
-	/* long_desc */ "Send a redirect message to a session.",
-	/* short_desc */ "Send session redirect",
-	/* syntax */ "<redirect_data>",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &reject_application_interface
-};
-
-static switch_application_interface_t ivr_application_interface = {
-	/*.interface_name */ "ivr",
-	/*.application_function */ ivr_application_function,
-	/* long_desc */ "Run an ivr menu.",
-	/* short_desc */ "Run an ivr menu",
-	/* syntax */ "<menu_name>",
-	/* flags */ SAF_NONE,
-	/*.next */ &redirect_application_interface
-};
-
-static switch_application_interface_t detect_speech_application_interface = {
-	/*.interface_name */ "detect_speech",
-	/*.application_function */ detect_speech_function,
-	/* long_desc */ "Detect speech on a channel.",
-	/* short_desc */ "Detect speech",
-	/* syntax */ "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume",
-	/* flags */ SAF_NONE,
-	/*.next */ &ivr_application_interface
-};
-
-static switch_application_interface_t ring_ready_application_interface = {
-	/*.interface_name */ "ring_ready",
-	/*.application_function */ ring_ready_function,
-	/* long_desc */ "Indicate Ring_Ready on a channel.",
-	/* short_desc */ "Indicate Ring_Ready",
-	/* syntax */ "",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &detect_speech_application_interface
-};
-
-static switch_application_interface_t unset_application_interface = {
-	/*.interface_name */ "unset",
-	/*.application_function */ unset_function,
-	/* long_desc */ "Unset a channel varaible for the channel calling the application.",
-	/* short_desc */ "Unset a channel varaible",
-	/* syntax */ "<varname>",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &ring_ready_application_interface
-};
-
-static switch_application_interface_t set_application_interface = {
-	/*.interface_name */ "set",
-	/*.application_function */ set_function,
-	/* long_desc */ "Set a channel varaible for the channel calling the application.",
-	/* short_desc */ "Set a channel varaible",
-	/* syntax */ "<varname>=<value>",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &unset_application_interface
-};
-
-static switch_application_interface_t export_application_interface = {
-	/*.interface_name */ "export",
-	/*.application_function */ export_function,
-	/* long_desc */ "Set and export a channel varaible for the channel calling the application.",
-	/* short_desc */ "Export a channel varaible across a bridge",
-	/* syntax */ "<varname>=<value>",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &set_application_interface
-};
-
-static switch_application_interface_t info_application_interface = {
-	/*.interface_name */ "info",
-	/*.application_function */ info_function,
-	/* long_desc */ "Display Call Info",
-	/* short_desc */ "Display Call Info",
-	/* syntax */ "",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &export_application_interface
-};
-
-static switch_application_interface_t log_application_interface = {
-	/*.interface_name */ "log",
-	/*.application_function */ log_function,
-	/* long_desc */ "Logs a channel varaible for the channel calling the application.",
-	/* short_desc */ "Logs a channel varaible",
-	/* syntax */ "<varname>",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &info_application_interface
-};
-
-
-static switch_application_interface_t hangup_application_interface = {
-	/*.interface_name */ "hangup",
-	/*.application_function */ hangup_function,
-	/* long_desc */ "Hangup the call for a channel.",
-	/* short_desc */ "Hangup the call",
-	/* syntax */ "[<cause>]",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &log_application_interface
-};
-
-static switch_application_interface_t answer_application_interface = {
-	/*.interface_name */ "answer",
-	/*.application_function */ answer_function,
-	/* long_desc */ "Answer the call for a channel.",
-	/* short_desc */ "Answer the call",
-	/* syntax */ "",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &hangup_application_interface
-};
-
-static switch_application_interface_t pre_answer_application_interface = {
-	/*.interface_name */ "pre_answer",
-	/*.application_function */ pre_answer_function,
-	/* long_desc */ "Pre-Answer the call for a channel.",
-	/* short_desc */ "Pre-Answer the call",
-	/* syntax */ "",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &answer_application_interface
-};
-
-static switch_application_interface_t eval_application_interface = {
-	/*.interface_name */ "eval",
-	/*.application_function */ eval_function,
-	/* long_desc */ "Do Nothing",
-	/* short_desc */ "Do Nothing",
-	/* syntax */ "",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &pre_answer_application_interface
-};
-
-static switch_application_interface_t phrase_application_interface = {
-	/*.interface_name */ "phrase",
-	/*.application_function */ phrase_function,
-	/* long_desc */ "Say a Phrase",
-	/* short_desc */ "Say a Phrase",
-	/* syntax */ "<macro_name>,<data>",
-	/* flags */ SAF_NONE,
-	/*.next */ &eval_application_interface
-};
-
-static switch_application_interface_t strftime_application_interface = {
-	/*.interface_name */ "strftime",
-	/*.application_function */ strftime_function,
-	/* long_desc */ NULL,
-	/* short_desc */ NULL,
-	/* syntax */ NULL,
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &phrase_application_interface
-};
-
-static switch_application_interface_t sleep_application_interface = {
-	/*.interface_name */ "sleep",
-	/*.application_function */ sleep_function,
-	/* long_desc */
-	"Pause the channel for a given number of milliseconds, consuming the audio for that period of time.",
-	/* short_desc */ "Pause a channel",
-	/* syntax */ "<pausemilliseconds>",
-	/* flags */ SAF_NONE,
-	/* next */ &strftime_application_interface
-};
-
-static switch_application_interface_t transfer_application_interface = {
-	/*.interface_name */ "transfer",
-	/*.application_function */ transfer_function,
-	/* long_desc */ "Immediatly transfer the calling channel to a new extension",
-	/* short_desc */ "Transfer a channel",
-	/* syntax */ "<exten> [<dialplan> <context>]",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/* next */ &sleep_application_interface
-};
-
-static switch_application_interface_t privacy_application_interface = {
-	/*.interface_name */ "privacy",
-	/*.application_function */ privacy_function,
-	/* long_desc */ "Set caller privacy on calls.",
-	/* short_desc */ "Set privacy on calls",
-	/* syntax */ "off|on|name|full|number",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ &transfer_application_interface
-};
-
-static switch_loadable_module_interface_t dptools_module_interface = {
-	/*.module_name = */ modname,
-	/*.endpoint_interface = */ NULL,
-	/*.timer_interface = */ NULL,
-	/*.dialplan_interface = */ NULL,
-	/*.codec_interface = */ NULL,
-	/*.application_interface */ &privacy_application_interface,
-	/*.api_interface */ &presence_api_interface
-};
 
+#define SPEAK_DESC "Speak text to a channel via the tts interface"
+#define DISPLACE_DESC "Displace audio from a file to the channels input"
+#define SESS_REC_DESC "Starts a background recording of the entire session"
+#define STOP_SESS_REC_DESC "Stops a background recording of the entire session"
+#define SCHED_TRANSF_DESCR "Schedule a transfer in the future"
+#define SCHED_BROADCAST_DESCR "Schedule a broadcast in the future"
+#define SCHED_HANGUP_DESCR "Schedule a hangup in the future"
+#define UNSET_LONG_DESC "Unset a channel varaible for the channel calling the application."
+#define SET_LONG_DESC "Set a channel varaible for the channel calling the application."
+#define EXPORT_LONG_DESC "Set and export a channel varaible for the channel calling the application."
+#define LOG_LONG_DESC "Logs a channel varaible for the channel calling the application."
+#define TRANSFER_LONG_DESC "Immediatly transfer the calling channel to a new extension"
+#define SLEEP_LONG_DESC "Pause the channel for a given number of milliseconds, consuming the audio for that period of time."
 SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
 {
+	switch_api_interface_t *api_interface;
+	switch_application_interface_t *app_interface;
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &dptools_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
+ 	SWITCH_ADD_API(api_interface, "strepoch", "Convert a date string into epoch time", strepoch_api_function, "<string>");
+	SWITCH_ADD_API(api_interface, "chat", "chat", chat_api_function, "<proto>|<from>|<to>|<message>");
+	SWITCH_ADD_API(api_interface, "strftime", "strftime", strftime_api_function, "<format_string>");
+	SWITCH_ADD_API(api_interface, "presence", "presence", presence_api_function, "<user> <rpid> <message>");
+	SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "transfer", "Transfer a channel", TRANSFER_LONG_DESC, transfer_function, "<exten> [<dialplan> <context>]", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "sleep", "Pause a channel", SLEEP_LONG_DESC, sleep_function, "<pausemilliseconds>", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "strftime", NULL, NULL, strftime_function, NULL, SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "phrase", "Say a Phrase", "Say a Phrase", phrase_function, "<macro_name>,<data>", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "eval", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "hangup", "Hangup the call", "Hangup the call for a channel.", hangup_function, "[<cause>]", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "log", "Logs a channel varaible", LOG_LONG_DESC, log_function, "<varname>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "info", "Display Call Info", "Display Call Info", info_function, "", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "export", "Export a channel varaible across a bridge", EXPORT_LONG_DESC, export_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "set", "Set a channel varaible", SET_LONG_DESC, set_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "unset", "Unset a channel varaible", UNSET_LONG_DESC, unset_function, "<varname>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "ring_ready", "Indicate Ring_Ready", "Indicate Ring_Ready on a channel.", ring_ready_function, "", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "detect_speech", "Detect speech", "Detect speech on a channel.", detect_speech_function, DETECT_SPEECH_SYNTAX, SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "ivr", "Run an ivr menu", "Run an ivr menu.", ivr_application_function, "<menu_name>", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "redirect", "Send session redirect", "Send a redirect message to a session.", redirect_function, "<redirect_data>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "reject", "Send session reject", "Send a reject message to a session.", reject_function, "<reject_data>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "sched_hangup", SCHED_HANGUP_DESCR, SCHED_HANGUP_DESCR, sched_hangup_function, "[+]<time> [<cause>]", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "sched_broadcast", SCHED_BROADCAST_DESCR, SCHED_BROADCAST_DESCR, sched_broadcast_function, "[+]<time> <path> [aleg|bleg|both]", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "sched_transfer", SCHED_TRANSF_DESCR, SCHED_TRANSF_DESCR, sched_transfer_function, "[+]<time> <extension> <dialplan> <context>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "execute_extension", "Execute an extension", "Execute an extension", exe_function, EXE_SYNTAX, SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "stop_dtmf", "stop inband dtmf", "Stop detecting inband dtmf.", stop_dtmf_session_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "stop_tone_detect", "stop detecting tones", "Stop detecting tones", stop_fax_detect_session_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "fax_detect", "Detect faxes", "Detect fax send tone", fax_detect_session_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "tone_detect", "Detect tones", "Detect tones", tone_detect_session_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "echo", "Echo", "Perform an echo test against the calling channel", echo_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "park", NULL, NULL, park_function, NULL, SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "gentones", "Generate Tones", "Generate tones to the channel", gentones_function, "<tgml_script>[|<loops>]", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "playback", "Playback File", "Playback a file to the channel", playback_function, "<path>", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "stop_record_session", "Stop Record Session", STOP_SESS_REC_DESC, stop_record_session_function, "<path>", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "record_session", "Record Session", SESS_REC_DESC, record_session_function, "<path>", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "record", "Record File", "Record a file from the channels input", record_function, "<path> [+time_limit_ms]", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "stop_displace_session", "Stop Displace File", "Stop Displacing to a file", stop_displace_session_function, "<path>", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "displace_session", "Displace File", DISPLACE_DESC, displace_session_function, "<path> [+time_limit_ms] [mux]", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "speak", "Speak text", SPEAK_DESC, speak_function, "<engine>|<voice>|<text>", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "bridge", "Bridge Audio", "Bridge the audio between two sessions", audio_bridge_function, "<channel_url>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "<command>", SAF_SUPPORT_NOMEDIA);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_enum/mod_enum.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_enum/mod_enum.c	Wed Jun 20 13:06:05 2007
@@ -111,13 +111,6 @@
 	switch_xml_t cfg, xml = NULL, param, settings, route, routes;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	memset(&globals, 0, sizeof(globals));
-	if (switch_core_new_memory_pool(&globals.pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
-		status = SWITCH_STATUS_TERM;
-		goto done;
-	}
-
 	switch_core_hash_init(&globals.routes, globals.pool);
 
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
@@ -521,7 +514,7 @@
 }
 
 
-static switch_caller_extension_t *enum_dialplan_hunt(switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile)
+SWITCH_STANDARD_DIALPLAN(enum_dialplan_hunt)
 {
 	switch_caller_extension_t *extension = NULL;
 	enum_record_t *results, *rp;
@@ -564,7 +557,7 @@
 
 }
 
-static void enum_app_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(enum_app_function)
 {
 	int argc = 0;
 	char *argv[4] = { 0 };
@@ -685,54 +678,26 @@
 }
 
 
-static switch_dialplan_interface_t enum_dialplan_interface = {
-	/*.interface_name = */ "enum",
-	/*.hunt_function = */ enum_dialplan_hunt
-		/*.next = NULL */
-};
-
-static switch_application_interface_t enum_application_interface = {
-	/*.interface_name */ "enum",
-	/*.application_function */ enum_app_function,
-	/* long_desc */ "Perform an ENUM lookup",
-	/* short_desc */ "Perform an ENUM lookup",
-	/* syntax */ "<number> [<root>]",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ NULL
-};
-
-static switch_api_interface_t enum_api_interface = {
-	/*.interface_name */ "enum",
-	/*.desc */ "ENUM",
-	/*.function */ enum_function,
-	/*.syntax */ "",
-	/*.next */ NULL
-};
-
-static switch_loadable_module_interface_t enum_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ &enum_dialplan_interface,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ &enum_application_interface,
-	/*.api_interface */ &enum_api_interface,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load)
 {
+	switch_api_interface_t *api_interface;
+	switch_application_interface_t *app_interface;
+	switch_dialplan_interface_t *dp_interface;
 
 	if (dns_init(0) < 0) {
 		return SWITCH_STATUS_FALSE;
 	}
 
+	memset(&globals, 0, sizeof(globals));
+	globals.pool = pool;
+
 	load_config();
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &enum_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_API(api_interface, "enum", "ENUM", enum_function, "");
+	SWITCH_ADD_APP(app_interface, "enum", "Perform an ENUM lookup", "Perform an ENUM lookup", enum_app_function, "<number> [<root>]", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_DIALPLAN(dp_interface, "enum", enum_dialplan_hunt);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_esf/mod_esf.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_esf/mod_esf.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_esf/mod_esf.c	Wed Jun 20 13:06:05 2007
@@ -54,7 +54,7 @@
 	SEND_TYPE_NOMEDIA = 3
 } ls_how_t;
 
-static void bcast_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(bcast_function)
 {
 	switch_channel_t *channel;
 	switch_socket_t *socket;
@@ -228,36 +228,18 @@
 }
 
 
-static switch_application_interface_t bcast_application_interface = {
-	/*.interface_name */ "esf_ls_page_group",
-	/*.application_function */ bcast_function,
-	NULL, NULL, NULL,
-	/* flags */ SAF_NONE,
-	/*.next */ NULL
-};
-
-static switch_loadable_module_interface_t mod_ivrtest_module_interface = {
-	/*.module_name = */ modname,
-	/*.endpoint_interface = */ NULL,
-	/*.timer_interface = */ NULL,
-	/*.dialplan_interface = */ NULL,
-	/*.codec_interface = */ NULL,
-	/*.application_interface */ &bcast_application_interface
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_esf_load)
 {
+	switch_application_interface_t *app_interface;
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &mod_ivrtest_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_APP(app_interface, "esf_ls_page_group", NULL, NULL, bcast_function, NULL, SAF_NONE);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
-//switch_status_t switch_module_runtime(void)
-
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/greenlizard/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/applications/mod_rss/mod_rss.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/applications/mod_rss/mod_rss.c	Wed Jun 20 13:06:05 2007
@@ -152,7 +152,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static void rss_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(rss_function)
 {
 	switch_channel_t *channel;
 	switch_status_t status;
@@ -613,33 +613,14 @@
 	switch_core_session_reset(session);
 }
 
-static switch_application_interface_t rss_application_interface = {
-	/*.interface_name */ "rss",
-	/*.application_function */ rss_function,
-	NULL, NULL, NULL,
-	/* flags */ SAF_NONE,
-	/*.next */ NULL
-};
-
-
-static switch_loadable_module_interface_t rss_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ &rss_application_interface,
-	/*.api_interface */ NULL,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL
-};
-
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_rss_load)
 {
+	switch_application_interface_t *app_interface;
+
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &rss_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_APP(app_interface, "rss", NULL, NULL, rss_function, NULL, SAF_NONE);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	Wed Jun 20 13:06:05 2007
@@ -402,33 +402,9 @@
 
 }
 
-static switch_speech_interface_t cepstral_speech_interface = {
-	/*.interface_name */ "cepstral",
-	/*.speech_open */ cepstral_speech_open,
-	/*.speech_close */ cepstral_speech_close,
-	/*.speech_feed_tts */ cepstral_speech_feed_tts,
-	/*.speech_read_tts */ cepstral_speech_read_tts,
-	/*.speech_flush_tts */ cepstral_speech_flush_tts,
-	/*.speech_text_param_tts */ cepstral_text_param_tts,
-	/*.speech_numeric_param_tts */ cepstral_numeric_param_tts,
-	/*.speech_numeric_param_tts */ cepstral_float_param_tts
-};
-
-static switch_loadable_module_interface_t cepstral_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ NULL,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ &cepstral_speech_interface,
-	/*.directory_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_cepstral_load)
 {
+	switch_speech_interface_t *speech_interface;
 
 	/* Open the Swift TTS Engine */
 	if (SWIFT_FAILED(engine = swift_engine_open(NULL))) {
@@ -437,7 +413,17 @@
 	}
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &cepstral_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	speech_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SPEECH_INTERFACE);
+	speech_interface->interface_name = "cepstral";
+	speech_interface->speech_open = cepstral_speech_open;
+	speech_interface->speech_close = cepstral_speech_close;
+	speech_interface->speech_feed_tts = cepstral_speech_feed_tts;
+	speech_interface->speech_read_tts = cepstral_speech_read_tts;
+	speech_interface->speech_flush_tts = cepstral_speech_flush_tts;
+	speech_interface->speech_text_param_tts = cepstral_text_param_tts;
+	speech_interface->speech_numeric_param_tts = cepstral_numeric_param_tts;
+	speech_interface->speech_float_param_tts = cepstral_float_param_tts;
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_amr/mod_amr.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_amr/mod_amr.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_amr/mod_amr.c	Wed Jun 20 13:06:05 2007
@@ -310,22 +310,9 @@
 	/*.destroy */ switch_amr_destroy,
 };
 
-static switch_codec_interface_t amr_codec_interface = {
-	/*.interface_name */ "GSM-AMR",
-	/*.implementations */ &amr_implementation,
-};
-
-static switch_loadable_module_interface_t amr_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ &amr_codec_interface,
-	/*.application_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load)
 {
+	switch_codec_interface_t *codec_interface;
 #ifndef AMR_PASSTHROUGH
 	char *cf = "amr.conf";
 	switch_xml_t cfg, xml, settings, param;
@@ -347,7 +334,8 @@
 #endif
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &amr_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_CODEC(codec_interface, "GSM-AMR", &amr_implementation);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_g711/mod_g711.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_g711/mod_g711.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_g711/mod_g711.c	Wed Jun 20 13:06:05 2007
@@ -392,33 +392,13 @@
 	/*.next */ &g711a_8k_20ms_implementation
 };
 
-
-
-static switch_codec_interface_t g711a_codec_interface = {
-	/*.interface_name */ "g711 alaw",
-	/*.implementations */ &g711a_8k_10ms_implementation
-};
-
-static switch_codec_interface_t g711u_codec_interface = {
-	/*.interface_name */ "g711 ulaw",
-	/*.implementations */ &g711u_8k_10ms_implementation,
-	/*.next */ &g711a_codec_interface
-};
-
-static switch_loadable_module_interface_t g711_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ &g711u_codec_interface,
-	/*.application_interface */ NULL
-};
-
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_g711_load)
 {
+	switch_codec_interface_t *codec_interface;
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &g711_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_CODEC(codec_interface, "g711 ulaw", &g711u_8k_10ms_implementation);
+	SWITCH_ADD_CODEC(codec_interface, "g711 alaw", &g711a_8k_10ms_implementation);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_g722/mod_g722.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_g722/mod_g722.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_g722/mod_g722.c	Wed Jun 20 13:06:05 2007
@@ -159,24 +159,12 @@
 	/*.next */ &g722_8k_implementation
 };
 
-static switch_codec_interface_t g722_codec_interface = {
-	/*.interface_name */ "g722",
-	/*.implementations */ &g722_16k_implementation
-};
-
-static switch_loadable_module_interface_t g722_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ &g722_codec_interface,
-	/*.application_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_g722_load)
 {
+	switch_codec_interface_t *codec_interface;
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &g722_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_CODEC(codec_interface, "g722", &g722_16k_implementation);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_g723_1/mod_g723_1.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_g723_1/mod_g723_1.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_g723_1/mod_g723_1.c	Wed Jun 20 13:06:05 2007
@@ -189,24 +189,12 @@
 	/*.destroy */ switch_g723_destroy,
 };
 
-static switch_codec_interface_t g723_1_codec_interface = {
-	/*.interface_name */ "g723.1 6.3k",
-	/*.implementations */ &g723_1_implementation,
-};
-
-static switch_loadable_module_interface_t g723_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ &g723_1_codec_interface,
-	/*.application_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_g723_1_load)
 {
+	switch_codec_interface_t *codec_interface;
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &g723_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_CODEC(codec_interface, "g723.1 6.3k", &g723_1_implementation);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_g726/mod_g726.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_g726/mod_g726.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_g726/mod_g726.c	Wed Jun 20 13:06:05 2007
@@ -368,68 +368,19 @@
 	/*.destroy */ switch_g726_destroy,
 };
 
-static switch_codec_interface_t g726_16k_codec_interface = {
-	/*.interface_name */ "G.726 16k",
-	/*.implementations */ &g726_16k_implementation,
-};
-
-static switch_codec_interface_t g726_24k_codec_interface = {
-	/*.interface_name */ "G.726 24k",
-	/*.implementations */ &g726_24k_implementation,
-	/*.next */ &g726_16k_codec_interface
-};
-
-static switch_codec_interface_t g726_32k_codec_interface = {
-	/*.interface_name */ "G.726 32k",
-	/*.implementations */ &g726_32k_implementation,
-	/*.next */ &g726_24k_codec_interface
-};
-
-static switch_codec_interface_t g726_40k_codec_interface = {
-	/*.interface_name */ "G.726 40k",
-	/*.implementations */ &g726_40k_implementation,
-	/*.next */ &g726_32k_codec_interface
-};
-
-static switch_codec_interface_t aal2_g726_16k_codec_interface = {
-	/*.interface_name */ "G.726 16k (aal2)",
-	/*.implementations */ &aal2_g726_16k_implementation,
-	/*.next */ &g726_40k_codec_interface
-};
-
-static switch_codec_interface_t aal2_g726_24k_codec_interface = {
-	/*.interface_name */ "G.726 24k (aal2)",
-	/*.implementations */ &aal2_g726_24k_implementation,
-	/*.next */ &aal2_g726_16k_codec_interface
-};
-
-static switch_codec_interface_t aal2_g726_32k_codec_interface = {
-	/*.interface_name */ "G.726 32k (aal2)",
-	/*.implementations */ &aal2_g726_32k_implementation,
-	/*.next */ &aal2_g726_24k_codec_interface
-};
-
-static switch_codec_interface_t aal2_g726_40k_codec_interface = {
-	/*.interface_name */ "G.726 40k (aal2)",
-	/*.implementations */ &aal2_g726_40k_implementation,
-	/*.next */ &aal2_g726_32k_codec_interface
-};
-
-
-
-static switch_loadable_module_interface_t g726_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ &aal2_g726_40k_codec_interface,
-	/*.application_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_g726_load)
 {
+	switch_codec_interface_t *codec_interface;
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &g726_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_CODEC(codec_interface, "G.726 40k (aal2)", &aal2_g726_40k_implementation);
+	SWITCH_ADD_CODEC(codec_interface, "G.726 32k (aal2)", &aal2_g726_32k_implementation);
+	SWITCH_ADD_CODEC(codec_interface, "G.726 24k (aal2)", &aal2_g726_24k_implementation);
+	SWITCH_ADD_CODEC(codec_interface, "G.726 16k (aal2)", &aal2_g726_16k_implementation);
+	SWITCH_ADD_CODEC(codec_interface, "G.726 40k", &g726_40k_implementation);
+	SWITCH_ADD_CODEC(codec_interface, "G.726 32k", &g726_32k_implementation);
+	SWITCH_ADD_CODEC(codec_interface, "G.726 24k", &g726_24k_implementation);
+	SWITCH_ADD_CODEC(codec_interface, "G.726 16k", &g726_16k_implementation);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_g729/mod_g729.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_g729/mod_g729.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_g729/mod_g729.c	Wed Jun 20 13:06:05 2007
@@ -295,25 +295,12 @@
 	&g729_10ms_8k_implementation
 };
 
-static switch_codec_interface_t g729_codec_interface = {
-	/*.interface_name */ "g729",
-	/*.implementations */ &g729_8k_implementation,
-	/*.next */ NULL
-};
-
-static switch_loadable_module_interface_t g729_module_interface = {
-	/*.module_name */ "g729",
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ &g729_codec_interface,
-	/*.application_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_g729_load)
 {
+	switch_codec_interface_t *codec_interface;
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &g729_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_CODEC(codec_interface, "g729", &g729_8k_implementation);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_gsm/mod_gsm.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_gsm/mod_gsm.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_gsm/mod_gsm.c	Wed Jun 20 13:06:05 2007
@@ -153,24 +153,13 @@
 	/*.decode */ switch_gsm_decode,
 	/*.destroy */ switch_gsm_destroy,
 };
-static switch_codec_interface_t gsm_codec_interface = {
-	/*.interface_name */ "gsm",
-	/*.implementations */ &gsm_8k_implementation,
-};
-static switch_loadable_module_interface_t gsm_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ &gsm_codec_interface,
-	/*.application_interface */ NULL
-};
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_gsm_load)
 {
-
+	switch_codec_interface_t *codec_interface;
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &gsm_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_CODEC(codec_interface, "gsm", &gsm_8k_implementation);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_h26x/mod_h26x.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_h26x/mod_h26x.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_h26x/mod_h26x.c	Wed Jun 20 13:06:05 2007
@@ -117,25 +117,13 @@
 	/*.next = */&h264_90000_implementation
 };
 
-static switch_codec_interface_t h26x_codec_interface = {
-	/*.interface_name */ "h26x video (passthru)",
-	/*.implementations */ &h263_90000_implementation
-};
-
-static switch_loadable_module_interface_t h26x_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ &h26x_codec_interface,
-	/*.application_interface */ NULL,
-	/*.api_interface */ NULL,
-};
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_h26x_load)
 {
+	switch_codec_interface_t *codec_interface;
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &h26x_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_CODEC(codec_interface, "h26x video (passthru)", &h263_90000_implementation);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_ilbc/mod_ilbc.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_ilbc/mod_ilbc.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_ilbc/mod_ilbc.c	Wed Jun 20 13:06:05 2007
@@ -287,40 +287,14 @@
 	/*.destroy */ switch_ilbc_destroy
 };
 
-
-static switch_codec_interface_t ilbc_20ms_codec_interface = {
-	/*.interface_name */ "ilbc",
-	/*.implementations */ &ilbc_8k_20ms_nonext_implementation
-};
-
-static switch_codec_interface_t ilbc_102_codec_interface = {
-	/*.interface_name */ "ilbc",
-	/*.implementations */ &ilbc_102_8k_20ms_implementation,
-	/*.next */ &ilbc_20ms_codec_interface
-};
-
-static switch_codec_interface_t ilbc_codec_interface = {
-	/*.interface_name */ "ilbc",
-	/*.implementations */ &ilbc_8k_20ms_implementation,
-	/*.next */ &ilbc_102_codec_interface
-};
-
-
-static switch_loadable_module_interface_t ilbc_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ &ilbc_codec_interface,
-	/*.application_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_ilbc_load)
 {
-
+	switch_codec_interface_t *codec_interface;
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &ilbc_module_interface;
-
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_CODEC(codec_interface, "ilbc", &ilbc_8k_20ms_implementation);
+	SWITCH_ADD_CODEC(codec_interface, "ilbc", &ilbc_102_8k_20ms_implementation);
+	SWITCH_ADD_CODEC(codec_interface, "ilbc", &ilbc_8k_20ms_nonext_implementation);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_l16/mod_l16.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_l16/mod_l16.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_l16/mod_l16.c	Wed Jun 20 13:06:05 2007
@@ -406,28 +406,12 @@
 	/*.next */ &raw_8k_20ms_implementation
 };
 
-
-static switch_codec_interface_t raw_codec_interface = {
-	/*.interface_name */ "raw signed linear (16 bit)",
-	/*.implementations */ &raw_8k_10ms_implementation
-};
-
-static switch_loadable_module_interface_t raw_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ &raw_codec_interface,
-	/*.application_interface */ NULL,
-	/*.api_interface */ NULL,
-	///*.file_interface*/                   &raw_file_interface
-};
-
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_l16_load)
 {
+	switch_codec_interface_t *codec_interface;
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &raw_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_CODEC(codec_interface, "raw signed linear (16 bit)", &raw_8k_10ms_implementation);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/codecs/mod_speex/mod_speex.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/codecs/mod_speex/mod_speex.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/codecs/mod_speex/mod_speex.c	Wed Jun 20 13:06:05 2007
@@ -390,24 +390,12 @@
 	/*.next */ &speex_8k_30ms_implementation
 };
 
-static switch_codec_interface_t speex_codec_interface = {
-	/*.interface_name */ "speex",
-	/*.implementations */ &speex_8k_20ms_implementation
-};
-
-static switch_loadable_module_interface_t speex_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ &speex_codec_interface,
-	/*.application_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_speex_load)
 {
+	switch_codec_interface_t *codec_interface;
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &speex_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_CODEC(codec_interface, "speex", &speex_8k_20ms_implementation);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	Wed Jun 20 13:06:05 2007
@@ -83,7 +83,7 @@
 	switch_xml_free(xml);
 }
 
-static switch_caller_extension_t *directory_dialplan_hunt(switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile)
+SWITCH_STANDARD_DIALPLAN(directory_dialplan_hunt)
 {
 	switch_caller_extension_t *extension = NULL;
 	switch_channel_t *channel;
@@ -151,27 +151,14 @@
 }
 
 
-static switch_dialplan_interface_t directory_dialplan_interface = {
-	/*.interface_name = */ "directory",
-	/*.hunt_function = */ directory_dialplan_hunt
-		/*.next = NULL */
-};
-
-static switch_loadable_module_interface_t directory_dialplan_module_interface = {
-	/*.module_name = */ modname,
-	/*.endpoint_interface = */ NULL,
-	/*.timer_interface = */ NULL,
-	/*.dialplan_interface = */ &directory_dialplan_interface,
-	/*.codec_interface = */ NULL,
-	/*.application_interface = */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_directory_load)
 {
+	switch_dialplan_interface_t *dp_interface;
 
 	load_config();
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &directory_dialplan_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_DIALPLAN(dp_interface, "directory", directory_dialplan_hunt);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	Wed Jun 20 13:06:05 2007
@@ -292,7 +292,7 @@
 	return status;
 }
 
-static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile)
+SWITCH_STANDARD_DIALPLAN(dialplan_hunt)
 {
 	switch_caller_extension_t *extension = NULL;
 	switch_channel_t *channel;
@@ -377,27 +377,13 @@
 	return extension;
 }
 
-
-static switch_dialplan_interface_t dialplan_interface = {
-	/*.interface_name = */ "XML",
-	/*.hunt_function = */ dialplan_hunt
-		/*.next = NULL */
-};
-
-static switch_loadable_module_interface_t dialplan_module_interface = {
-	/*.module_name = */ modname,
-	/*.endpoint_interface = */ NULL,
-	/*.timer_interface = */ NULL,
-	/*.dialplan_interface = */ &dialplan_interface,
-	/*.codec_interface = */ NULL,
-	/*.application_interface = */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_xml_load)
 {
+	switch_dialplan_interface_t *dp_interface;
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &dialplan_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_DIALPLAN(dp_interface, "XML", dialplan_hunt);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/directories/mod_ldap/mod_ldap.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/directories/mod_ldap/mod_ldap.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/directories/mod_ldap/mod_ldap.c	Wed Jun 20 13:06:05 2007
@@ -198,33 +198,19 @@
 }
 
 
-static switch_directory_interface_t ldap_directory_interface = {
-	/*.interface_name */ "ldap",
-	/*.directory_open */ mod_ldap_open,
-	/*.directory_close */ mod_ldap_close,
-	/*.directory_query */ mod_ldap_query,
-	/*.directory_next */ mod_ldap_next,
-	/*.directory_next_pair */ mod_ldap_next_pair
-};
-
-
-static switch_loadable_module_interface_t ldap_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ NULL,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ &ldap_directory_interface
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_ldap_load)
 {
+	switch_directory_interface_t *dir_interface;
+
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &ldap_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	dir_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_DIRECTORY_INTERFACE);
+	dir_interface->interface_name = "ldap";
+	dir_interface->directory_open = mod_ldap_open;
+	dir_interface->directory_close = mod_ldap_close;
+	dir_interface->directory_query = mod_ldap_query;
+	dir_interface->directory_next = mod_ldap_next;
+	dir_interface->directory_next_pair = mod_ldap_next_pair;
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Wed Jun 20 13:06:05 2007
@@ -30,6 +30,7 @@
  *
  */
 #include <switch.h>
+#include <switch_stun.h>
 #include <libdingaling.h>
 #ifdef SWITCH_HAVE_ODBC
 #include <switch_odbc.h>
@@ -48,6 +49,7 @@
 SWITCH_MODULE_DEFINITION(mod_dingaling, mod_dingaling_load, mod_dingaling_shutdown, NULL);
 
 static switch_memory_pool_t *module_pool = NULL;
+static switch_endpoint_interface_t *channel_endpoint_interface;
 
 static char sub_sql[] =
 	"CREATE TABLE jabber_subscriptions (\n"
@@ -730,7 +732,7 @@
 					if (strlen(xmltxt) > 2) {
 						xml = switch_xml_parse_str(xmltxt, strlen(xmltxt));
 						form = switch_xml_toxml(xml);
-						switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, level, 
+						switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level,
 										  "%s:\n-------------------------------------------------------------------------------\n"
 										  "%s\n", ll, form);
 						switch_xml_free(xml);
@@ -739,7 +741,7 @@
 				}
 			}
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, level, "%s\n", data);
+			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level, "%s\n", data);
 		}
 	}
 	va_end(ap);
@@ -1590,65 +1592,6 @@
 	/*.receive_event */ channel_receive_event
 };
 
-static switch_endpoint_interface_t channel_endpoint_interface = {
-	/*.interface_name */ "dingaling",
-	/*.io_routines */ &channel_io_routines,
-	/*.event_handlers */ &channel_event_handlers,
-	/*.private */ NULL,
-	/*.next */ NULL
-};
-
-
-static switch_api_interface_t debug_api_interface = {
-	/*.interface_name */ "dl_debug",
-	/*.desc */ "DingaLing Debug",
-	/*.function */ dl_debug,
-	/*.syntax */ "dl_debug [true|false]",
-	/*.next */ NULL
-};
-
-static switch_api_interface_t pres_api_interface = {
-	/*.interface_name */ "dl_pres",
-	/*.desc */ "DingaLing Presence",
-	/*.function */ dl_pres,
-	/*.syntax */ "dl_pres <profile_name>",
-	/*.next */ &debug_api_interface
-};
-
-static switch_api_interface_t logout_api_interface = {
-	/*.interface_name */ "dl_logout",
-	/*.desc */ "DingaLing Logout",
-	/*.function */ dl_logout,
-	/*.syntax */ "dl_logout <profile_name>",
-	/*.next */ &pres_api_interface
-};
-
-static switch_api_interface_t login_api_interface = {
-	/*.interface_name */ "dl_login",
-	/*.desc */ "DingaLing Login",
-	/*.function */ dl_login,
-	/*.syntax */ "dl_login <profile_name>",
-	/*.next */ &logout_api_interface
-};
-
-static switch_chat_interface_t channel_chat_interface = {
-	/*.name */ MDL_CHAT_PROTO,
-	/*.chat_send */ chat_send,
-};
-
-static switch_loadable_module_interface_t channel_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ &channel_endpoint_interface,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ &login_api_interface,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL,
-	/*.chat_interface */ &channel_chat_interface
-};
 
 
 /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
@@ -1658,7 +1601,7 @@
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool)
 {
-	if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
+	if ((*new_session = switch_core_session_request(channel_endpoint_interface, pool)) != 0) {
 		struct private_object *tech_pvt;
 		switch_channel_t *channel;
 		switch_caller_profile_t *caller_profile = NULL;
@@ -1828,11 +1771,10 @@
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_dingaling_load)
 {
+	switch_chat_interface_t *chat_interface;
+	switch_api_interface_t *api_interface;
 
-	if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
-		return SWITCH_STATUS_TERM;
-	}
+	module_pool = pool;
 
 	load_config();
 
@@ -1873,7 +1815,22 @@
 	}
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &channel_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	channel_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
+	channel_endpoint_interface->interface_name = modname;
+	channel_endpoint_interface->io_routines = &channel_io_routines;
+	channel_endpoint_interface->state_handler = &channel_event_handlers;
+
+#define PRES_SYNTAX "dl_pres <profile_name>"
+#define LOGOUT_SYNTAX "dl_logout <profile_name>"
+#define LOGIN_SYNTAX "dl_login <profile_name>"
+#define DEBUG_SYNTAX "dl_debug [true|false]"
+
+	SWITCH_ADD_API(api_interface, "dl_debug", "DingaLing Debug", dl_debug, DEBUG_SYNTAX);
+	SWITCH_ADD_API(api_interface, "dl_pres", "DingaLing Presence", dl_pres, PRES_SYNTAX);
+	SWITCH_ADD_API(api_interface, "dl_logout", "DingaLing Logout", dl_logout, LOGOUT_SYNTAX);
+	SWITCH_ADD_API(api_interface, "dl_login", "DingaLing Login", dl_login, LOGIN_SYNTAX);
+	SWITCH_ADD_CHAT(chat_interface, MDL_CHAT_PROTO, chat_send);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
@@ -2059,7 +2016,7 @@
 	}
 
 	if (!cmd) {
-		stream->write_function(stream, "USAGE: %s\n", pres_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", PRES_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -2086,7 +2043,7 @@
 	}
 
 	if (!cmd) {
-		stream->write_function(stream, "USAGE: %s\n", logout_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", LOGOUT_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -2113,7 +2070,7 @@
 	}
 
 	if (switch_strlen_zero(cmd)) {
-		stream->write_function(stream, "USAGE: %s\n", login_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -2122,7 +2079,7 @@
 	argc = switch_separate_string(myarg, ';', argv, (sizeof(argv) / sizeof(argv[0])));
 
 	if (switch_strlen_zero(cmd) || argc != 1) {
-		stream->write_function(stream, "USAGE: %s\n", login_api_interface.syntax);
+		stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -2603,7 +2560,7 @@
 			status = LDL_STATUS_FALSE;
 			goto done;
 		}
-		if ((session = switch_core_session_request(&channel_endpoint_interface, NULL)) != 0) {
+		if ((session = switch_core_session_request(channel_endpoint_interface, NULL)) != 0) {
 			switch_core_session_add_stream(session, NULL);
 
 			

Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_portaudio/mod_portaudio.c	Wed Jun 20 13:06:05 2007
@@ -44,7 +44,7 @@
 SWITCH_MODULE_DEFINITION(mod_portaudio, mod_portaudio_load, mod_portaudio_shutdown, NULL);
 
 static switch_memory_pool_t *module_pool = NULL;
-//static int running = 1;
+static switch_endpoint_interface_t *channel_endpoint_interface;
 
 #define SAMPLE_TYPE  paInt16
 //#define SAMPLE_TYPE  paFloat32
@@ -158,8 +158,6 @@
 	 static int get_dev_by_name(char *name, int in);
 	 static int get_dev_by_number(int number, int in);
 	 static switch_status_t pa_cmd(const char *dest, switch_core_session_t *session, switch_stream_handle_t *stream);
-	 static switch_status_t padep(const char *dest, switch_core_session_t *session, switch_stream_handle_t *stream);
-
 
 /* 
    State methods they get called when the state changes to the specific state 
@@ -734,54 +732,6 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_api_interface_t send_dtmf_interface = {
-	/*.interface_name */ "padtmf",
-	/*.desc */ "DEPRICATED (see 'pa')",
-	/*.function */ padep,
-	/*.syntax */ "DEPRICATED (see 'pa')",
-	/*.next */ NULL
-};
-
-static switch_api_interface_t answer_call_interface = {
-	/*.interface_name */ "paoffhook",
-	/*.desc */ "DEPRICATED (see 'pa')",
-	/*.function */ padep,
-	/*.syntax */ "DEPRICATED (see 'pa')",
-	/*.next */ &send_dtmf_interface
-};
-
-static switch_api_interface_t channel_info_interface = {
-	/*.interface_name */ "painfo",
-	/*.desc */ "DEPRICATED (see 'pa')",
-	/*.function */ padep,
-	/*.syntax */ "DEPRICATED (see 'pa')",
-	/*.next */ &answer_call_interface
-};
-
-static switch_api_interface_t channel_hup_interface = {
-	/*.interface_name */ "pahup",
-	/*.desc */ "DEPRICATED (see 'pa')",
-	/*.function */ padep,
-	/*.syntax */ "DEPRICATED (see 'pa')",
-	/*.next */ &channel_info_interface
-};
-
-static switch_api_interface_t channel_call_interface = {
-	/*.interface_name */ "pacall",
-	/*.desc */ "DEPRICATED (see 'pa')",
-	/*.function */ padep,
-	/*.syntax */ "DEPRICATED (see 'pa')",
-	/*.next */ &channel_hup_interface
-};
-
-static switch_api_interface_t channel_api_interface = {
-	/*.interface_name */ "pa",
-	/*.desc */ "PortAudio",
-	/*.function */ pa_cmd,
-	/*.syntax */ "<command> [<args>]",
-	/*.next */ &channel_call_interface
-};
-
 static switch_state_handler_table_t channel_event_handlers = {
 	/*.on_init */ channel_on_init,
 	/*.on_ring */ channel_on_ring,
@@ -802,24 +752,6 @@
 	/*.receive_message */ channel_receive_message
 };
 
-static switch_endpoint_interface_t channel_endpoint_interface = {
-	/*.interface_name */ "portaudio",
-	/*.io_routines */ &channel_io_routines,
-	/*.event_handlers */ &channel_event_handlers,
-	/*.private */ NULL,
-	/*.next */ NULL
-};
-
-static switch_loadable_module_interface_t channel_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ &channel_endpoint_interface,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ &channel_api_interface
-};
-
 /* 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!
 */
@@ -828,7 +760,7 @@
 													switch_core_session_t **new_session, switch_memory_pool_t **pool)
 {
 
-	if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
+	if ((*new_session = switch_core_session_request(channel_endpoint_interface, pool)) != 0) {
 		private_t *tech_pvt;
 		switch_channel_t *channel;
 		switch_caller_profile_t *caller_profile;
@@ -876,13 +808,10 @@
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load)
 {
-
 	switch_status_t status;
+	switch_api_interface_t *api_interface;
 
-	if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
-		return SWITCH_STATUS_TERM;
-	}
+	module_pool = pool;
 
 	Pa_Initialize();
 
@@ -921,7 +850,13 @@
 	switch_set_flag((&globals.cng_frame), SFF_CNG);
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &channel_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	channel_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
+	channel_endpoint_interface->interface_name = modname;
+	channel_endpoint_interface->io_routines = &channel_io_routines;
+	channel_endpoint_interface->state_handler = &channel_event_handlers;
+
+	SWITCH_ADD_API(api_interface, "pa", "PortAudio", pa_cmd, "<command> [<args>]");
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
@@ -1639,7 +1574,7 @@
 	}
 	dest = argv[0];
 
-	if ((session = switch_core_session_request(&channel_endpoint_interface, NULL)) != 0) {
+	if ((session = switch_core_session_request(channel_endpoint_interface, NULL)) != 0) {
 		private_t *tech_pvt;
 		switch_channel_t *channel;
 		char *dialplan = globals.dialplan;
@@ -1713,12 +1648,6 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_STANDARD_API(padep)
-{
-	stream->write_function(stream, "This command no longer exists (try 'pa help')\n");
-	return SWITCH_STATUS_SUCCESS;
-}
-
 SWITCH_STANDARD_API(pa_cmd)
 {
 	char *argv[1024] = { 0 };

Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.c	Wed Jun 20 13:06:05 2007
@@ -43,7 +43,7 @@
 SWITCH_MODULE_DEFINITION(mod_sofia, mod_sofia_load, mod_sofia_shutdown, NULL);
 
 struct mod_sofia_globals mod_sofia_globals;
-switch_endpoint_interface_t sofia_endpoint_interface;
+switch_endpoint_interface_t *sofia_endpoint_interface;
 static switch_frame_t silence_frame = { 0 };
 static char silence_data[13] = "";
 
@@ -1288,56 +1288,11 @@
 	/*.on_transmit */ sofia_on_transmit
 };
 
-switch_endpoint_interface_t sofia_endpoint_interface = {
-	/*.interface_name */ "sofia",
-	/*.io_routines */ &sofia_io_routines,
-	/*.event_handlers */ &sofia_event_handlers,
-	/*.private */ NULL,
-	/*.next */ NULL
-};
-
-static switch_chat_interface_t sofia_chat_interface = {
-	/*.name */ SOFIA_CHAT_PROTO,
-	/*.sofia_presence_chat_send */ sofia_presence_chat_send,
-
-};
-
 static switch_status_t sofia_manage(char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen)
 {
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_management_interface_t sofia_management_interface = {
-	/*.relative_oid */ "1",
-	/*.management_function */ sofia_manage
-};
-
-static switch_api_interface_t sofia_api_interface = {
-	/*.interface_name */ "sofia",
-	/*.desc */ "Sofia Controls",
-	/*.function */ sofia_function,
-	/*.syntax */ "<cmd> <args>",
-	/*.next */ NULL
-};
-
-static switch_loadable_module_interface_t sofia_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ &sofia_endpoint_interface,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ &sofia_api_interface,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL,
-	/*.chat_interface */ &sofia_chat_interface,
-	/*.say_interface */ NULL,
-	/*.asr_interface */ NULL,
-	/*.management_interface */ &sofia_management_interface
-};
-
-
 
 static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session,
 												  switch_caller_profile_t *outbound_profile, switch_core_session_t **new_session,
@@ -1354,7 +1309,7 @@
 
 	*new_session = NULL;
 
-	if (!(nsession = switch_core_session_request(&sofia_endpoint_interface, pool))) {
+	if (!(nsession = switch_core_session_request(sofia_endpoint_interface, pool))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n");
 		goto done;
 	}
@@ -1503,6 +1458,9 @@
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
 {
+	switch_chat_interface_t *chat_interface;
+	switch_api_interface_t *api_interface;
+	switch_management_interface_t *management_interface;
 
 	silence_frame.data = silence_data;
 	silence_frame.datalen = sizeof(silence_data);
@@ -1510,10 +1468,7 @@
 	silence_frame.flags = SFF_CNG;
 
 
-	if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
-		return SWITCH_STATUS_TERM;
-	}
+	module_pool = pool;
 
 	memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals));
 	switch_mutex_init(&mod_sofia_globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
@@ -1536,43 +1491,54 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for profiles to start\n");
 	switch_yield(1500000);
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind(modname, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_TERM;
 	}
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
+	if (switch_event_bind(modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
 		!= SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
+	if (switch_event_bind(modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
 		!= SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
+	if (switch_event_bind(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
 		!= SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_ROSTER, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
+	if (switch_event_bind(modname, SWITCH_EVENT_ROSTER, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
 		!= SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_MESSAGE_WAITING, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_mwi_event_handler, NULL)
+	if (switch_event_bind(modname, SWITCH_EVENT_MESSAGE_WAITING, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_mwi_event_handler, NULL)
 		!= SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &sofia_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	sofia_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
+	sofia_endpoint_interface->interface_name = modname;
+	sofia_endpoint_interface->io_routines = &sofia_io_routines;
+	sofia_endpoint_interface->state_handler = &sofia_event_handlers;
+
+	management_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_MANAGEMENT_INTERFACE);
+	management_interface->relative_oid = "1";
+	management_interface->management_function = sofia_manage;
+
+	SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, "<cmd> <args>");
+	SWITCH_ADD_CHAT(chat_interface, SOFIA_CHAT_PROTO, sofia_presence_chat_send);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/mod_sofia.h	Wed Jun 20 13:06:05 2007
@@ -465,7 +465,7 @@
 void sofia_glue_do_xfer_invite(switch_core_session_t *session);
 uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, 
 								  sofia_regtype_t regtype, char *key, uint32_t keylen, switch_event_t **v_event);
-extern switch_endpoint_interface_t sofia_endpoint_interface;
+extern switch_endpoint_interface_t *sofia_endpoint_interface;
 void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip);
 switch_status_t sofia_on_hangup(switch_core_session_t *session);
 char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup);

Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia.c	Wed Jun 20 13:06:05 2007
@@ -1771,7 +1771,7 @@
 		is_auth++;
 	}
 	
-	if (!(session = switch_core_session_request(&sofia_endpoint_interface, NULL))) {
+	if (!(session = switch_core_session_request(sofia_endpoint_interface, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Session Alloc Failed!\n");
 		nua_respond(nh, SIP_503_SERVICE_UNAVAILABLE, TAG_END());
 		return;

Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_glue.c	Wed Jun 20 13:06:05 2007
@@ -33,6 +33,7 @@
  *
  */
 #include "mod_sofia.h"
+#include <switch_stun.h>
 
 switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt);
 switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force);

Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_sofia/sofia_reg.c	Wed Jun 20 13:06:05 2007
@@ -904,7 +904,7 @@
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);
 	if ((gateway = (sofia_gateway_t *) switch_core_hash_find(mod_sofia_globals.gateway_hash, key))) {
 		if (switch_thread_rwlock_tryrdlock(gateway->profile->rwlock) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "Profile %s is locked\n", gateway->profile->name);
+			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is locked\n", gateway->profile->name);
 			gateway = NULL;
 		}
 	}

Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	Wed Jun 20 13:06:05 2007
@@ -222,7 +222,7 @@
 
 	va_start(ap, fmt);
 	if ((ret = switch_vasprintf(&data, fmt, ap)) != -1) {
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, level, "%s", data);
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level, "%s", data);
 	}
 	va_end(ap);
 }

Modified: freeswitch/branches/greenlizard/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/endpoints/mod_woomera/mod_woomera.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/endpoints/mod_woomera/mod_woomera.c	Wed Jun 20 13:06:05 2007
@@ -54,6 +54,7 @@
 SWITCH_MODULE_DEFINITION(mod_woomera, mod_woomera_load, mod_woomera_shutdown, mod_woomera_runtime);
 
 static switch_memory_pool_t *module_pool = NULL;
+static switch_endpoint_interface_t *woomera_endpoint_interface;
 
 #define STRLEN 15
 #define FRAME_LEN 480
@@ -459,24 +460,6 @@
 	/*.waitfor_write */ woomera_waitfor_write
 };
 
-static switch_endpoint_interface_t woomera_endpoint_interface = {
-	/*.interface_name */ "woomera",
-	/*.io_routines */ &woomera_io_routines,
-	/*.event_handlers */ &woomera_event_handlers,
-	/*.private */ NULL,
-	/*.next */ NULL
-};
-
-static switch_loadable_module_interface_t woomera_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ &woomera_endpoint_interface,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL
-};
-
-
 /* 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!
 */
@@ -484,7 +467,7 @@
 													switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool)
 {
-	if ((*new_session = switch_core_session_request(&woomera_endpoint_interface, pool)) != 0) {
+	if ((*new_session = switch_core_session_request(woomera_endpoint_interface, pool)) != 0) {
 		struct private_object *tech_pvt;
 		switch_channel_t *channel;
 
@@ -1226,7 +1209,7 @@
 				}
 
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New Inbound Channel %s!\n", name);
-				if ((session = switch_core_session_request(&woomera_endpoint_interface, NULL)) != 0) {
+				if ((session = switch_core_session_request(woomera_endpoint_interface, NULL)) != 0) {
 					struct private_object *tech_pvt;
 					switch_channel_t *channel;
 
@@ -1294,9 +1277,9 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_woomera_load)
 {
-
 	struct woomera_profile *profile = &default_profile;
 	char *cf = "woomera.conf";
 	switch_xml_t cfg, xml, settings, param, xmlp;
@@ -1360,27 +1343,19 @@
 
 	switch_xml_free(xml);
 
-
-	if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
-		//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
-
-		if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
-			//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
-			return SWITCH_STATUS_MEMERR;
-		}
-		return SWITCH_STATUS_MEMERR;
-	}
-
-
+	module_pool = pool;
 
 	if (switch_mutex_init(&default_profile.iolock, SWITCH_MUTEX_NESTED, module_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no lock\n");
 		return SWITCH_STATUS_TERM;
 	}
 
-
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &woomera_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	woomera_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
+	woomera_endpoint_interface->interface_name = modname;
+	woomera_endpoint_interface->io_routines = &woomera_io_routines;
+	woomera_endpoint_interface->state_handler = &woomera_event_handlers;
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/event_handlers/mod_cdr/mod_cdr.cpp
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/event_handlers/mod_cdr/mod_cdr.cpp	(original)
+++ freeswitch/branches/greenlizard/src/mod/event_handlers/mod_cdr/mod_cdr.cpp	Wed Jun 20 13:06:05 2007
@@ -68,56 +68,6 @@
 	/*.on_transmit */ NULL
 };
 
-static switch_api_interface_t modcdr_show_available_api = {
-	/*.interface_name */ "modcdr_show_available",
-	/*.desc */ "Displays the currently compiled-in mod_cdr backend loggers.",
-	/*.function */ modcdr_show_available,
-	/*.syntax */ "modcdr_queue_show_available",
-	/*.next */ 0
-};
-
-static switch_api_interface_t modcdr_show_active_api = {
-	/*.interface_name */ "modcdr_show_active",
-	/*.desc */ "Displays the currently active mod_cdr backend loggers.",
-	/*.function */ modcdr_show_active,
-	/*.syntax */ "modcdr_queue_show_active",
-	/*.next */ &modcdr_show_available_api
-};
-
-static switch_api_interface_t modcdr_queue_resume_api = {
-	/*.interface_name */ "modcdr_queue_resume",
-	/*.desc */ "Manually resumes the popping of objects from the queue.",
-	/*.function */ modcdr_queue_resume,
-	/*.syntax */ "modcdr_queue_resume",
-	/*.next */ &modcdr_show_active_api
-};
-
-static switch_api_interface_t modcdr_queue_pause_api = {
-	/*.interface_name */ "modcdr_queue_pause",
-	/*.desc */ "Manually pauses the popping of objects from the queue. (DANGER: Can suck your memory away rather quickly.)",
-	/*.function */ modcdr_queue_pause,
-	/*.syntax */ "modcdr_queue_pause",
-	/*.next */ &modcdr_queue_resume_api
-};
-
-static switch_api_interface_t modcdr_reload_interface_api = {
-	/*.interface_name */ "modcdr_reload",
-	/*.desc */ "Reload mod_cdr's configuration",
-	/*.function */ modcdr_reload,
-	/*.syntax */ "modcdr_reload",
-	/*.next */ &modcdr_queue_pause_api
-};
-
-static switch_loadable_module_interface_t cdr_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/* api_interface */ &modcdr_reload_interface_api
-};
-
 static switch_status_t my_on_hangup(switch_core_session_t *session)
 {
 	switch_thread_rwlock_rdlock(cdr_rwlock);
@@ -126,18 +76,25 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define AVAIL_DESCR "Displays the currently compiled-in mod_cdr backend loggers."
+#define ACTIVE_DESCR "Displays the currently active mod_cdr backend loggers."
+#define RESUME_DESCR "Manually resumes the popping of objects from the queue."
+#define PAUSE_DESCR "Manually pauses the popping of objects from the queue. (DANGER: Can suck your memory away rather quickly.)"
 SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_load)
 {
+	switch_api_interface_t *api_interface;
+
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &cdr_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_API(api_interface, "modcdr_reload", "Reload mod_cdr's configuration", modcdr_reload, "");
+	SWITCH_ADD_API(api_interface, "modcdr_queue_pause", PAUSE_DESCR, modcdr_queue_pause, "");
+	SWITCH_ADD_API(api_interface, "modcdr_queue_resume", RESUME_DESCR, modcdr_queue_resume, "");
+	SWITCH_ADD_API(api_interface, "modcdr_show_active", ACTIVE_DESCR, modcdr_show_active, "");
+	SWITCH_ADD_API(api_interface, "modcdr_show_available", AVAIL_DESCR, modcdr_show_available, "");
 	
 	switch_core_add_state_handler(&state_handlers);
 	
-	if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) 
-	{
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH - Can't swim, no pool\n");
-		return SWITCH_STATUS_TERM;
-	}
+	module_pool = pool;
 
 	switch_thread_rwlock_create(&cdr_rwlock,module_pool);
 	newcdrcontainer = new CDRContainer(module_pool);  // Instantiates the new object, automatically loads config

Modified: freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	Wed Jun 20 13:06:05 2007
@@ -176,25 +176,12 @@
 }
 
 
-static switch_loadable_module_interface_t event_test_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL
-};
-
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load)
 {
 
 	memset(&globals, 0, sizeof(globals));
 
-	if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
-		return SWITCH_STATUS_TERM;
-	}
+	module_pool = pool;
 
 	switch_core_hash_init(&globals.event_hash, module_pool);
 
@@ -231,10 +218,8 @@
 		return SWITCH_STATUS_TERM;
 	}
 
-
-
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &event_test_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 
 	if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {

Modified: freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	Wed Jun 20 13:06:05 2007
@@ -161,7 +161,7 @@
 	switch_mutex_unlock(listen_list.mutex);
 }
 
-static void socket_function(switch_core_session_t *session, char *data)
+SWITCH_STANDARD_APP(socket_function)
 {
 	char *host, *port_name;
 	switch_socket_t *new_sock;
@@ -251,28 +251,6 @@
 }
 
 
-static switch_application_interface_t socket_application_interface = {
-	/*.interface_name */ "socket",
-	/*.application_function */ socket_function,
-	/* long_desc */ "Connect to a socket",
-	/* short_desc */ "Connect to a socket",
-	/* syntax */ "<ip>[:<port>]",
-	/* flags */ SAF_SUPPORT_NOMEDIA,
-	/*.next */ NULL
-};
-
-
-
-static switch_loadable_module_interface_t event_socket_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ &socket_application_interface
-};
-
-
 static void close_socket(switch_socket_t ** sock)
 {
 	switch_mutex_lock(listen_list.sock_mutex);
@@ -303,11 +281,13 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_event_socket_load)
 {
+	switch_application_interface_t *app_interface;
+
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &event_socket_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_APP(app_interface, "socket", "Connect to a socket", "Connect to a socket", socket_function, "<ip>[:<port>]", SAF_SUPPORT_NOMEDIA);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_test/mod_event_test.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_test/mod_event_test.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/event_handlers/mod_event_test/mod_event_test.c	Wed Jun 20 13:06:05 2007
@@ -71,20 +71,8 @@
 	}
 }
 
-
-
-static switch_loadable_module_interface_t event_test_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL
-};
-
 #define MY_EVENT_COOL "test::cool"
 
-
 #ifdef TORTURE_ME
 #define TTHREADS 500
 static int THREADS = 0;
@@ -128,14 +116,14 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_event_test_load)
 {
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &event_test_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	if (switch_event_reserve_subclass(MY_EVENT_COOL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind(modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}

Modified: freeswitch/branches/greenlizard/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	Wed Jun 20 13:06:05 2007
@@ -37,7 +37,8 @@
 #include <freeradius-client.h>
 #include "mod_radius_cdr.h"
 
-static const char modname[] = "mod_radius_cdr";
+SWITCH_MODULE_LOAD_FUNCTION(mod_radius_cdr_load);
+SWITCH_MODULE_DEFINITION(mod_radius_cdr, mod_radius_cdr_load, NULL, NULL);
 
 static char		cf[] = "mod_radius_cdr.conf";
 static char		my_dictionary[PATH_MAX];
@@ -466,17 +467,7 @@
 	/*.on_transmit */ NULL
 };
 
-
-static const switch_loadable_module_interface_t mod_radius_cdr_module_interface = {
-	/*.module_name = */ modname,
-	/*.endpoint_interface = */ NULL,
-	/*.timer_interface = */ NULL,
-	/*.dialplan_interface = */ NULL,
-	/*.codec_interface = */ NULL,
-	/*.application_interface */ NULL
-};
-
-SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
+SWITCH_MODULE_LOAD_FUNCTION(mod_radius_cdr_load)
 {
 	if (load_config() != SWITCH_STATUS_SUCCESS) {
                 return SWITCH_STATUS_TERM;
@@ -485,7 +476,7 @@
 	/* test global state handlers */
 	switch_core_add_state_handler(&state_handlers);
 
-	*module_interface = &mod_radius_cdr_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c	Wed Jun 20 13:06:05 2007
@@ -391,19 +391,10 @@
 
 }
 
-static switch_loadable_module_interface_t xmpp_event_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_xmpp_event_load)
 {
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &xmpp_event_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	if (load_config() != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_FALSE;

Modified: freeswitch/branches/greenlizard/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c	Wed Jun 20 13:06:05 2007
@@ -237,16 +237,6 @@
 
 }
 
-
-static switch_loadable_module_interface_t zeroconf_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL
-};
-
 #define MY_EVENT_PUBLISH "zeroconf::broadcast"
 #define MY_EVENT_UNPUBLISH "zeroconf::unbroadcast"
 
@@ -266,10 +256,7 @@
 
 	memset(&globals, 0, sizeof(globals));
 
-	if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
-		return SWITCH_STATUS_TERM;
-	}
+	module_pool = pool;
 
 	switch_mutex_init(&globals.zc_lock, SWITCH_MUTEX_NESTED, module_pool);
 
@@ -293,7 +280,7 @@
 	}
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &zeroconf_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/formats/mod_native_file/mod_native_file.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/formats/mod_native_file/mod_native_file.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/formats/mod_native_file/mod_native_file.c	Wed Jun 20 13:06:05 2007
@@ -138,34 +138,10 @@
 
 static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
 
-static switch_file_interface_t native_file_file_interface = {
-	/*.interface_name */ modname,
-	/*.file_open */ native_file_file_open,
-	/*.file_close */ native_file_file_close,
-	/*.file_read */ native_file_file_read,
-	/*.file_write */ native_file_file_write,
-	/*.file_seek */ native_file_file_seek,
-	/*.file_set_string */ native_file_file_set_string,
-	/*.file_get_string */ native_file_file_get_string,
-	/*.extens */ NULL,
-	/*.next */ NULL,
-};
-
-static switch_loadable_module_interface_t native_file_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ NULL,
-	/*.file_interface */ &native_file_file_interface
-};
-
-
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_native_file_load)
 {
+	switch_file_interface_t *file_interface;
 
 	const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
 	uint32_t num_codecs = switch_loadable_module_get_codecs(NULL, codecs, sizeof(codecs) / sizeof(codecs[0]));
@@ -175,9 +151,17 @@
 		supported_formats[x] = codecs[x]->iananame;
 	}
 
-	/* connect my internal structure to the blank pointer passed to me */
-	native_file_file_interface.extens = supported_formats;
-	*module_interface = &native_file_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
+	file_interface->interface_name = modname;
+	file_interface->extens = supported_formats;
+	file_interface->file_open = native_file_file_open;
+	file_interface->file_close = native_file_file_close;
+	file_interface->file_read = native_file_file_read;
+	file_interface->file_write = native_file_file_write;
+	file_interface->file_seek = native_file_file_seek;
+	file_interface->file_set_string = native_file_file_set_string;
+	file_interface->file_get_string = native_file_file_get_string;
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/formats/mod_sndfile/mod_sndfile.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/formats/mod_sndfile/mod_sndfile.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/formats/mod_sndfile/mod_sndfile.c	Wed Jun 20 13:06:05 2007
@@ -253,30 +253,6 @@
 
 static char **supported_formats;
 
-static switch_file_interface_t sndfile_file_interface = {
-	/*.interface_name */ modname,
-	/*.file_open */ sndfile_file_open,
-	/*.file_close */ sndfile_file_close,
-	/*.file_read */ sndfile_file_read,
-	/*.file_write */ sndfile_file_write,
-	/*.file_seek */ sndfile_file_seek,
-	/*.file_set_string */ sndfile_file_set_string,
-	/*.file_get_string */ sndfile_file_get_string,
-	/*.extens */ NULL,
-	/*.next */ NULL,
-};
-
-static switch_loadable_module_interface_t sndfile_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ NULL,
-	/*.file_interface */ &sndfile_file_interface
-};
-
 static switch_status_t setup_formats(void)
 {
 	SF_FORMAT_INFO info;
@@ -364,6 +340,7 @@
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load)
 {
+	switch_file_interface_t *file_interface;
 
 	if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
@@ -377,8 +354,17 @@
 	}
 
 	/* connect my internal structure to the blank pointer passed to me */
-	sndfile_file_interface.extens = supported_formats;
-	*module_interface = &sndfile_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
+	file_interface->interface_name = modname;
+	file_interface->extens = supported_formats;
+	file_interface->file_open = sndfile_file_open;
+	file_interface->file_close = sndfile_file_close;
+	file_interface->file_read = sndfile_file_read;
+	file_interface->file_write = sndfile_file_write;
+	file_interface->file_seek = sndfile_file_seek;
+	file_interface->file_set_string = sndfile_file_set_string;
+	file_interface->file_get_string = sndfile_file_get_string;
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/languages/mod_perl/mod_perl.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/languages/mod_perl/mod_perl.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/languages/mod_perl/mod_perl.c	Wed Jun 20 13:06:05 2007
@@ -79,29 +79,6 @@
 	destroy_perl(&my_perl);
 }
 
-static switch_application_interface_t perl_application_interface = {
-	/*.interface_name */ "perl",
-	/*.application_function */ perl_function,
-	NULL, NULL, NULL,
-	/* flags */ SAF_NONE,
-	/* should we support no media mode here?  If so, we need to detect the mode, and either disable the media functions or indicate media if/when we need */
-	/*.next */ NULL
-};
-
-static switch_loadable_module_interface_t perl_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ &perl_application_interface,
-	/*.api_interface */ NULL,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL
-};
-
-
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_perl_shutdown)
 {
 	if (globals.my_perl) {
@@ -115,7 +92,7 @@
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_perl_load)
 {
-
+	switch_application_interface_t *app_interface;
 	PerlInterpreter *my_perl;
 	char code[1024];
 
@@ -135,7 +112,8 @@
 
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &perl_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_APP(app_interface, "perl", NULL, NULL, perl_function, NULL, SAF_NONE);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Wed Jun 20 13:06:05 2007
@@ -629,7 +629,7 @@
 		message = "(N/A)";
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_ID_LOG, filename, modname, line, SWITCH_LOG_ERROR, "%s %s%s\n", ex, message, text);
+	switch_log_printf(SWITCH_CHANNEL_ID_LOG, filename, modname, line, NULL, SWITCH_LOG_ERROR, "%s %s%s\n", ex, message, text);
 
 }
 
@@ -2588,12 +2588,12 @@
 		}
 
 		if ((msg = JS_GetStringBytes(JS_ValueToString(cx, argv[1])))) {
-			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "console_log", line, level, "%s", msg);
+			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "console_log", line, NULL, level, "%s", msg);
 			return JS_TRUE;
 		}
 	} else if (argc > 0) {
 		if ((msg = JS_GetStringBytes(JS_ValueToString(cx, argv[0])))) {
-			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "console_log", line, level, "%s", msg);
+			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "console_log", line, NULL, level, "%s", msg);
 			return JS_TRUE;
 		}
 	}
@@ -2914,7 +2914,6 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
 SWITCH_STANDARD_API(launch_async)
 {
 
@@ -2928,48 +2927,6 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
-static switch_application_interface_t ivrtest_application_interface = {
-	/*.interface_name */ "javascript",
-	/*.application_function */ js_dp_function,
-	/* long_desc */ "Run a javascript ivr on a channel",
-	/* short_desc */ "Launch JS ivr.",
-	/* syntax */ "<script> [additional_vars [...]]",
-	/* flags */ SAF_NONE,
-	/* should we support no media mode here?  If so, we need to detect the mode, and either disable the media functions or indicate media if/when we need */
-	/*.next */ NULL
-};
-
-
-static switch_api_interface_t jsapi_interface = {
-	/*.interface_name */ "jsapi",
-	/*.desc */ "execute an api call",
-	/*.function */ jsapi_function,
-	/*.syntax */ "jsapi <script> [additional_vars [...]]",
-	/*.next */ NULL
-};
-
-static switch_api_interface_t js_run_interface = {
-	/*.interface_name */ "jsrun",
-	/*.desc */ "run a script",
-	/*.function */ launch_async,
-	/*.syntax */ "jsrun <script> [additional_vars [...]]",
-	/*.next */ &jsapi_interface
-};
-
-static switch_loadable_module_interface_t spidermonkey_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ &ivrtest_application_interface,
-	/*.api_interface */ &js_run_interface,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL
-};
-
 static void  message_query_handler(switch_event_t *event)
 {
 	char *account = switch_event_get_header(event, "message-account");
@@ -2994,6 +2951,8 @@
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_spidermonkey_load)
 {
+	switch_api_interface_t *api_interface;
+	switch_application_interface_t *app_interface;
 	switch_status_t status;
 
 	if ((status = init_js()) != SWITCH_STATUS_SUCCESS) {
@@ -3007,7 +2966,10 @@
 	}
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &spidermonkey_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_API(api_interface, "jsrun", "run a script", launch_async, "jsrun <script> [additional_vars [...]]");
+	SWITCH_ADD_API(api_interface, "jsapi", "execute an api call", jsapi_function, "jsapi <script> [additional_vars [...]]");
+	SWITCH_ADD_APP(app_interface, "javascript", "Launch JS ivr", "Run a javascript ivr on a channel", js_dp_function, "<script> [additional_vars [...]]", SAF_NONE);
 
 	curl_global_init(CURL_GLOBAL_ALL);
 

Modified: freeswitch/branches/greenlizard/src/mod/loggers/mod_console/mod_console.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/loggers/mod_console/mod_console.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/loggers/mod_console/mod_console.c	Wed Jun 20 13:06:05 2007
@@ -56,19 +56,6 @@
 };
 #endif
 
-static switch_loadable_module_interface_t console_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ NULL,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL
-};
-
 static switch_memory_pool_t *module_pool = NULL;
 static switch_hash_t *log_hash = NULL;
 static switch_hash_t *name_hash = NULL;
@@ -192,14 +179,10 @@
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_console_load)
 {
-	if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
-		return SWITCH_STATUS_TERM;
-	}
-
+	module_pool = pool;
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &console_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	/* setup my logger function */
 	switch_log_bind_logger(switch_console_logger, SWITCH_LOG_DEBUG);

Modified: freeswitch/branches/greenlizard/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/say/mod_say_en/mod_say_en.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/say/mod_say_en/mod_say_en.c	Wed Jun 20 13:06:05 2007
@@ -510,37 +510,18 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-static switch_say_interface_t es_say_interface = {
-	/*.name */ "es",
-	/*.say_function */ en_say,
-};
-
-static switch_say_interface_t en_say_interface = {
-	/*.name */ "en",
-	/*.say_function */ en_say,
-	/*.next */ &es_say_interface
-};
-
-static switch_loadable_module_interface_t say_en_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ NULL,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL,
-	/*.chat_interface */ NULL,
-	/*.say_inteface */ &en_say_interface,
-	/*.asr_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_say_en_load)
 {
+	switch_say_interface_t *say_interface;
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &say_en_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE);
+	say_interface->interface_name = "en";
+	say_interface->say_function = en_say;
+	say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE);
+	say_interface->interface_name = "es";
+	say_interface->say_function = en_say;
+
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c	Wed Jun 20 13:06:05 2007
@@ -186,31 +186,20 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_timer_interface_t timer_interface = {
-	/*.interface_name */ "soft",
-	/*.timer_init */ timer_init,
-	/*.timer_next */ timer_next,
-	/*.timer_step */ timer_step,
-	/*.timer_check */ timer_check,
-	/*.timer_destroy */ timer_destroy
-};
-
-static switch_loadable_module_interface_t softtimer_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ &timer_interface
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_softtimer_load)
 {
-
-	if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
-		return SWITCH_STATUS_MEMERR;
-	}
+	switch_timer_interface_t *timer_interface;
+	module_pool = pool;
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &softtimer_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	timer_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_TIMER_INTERFACE);
+	timer_interface->interface_name = "soft";
+	timer_interface->timer_init = timer_init;
+	timer_interface->timer_next = timer_next;
+	timer_interface->timer_step = timer_step;
+	timer_interface->timer_check = timer_check;
+	timer_interface->timer_destroy = timer_destroy;
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	Wed Jun 20 13:06:05 2007
@@ -91,22 +91,12 @@
 	/*.on_transmit */ NULL
 };
 
-
-static switch_loadable_module_interface_t xml_cdr_module_interface = {
-	/*.module_name = */ modname,
-	/*.endpoint_interface = */ NULL,
-	/*.timer_interface = */ NULL,
-	/*.dialplan_interface = */ NULL,
-	/*.codec_interface = */ NULL,
-	/*.application_interface */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
 {
 	/* test global state handlers */
 	switch_core_add_state_handler(&state_handlers);
 
-	*module_interface = &xml_cdr_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	Wed Jun 20 13:06:05 2007
@@ -143,20 +143,6 @@
 	return xml;
 }
 
-
-static switch_loadable_module_interface_t xml_curl_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ NULL,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL
-};
-
 static switch_status_t do_config(void)
 {
 	char *cf = "xml_curl.conf";
@@ -234,7 +220,7 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_xml_curl_load)
 {
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &xml_curl_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	if (do_config() == SWITCH_STATUS_SUCCESS) {
 		curl_global_init(CURL_GLOBAL_ALL);

Modified: freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	Wed Jun 20 13:06:05 2007
@@ -47,19 +47,6 @@
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_xml_rpc_runtime);
 SWITCH_MODULE_DEFINITION(mod_xml_rpc, mod_xml_rpc_load, mod_xml_rpc_shutdown, mod_xml_rpc_runtime);
 
-static switch_loadable_module_interface_t xml_rpc_module_interface = {
-	/*.module_name */ modname,
-	/*.endpoint_interface */ NULL,
-	/*.timer_interface */ NULL,
-	/*.dialplan_interface */ NULL,
-	/*.codec_interface */ NULL,
-	/*.application_interface */ NULL,
-	/*.api_interface */ NULL,
-	/*.file_interface */ NULL,
-	/*.speech_interface */ NULL,
-	/*.directory_interface */ NULL
-};
-
 static struct {
 	uint16_t port;
 	uint8_t running;
@@ -69,10 +56,10 @@
 } globals;
 
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_realm, globals.realm)
-	SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_user, globals.user)
-	SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_pass, globals.pass)
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_user, globals.user)
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_pass, globals.pass)
 
-	 static switch_status_t do_config(void)
+ static switch_status_t do_config(void)
 {
 	char *cf = "xml_rpc.conf";
 	switch_xml_t cfg, xml, settings, param;
@@ -118,7 +105,7 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_xml_rpc_load)
 {
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &xml_rpc_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	memset(&globals, 0, sizeof(globals));
 

Modified: freeswitch/branches/greenlizard/src/switch_channel.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_channel.c	(original)
+++ freeswitch/branches/greenlizard/src/switch_channel.c	Wed Jun 20 13:06:05 2007
@@ -319,9 +319,10 @@
 	if (!(v = switch_core_hash_find(channel->variables, varname))) {
 		if (!channel->caller_profile || !(v = switch_caller_get_field_by_name(channel->caller_profile, varname))) {
 			if (!strcmp(varname, "base_dir")) {
-				return SWITCH_GLOBAL_dirs.base_dir;
+				v = SWITCH_GLOBAL_dirs.base_dir;
+			} else {
+				v = switch_core_get_variable(varname);
 			}
-			v = switch_core_get_variable(varname);
 		}
 	}
 	switch_mutex_unlock(channel->profile_mutex);
@@ -711,7 +712,7 @@
 		if (state > CS_RING) {
 			switch_channel_presence(channel, "unknown", (char *) state_names[state]);
 		}
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s State Change %s -> %s\n",
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "%s State Change %s -> %s\n",
 						  channel->name, state_names[last_state], state_names[state]);
 		switch_mutex_lock(channel->flag_mutex);
 		channel->state = state;
@@ -742,7 +743,7 @@
 		}
 
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_WARNING,
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_WARNING,
 						  "%s Invalid State Change %s -> %s\n", channel->name, state_names[last_state], state_names[state]);
 
 		/* we won't tolerate an invalid state change so we can make sure we are as robust as a nice cup of dark coffee! */
@@ -1049,7 +1050,7 @@
 		switch_channel_state_t last_state = channel->state;
 		channel->state = CS_HANGUP;
 		channel->hangup_cause = hangup_cause;
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
 						  channel->name, state_names[last_state], switch_channel_cause2str(channel->hangup_cause));
 		if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", "%s", switch_channel_cause2str(channel->hangup_cause));
@@ -1072,7 +1073,7 @@
 SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready(switch_channel_t *channel, const char *file, const char *func, int line)
 {
 	if (!switch_channel_test_flag(channel, CF_RING_READY)) {
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
 		switch_channel_set_flag(channel, CF_RING_READY);
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -1092,7 +1093,7 @@
 		char *uuid;
 		switch_core_session_t *other_session;
 
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name);
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name);
 		switch_channel_set_flag(channel, CF_EARLY_MEDIA);
 		switch_channel_set_variable(channel, "endpoint_disposition", "EARLY MEDIA");
 		if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PROGRESS) == SWITCH_STATUS_SUCCESS) {
@@ -1168,7 +1169,7 @@
 	status = switch_core_session_receive_message(channel->session, &msg);
 
 	if (status == SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
 	}
 
 	return status;
@@ -1213,7 +1214,7 @@
 	}
 
 	switch_channel_set_variable(channel, "endpoint_disposition", "ANSWER");
-	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
+	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
 
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/greenlizard/src/switch_core_io.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_core_io.c	(original)
+++ freeswitch/branches/greenlizard/src/switch_core_io.c	Wed Jun 20 13:06:05 2007
@@ -746,7 +746,7 @@
 	switch_io_event_hook_kill_channel_t *ptr;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "Kill %s [%s]\n", switch_channel_get_name(session->channel),
+	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "Kill %s [%s]\n", switch_channel_get_name(session->channel),
 					  SIG_NAMES[sig]);
 
 	if (session->endpoint_interface->io_routines->kill_channel) {

Modified: freeswitch/branches/greenlizard/src/switch_core_session.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_core_session.c	(original)
+++ freeswitch/branches/greenlizard/src/switch_core_session.c	Wed Jun 20 13:06:05 2007
@@ -658,7 +658,7 @@
 	switch_memory_pool_t *pool;
 	switch_event_t *event;
 
-	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n", 
+	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n", 
 					  switch_channel_get_name((*session)->channel),
 					  switch_channel_state_name(switch_channel_get_state((*session)->channel)));
 	

Modified: freeswitch/branches/greenlizard/src/switch_event.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_event.c	(original)
+++ freeswitch/branches/greenlizard/src/switch_event.c	Wed Jun 20 13:06:05 2007
@@ -870,7 +870,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_event_bind(char *id, switch_event_types_t event, char *subclass_name, switch_event_callback_t callback,
+SWITCH_DECLARE(switch_status_t) switch_event_bind(const char *id, switch_event_types_t event, char *subclass_name, switch_event_callback_t callback,
 												  void *user_data)
 {
 	switch_event_node_t *event_node;

Modified: freeswitch/branches/greenlizard/src/switch_log.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_log.c	(original)
+++ freeswitch/branches/greenlizard/src/switch_log.c	Wed Jun 20 13:06:05 2007
@@ -164,7 +164,7 @@
 }
 
 SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
-									   switch_log_level_t level, const char *fmt, ...)
+									   const char *userdata, switch_log_level_t level, const char *fmt, ...)
 {
 	char *data = NULL;
 	char *new_fmt = NULL;

Modified: freeswitch/branches/greenlizard/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_rtp.c	(original)
+++ freeswitch/branches/greenlizard/src/switch_rtp.c	Wed Jun 20 13:06:05 2007
@@ -32,6 +32,7 @@
  */
 
 #include <switch.h>
+#include <switch_stun.h>
 #undef PACKAGE_NAME
 #undef PACKAGE_STRING
 #undef PACKAGE_TARNAME

Modified: freeswitch/branches/greenlizard/src/switch_stun.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_stun.c	(original)
+++ freeswitch/branches/greenlizard/src/switch_stun.c	Wed Jun 20 13:06:05 2007
@@ -31,6 +31,7 @@
  *
  */
 #include <switch.h>
+#include <switch_stun.h>
 
 struct value_mapping {
 	const uint32_t value;



More information about the Freeswitch-branches mailing list